From 84cc90e3433bfe064bf55b7c6e4fe1eb6d448337 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 14 Nov 2024 16:02:15 +0000 Subject: [PATCH 1/5] Test CI. Signed-off-by: Nuno Cruces --- .github/workflows/commit.yaml | 38 +++++++++++++++++++++++++++++++++ internal/sysfs/file_test.go | 19 ----------------- internal/sysfs/futimens_test.go | 12 +++++++++++ sys/stat_test.go | 2 +- 4 files changed, 51 insertions(+), 20 deletions(-) diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index fc3027c726..158e411834 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -152,6 +152,44 @@ jobs: # This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests. run: find . -name "*.test" | xargs -Itestbin docker run --platform linux/${{ matrix.arch }} -v $(pwd)/testbin:/test -v $(pwd)/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test + test_bsd: + name: amd64, ${{ matrix.os.name }} + runs-on: ubuntu-22.04 + strategy: + fail-fast: false # don't fail fast as sometimes failures are OS specific + matrix: + os: + - name: freebsd + version: "14.1" + - name: openbsd + version: "7.5" + - name: netbsd + version: "10.0" + + steps: + + - uses: actions/checkout@v3 + + - name: Build test binaries + run: | + go list -f '{{.Dir}}' ./... | egrep -v 'imports|sysfs|integration_test/[^s]' | xargs -Ipkg go test pkg -c -o pkg.test + go build -o wazerocli ./cmd/wazero + env: + GOOS: ${{ matrix.os.name }} + + - name: Run built test binaries + uses: cross-platform-actions/action@v0.25.0 + env: + WAZEROCLI: ./wazerocli + with: + operating_system: ${{ matrix.os.name }} + version: ${{ matrix.os.version }} + shell: bash + sync_files: runner-to-vm + environment_variables: WAZEROCLI + # This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests. + run: find . -name "*.test" | xargs -t -Itestbin nice testbin + # This ensures that internal/integration_test/fuzz is runnable, and is not intended to # run full-length fuzzing while trying to find low-hanging frontend bugs. fuzz: diff --git a/internal/sysfs/file_test.go b/internal/sysfs/file_test.go index 9bcd1a2201..b2ef360e20 100644 --- a/internal/sysfs/file_test.go +++ b/internal/sysfs/file_test.go @@ -1000,25 +1000,6 @@ func TestFileTruncate(t *testing.T) { }) } -func TestFileUtimens(t *testing.T) { - switch runtime.GOOS { - case "linux", "darwin": // supported - case "freebsd": // TODO: support freebsd w/o CGO - case "windows": - default: // expect ENOSYS and callers need to fall back to Utimens - t.Skip("unsupported GOOS", runtime.GOOS) - } - - testUtimens(t, true) - - testEBADFIfFileClosed(t, func(f experimentalsys.File) experimentalsys.Errno { - return f.Utimens(experimentalsys.UTIME_OMIT, experimentalsys.UTIME_OMIT) - }) - testEBADFIfDirClosed(t, func(d experimentalsys.File) experimentalsys.Errno { - return d.Utimens(experimentalsys.UTIME_OMIT, experimentalsys.UTIME_OMIT) - }) -} - func TestNewStdioFile(t *testing.T) { // simulate regular file attached to stdin f, err := os.CreateTemp(t.TempDir(), "somefile") diff --git a/internal/sysfs/futimens_test.go b/internal/sysfs/futimens_test.go index 5e690b0dfc..abb66e44d7 100644 --- a/internal/sysfs/futimens_test.go +++ b/internal/sysfs/futimens_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/tetratelabs/wazero/experimental/sys" + experimentalsys "github.com/tetratelabs/wazero/experimental/sys" "github.com/tetratelabs/wazero/internal/platform" "github.com/tetratelabs/wazero/internal/testing/require" ) @@ -22,6 +23,17 @@ func TestUtimens(t *testing.T) { testUtimens(t, false) } +func TestFileUtimens(t *testing.T) { + testUtimens(t, true) + + testEBADFIfFileClosed(t, func(f experimentalsys.File) experimentalsys.Errno { + return f.Utimens(experimentalsys.UTIME_OMIT, experimentalsys.UTIME_OMIT) + }) + testEBADFIfDirClosed(t, func(d experimentalsys.File) experimentalsys.Errno { + return d.Utimens(experimentalsys.UTIME_OMIT, experimentalsys.UTIME_OMIT) + }) +} + func testUtimens(t *testing.T, futimes bool) { // Note: This sets microsecond granularity because Windows doesn't support // nanosecond. diff --git a/sys/stat_test.go b/sys/stat_test.go index 32d0ffeac7..f58b16535e 100644 --- a/sys/stat_test.go +++ b/sys/stat_test.go @@ -117,7 +117,7 @@ func Test_NewStat_t(t *testing.T) { tc := tt t.Run(tc.name, func(t *testing.T) { st := sys.NewStat_t(tc.info) - if tc.expectDevIno && runtime.GOOS != "windows" { + if tc.expectDevIno && (runtime.GOOS == "linux" || runtime.GOOS == "darwin" || runtime.GOOS == "freebsd") { require.NotEqual(t, uint64(0), st.Dev) require.NotEqual(t, uint64(0), st.Ino) } else { From ddddbeaa8b9ae3ea9725de83c2e393cf25ede57c Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 14 Nov 2024 17:30:17 +0000 Subject: [PATCH 2/5] More. Signed-off-by: Nuno Cruces --- .github/workflows/commit.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index 158e411834..e370d9a912 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -172,7 +172,7 @@ jobs: - name: Build test binaries run: | - go list -f '{{.Dir}}' ./... | egrep -v 'imports|sysfs|integration_test/[^s]' | xargs -Ipkg go test pkg -c -o pkg.test + go list -f '{{.Dir}}' ./... | egrep -v 'imports|sysfs' | xargs -Ipkg go test pkg -c -o pkg.test go build -o wazerocli ./cmd/wazero env: GOOS: ${{ matrix.os.name }} @@ -188,7 +188,7 @@ jobs: sync_files: runner-to-vm environment_variables: WAZEROCLI # This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests. - run: find . -name "*.test" | xargs -t -Itestbin nice testbin + run: find . -name "*.test" | xargs -Itestbin nice testbin -test.short # This ensures that internal/integration_test/fuzz is runnable, and is not intended to # run full-length fuzzing while trying to find low-hanging frontend bugs. From 8e7178997ae88853533810c6363950d2d0e907ed Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 14 Nov 2024 17:48:24 +0000 Subject: [PATCH 3/5] Review. Signed-off-by: Nuno Cruces --- .github/workflows/commit.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index e370d9a912..50e5df75e1 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -167,7 +167,6 @@ jobs: version: "10.0" steps: - - uses: actions/checkout@v3 - name: Build test binaries @@ -187,7 +186,7 @@ jobs: shell: bash sync_files: runner-to-vm environment_variables: WAZEROCLI - # This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests. + # This runs all tests compiled above in sequence. run: find . -name "*.test" | xargs -Itestbin nice testbin -test.short # This ensures that internal/integration_test/fuzz is runnable, and is not intended to From c8180558765e03c021a19f45eeff542ec0caabdc Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 14 Nov 2024 17:51:18 +0000 Subject: [PATCH 4/5] Docs. Signed-off-by: Nuno Cruces --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f020be99a7..06a29d35bb 100644 --- a/README.md +++ b/README.md @@ -101,9 +101,11 @@ We currently test Linux (Ubuntu and scratch), MacOS and Windows as packaged by * Interpreter * Linux is tested on amd64 (native) as well arm64 and riscv64 via emulation. * MacOS and Windows are only tested on amd64. + * NetBSD and OpenBSD are only tested on amd64. * Compiler * Linux is tested on amd64 (native) as well arm64 via emulation. * MacOS and Windows are only tested on amd64. + * FreeBSD is only tested on amd64. wazero has no dependencies and doesn't require CGO. This means it can also be embedded in an application that doesn't use an operating system. This is a main From a502775c7487d4f824f21706c12c4f24bd2c56a3 Mon Sep 17 00:00:00 2001 From: Takeshi Yoneda Date: Thu, 14 Nov 2024 10:27:23 -0800 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06a29d35bb..d478dd0321 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ We currently test Linux (Ubuntu and scratch), MacOS and Windows as packaged by * Interpreter * Linux is tested on amd64 (native) as well arm64 and riscv64 via emulation. * MacOS and Windows are only tested on amd64. - * NetBSD and OpenBSD are only tested on amd64. + * FreeBSD, NetBSD and OpenBSD are only tested on amd64. * Compiler * Linux is tested on amd64 (native) as well arm64 via emulation. * MacOS and Windows are only tested on amd64.