github.com/quay/claircore@v1.5.28/test/integration/fixup_linux.go (about) 1 package integration 2 3 import ( 4 "os" 5 "runtime" 6 "strings" 7 "syscall" 8 ) 9 10 // The zonkyio/embedded-postgres-binaries project produces ARM binaries with the 11 // following name schema: 12 // 13 // - 32bit : arm32v6 / arm32v7 14 // - 64bit (aarch64): arm64v8 15 16 func findArch() (arch string) { 17 arch = runtime.GOARCH 18 switch arch { 19 case "386": 20 arch = "i" + arch 21 case "arm64": 22 arch += "v8" 23 case "arm": 24 var u syscall.Utsname 25 if err := syscall.Uname(&u); err != nil { 26 // Not sure why this would happen? Try to use the lowest revision 27 // and let it crash otherwise. 28 arch += "32v6" 29 break 30 } 31 t := make([]byte, 0, len(u.Machine[:])) 32 for _, b := range u.Machine[:] { 33 if b == 0 { 34 break 35 } 36 t = append(t, byte(b)) 37 } 38 mach := strings.TrimRight(string(t), "\x00") 39 switch { 40 case strings.HasPrefix(mach, "armv7"): 41 arch += "32v7" 42 case strings.HasPrefix(mach, "armv6"): 43 arch += "32v6" 44 default: 45 return "" 46 } 47 case "ppc64le": // OK 48 case "amd64": // OK 49 default: 50 // Will cause the [startEmbedded] function to print a warning and fail 51 // the test if the environment requires an embedded database. 52 return "" 53 } 54 // If on alpine: 55 if _, err := os.Stat("/etc/alpine-release"); err == nil { 56 arch += "-alpine" 57 } 58 59 return arch 60 }