From 5f3942c4e4e595a28a7fc0b332626685d1f4a95a Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:40:59 +0100 Subject: [PATCH 1/4] ci: update alpine to 3.21 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a537d0..40f560d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,10 +35,6 @@ jobs: fail-fast: false matrix: include: - - - image: alpine:3.16 - typ: alpine - allow-failure: false - image: alpine:3.17 typ: alpine @@ -55,6 +51,10 @@ jobs: image: alpine:3.20 typ: alpine allow-failure: false + - + image: alpine:3.21 + typ: alpine + allow-failure: false - image: alpine:edge typ: alpine From c1a50528925904214f82801f143a1ef00301f764 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:01:28 +0100 Subject: [PATCH 2/4] test-apk: libz moved to /usr/lib since 3.21 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/test-apk.bats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test-apk.bats b/src/test-apk.bats index 4ae9b65..c26c18c 100755 --- a/src/test-apk.bats +++ b/src/test-apk.bats @@ -37,10 +37,10 @@ load 'assert' assert_output "$(xx-info alpine-arch)" run xx-apk add --no-cache zlib assert_success - [ -f "/$(xx-info)/lib/libz.so.1" ] + [ -f "/$(xx-info)/lib/libz.so.1" ] || [ -f "/$(xx-info)/usr/lib/libz.so.1" ] run xx-apk del zlib assert_success - [ ! -f "/$(xx-info)/lib/libz.so.1" ] + [ ! -f "/$(xx-info)/lib/libz.so.1" ] && [ ! -f "/$(xx-info)/usr/lib/libz.so.1" ] run xx-apk clean assert_success [ ! -d "/$(xx-info)" ] From 41a60e1b47ce24a2734ab55cb52affbd194913ab Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:24:03 +0100 Subject: [PATCH 3/4] xx-verify: since file 5.46 it expects Intel i386 Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/test-verify.bats | 10 ++++++++++ src/xx-verify | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/test-verify.bats b/src/test-verify.bats index 34e51fc..2f760d6 100755 --- a/src/test-verify.bats +++ b/src/test-verify.bats @@ -147,6 +147,11 @@ load 'assert' run xx-verify /idontexist assert_failure + export XX_VERIFY_FILE_CMD_OUTPUT=": PE32 executable (console) Intel i386 (stripped to external PDB), for MS Windows" + export TARGETPLATFORM=windows/386 + run xx-verify /idontexist + assert_success + export XX_VERIFY_FILE_CMD_OUTPUT=": PE32 executable (console) Intel 80386 (stripped to external PDB), for MS Windows" export TARGETPLATFORM=windows/386 run xx-verify /idontexist @@ -208,6 +213,11 @@ load 'assert' run xx-verify /idontexist assert_failure + export XX_VERIFY_FILE_CMD_OUTPUT=": ELF 32-bit LSB executable, Intel i386, version 1 (SYSV), statically linked, Go BuildID=GUb5psm2_Qmc_LlEF7GP/wcIHIg_4MjQh8NC5wfep/LSmTmWKKZ5smuAQbfeFE/FBYRjFmbJQpV--JKtz4i, not stripped" + export TARGETPLATFORM=linux/386 + run xx-verify /idontexist + assert_success + export XX_VERIFY_FILE_CMD_OUTPUT=": ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, Go BuildID=GUb5psm2_Qmc_LlEF7GP/wcIHIg_4MjQh8NC5wfep/LSmTmWKKZ5smuAQbfeFE/FBYRjFmbJQpV--JKtz4i, not stripped" export TARGETPLATFORM=linux/386 run xx-verify /idontexist diff --git a/src/xx-verify b/src/xx-verify index ef51e7c..f2cb977 100755 --- a/src/xx-verify +++ b/src/xx-verify @@ -144,7 +144,8 @@ for f in "$@"; do fi expArch="" - expArch2="" # extra check for endianness + expArchAlt="" # alternate arch name + expArch2="" # extra check for endianness case "$TARGETARCH" in "arm64") case "$TARGETOS" in @@ -226,7 +227,8 @@ for f in "$@"; do expArch2="64-bit LSB" ;; "386") - expArch="Intel 80386" + expArch="Intel i386" + expArchAlt="Intel 80386" if [ "$TARGETOS" != "windows" ]; then expArch2="32-bit LSB" fi @@ -239,8 +241,15 @@ for f in "$@"; do fi if ! echo "$out" | grep "$expArch" >/dev/null; then - echo >&2 "file ${f} does not match expected target architecture ${TARGETARCH}: $out" - exit 1 + if [ -n "$expArchAlt" ]; then + if ! echo "$out" | grep "$expArchAlt" >/dev/null; then + echo >&2 "file ${f} does not match expected target architecture ${TARGETARCH}: $out" + exit 1 + fi + else + echo >&2 "file ${f} does not match expected target architecture ${TARGETARCH}: $out" + exit 1 + fi fi if [ -n "$expArch2" ]; then From e6955cb218473e0f4d89073707f57f52a7f4f80c Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:39:24 +0100 Subject: [PATCH 4/4] xx-verify: since file 5.46 it expects ARM64 on Windows Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/test-go.bats | 50 ++++++++++++++++++++++++++++++++++++++++++++ src/test-verify.bats | 5 +++++ src/test_helper.bash | 4 ++++ src/xx-verify | 3 ++- 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/test-go.bats b/src/test-go.bats index 16d2346..b1e3f2b 100755 --- a/src/test-go.bats +++ b/src/test-go.bats @@ -226,6 +226,7 @@ testEnv() { export TARGETOS=darwin export TARGETARCH=amd64 testEnv + unset TARGETOS } @test "darwin-arm64-env" { @@ -235,6 +236,30 @@ testEnv() { unset TARGETOS } +@test "windows-386-env" { + export TARGETOS=windows + export TARGETARCH=386 + testEnv + unset TARGETOS +} + +@test "windows-amd64-env" { + export TARGETOS=windows + export TARGETARCH=amd64 + testEnv + unset TARGETOS +} + +@test "windows-arm64-env" { + if ! supportWindowsArm64Go; then + skip "Windows ARM64 not supported" + fi + export TARGETOS=windows + export TARGETARCH=arm64 + testEnv + unset TARGETOS +} + testHelloGO() { run xx-go build -o /tmp/a.out ./fixtures/hello.go assert_success @@ -346,6 +371,31 @@ testHelloGO() { export TARGETARCH=amd64 export TARGETOS=darwin testHelloGO + unset TARGETOS +} + +@test "windows-386-hellogo" { + export TARGETARCH=386 + export TARGETOS=windows + testHelloGO + unset TARGETOS +} + +@test "windows-amd64-hellogo" { + export TARGETARCH=amd64 + export TARGETOS=windows + testHelloGO + unset TARGETOS +} + +@test "windows-arm64-hellogo" { + if ! supportWindowsArm64Go; then + skip "Windows ARM64 not supported" + fi + export TARGETARCH=arm64 + export TARGETOS=windows + testHelloGO + unset TARGETOS } testHelloCGO() { diff --git a/src/test-verify.bats b/src/test-verify.bats index 2f760d6..a9db217 100755 --- a/src/test-verify.bats +++ b/src/test-verify.bats @@ -121,6 +121,11 @@ load 'assert' run xx-verify /idontexist assert_failure + export XX_VERIFY_FILE_CMD_OUTPUT=": PE32+ executable (console) ARM64 (stripped to external PDB), for MS Windows" + export TARGETPLATFORM=windows/arm64 + run xx-verify /idontexist + assert_success + export XX_VERIFY_FILE_CMD_OUTPUT=": PE32+ executable (console) Aarch64 (stripped to external PDB), for MS Windows" export TARGETPLATFORM=windows/arm64 run xx-verify /idontexist diff --git a/src/test_helper.bash b/src/test_helper.bash index 7c04d84..1d78a05 100644 --- a/src/test_helper.bash +++ b/src/test_helper.bash @@ -101,6 +101,10 @@ supportMipsBuildGo() { ! grep -q 'ID=ubuntu' /etc/os-release && ! grep -q 'VERSION_ID="22.04"' /etc/os-release && versionGTE "$(go version | awk '{print $3}' | sed 's/^go//')" "1.13" } +supportWindowsArm64Go() { + versionGTE "$(go version | awk '{print $3}' | sed 's/^go//')" "1.17" +} + supportRC() { command -v llvm-rc >/dev/null 2>&1 } diff --git a/src/xx-verify b/src/xx-verify index f2cb977..1f8e8ca 100755 --- a/src/xx-verify +++ b/src/xx-verify @@ -153,7 +153,8 @@ for f in "$@"; do expArch="arm64" ;; "windows") - expArch="Aarch64" + expArch="ARM64" + expArchAlt="Aarch64" ;; *) expArch="ARM aarch64"