Skip to content

Conversation

wingo
Copy link
Collaborator

@wingo wingo commented Aug 15, 2025

We move all the C sources from tests/c/testsuite to tests/c/src, somewhat like the Rust tests, then treat tests/c/testsuite as a built directory.

The build script is rewritten to Python, as it is getting a bit more complicated.

Tests are compiled into target-specific dirs, currently only tests/c/testsuite/wasm32-wasip1.

The build script writes the version-specific manifest.json, so as to include the target in the test suite name.

Workflows updated appropriately.

Stacked on #110.

@wingo wingo marked this pull request as ready for review August 15, 2025 09:53
Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Since I don't have 100% of the context on this, I think we should wait a few days for @loganek to be able to take a look as well

@pchickey pchickey requested a review from loganek August 15, 2025 17:40
@loganek
Copy link
Collaborator

loganek commented Aug 18, 2025

Hi, sorry I was on holidays. I'll follow-up on this, and other related topics in the next few days.

@@ -7,7 +7,7 @@ int main() {
FILE *file = fopen("fs-tests.dir/file", "r");

assert(file == NULL);
assert(errno == ENOTCAPABLE);
assert(errno == ENOTCAPABLE || errno == ENOENT);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it expected in wasip2 to return ENOENT when file is not accessible?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in wasip2 and beyond we got rid of the rights system from p1, so ENOTCAPABLE is no longer an applicable errno. It shouldn't be used at all in wasip2 and beyond.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since those tests are also being used for p1 too, I'd suggest to either have a copy of that in the wasi version specific directory, or use a compiler's define for different WASI versions and conditionally turn this assert off or on. For this specific test my preference would be the latter given the test is almost compatible with all the WASI versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is no longer part of this PR, fwiw, as it was merged in #110.

Copy link
Collaborator

@loganek loganek Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be reverted and done correctly then given it's weakening the assertion for p1?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm merging this PR as the change is not related, but please follow-up on this particular change.

wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
@wingo wingo mentioned this pull request Aug 21, 2025
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
We move all the C sources from tests/c/testsuite to tests/c/src,
somewhat like the Rust tests, then treat tests/c/testsuite as a built
directory.

The build script is rewritten to Python, as it is getting a bit more
complicated.

Tests are compiled into target-specific dirs, currently only
tests/c/testsuite/wasm32-wasip1.

The build script writes the version-specific manifest.json, so as to
include the target in the test suite name.

Workflows updated appropriately.
@wingo
Copy link
Collaborator Author

wingo commented Aug 21, 2025

Rebased and simplified build.py.

wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/assemblyscript/: Root of npm repo

  - tests/assemblyscript/testsuite: AS source files, JSON test files;
    built .wasm files dumped here

Now it is:
  - tests/assemblyscript/wasm32-wasip1: Root of npm package for wasip1 builds

  - tests/assemblyscript/wasm32-wasip1/src: Assemblyscript source, but
    also JSON

  - tests/assemblyscript/testsuite/: Removed; instead it is a built dir

  - tests/assemblyscript/testsuite/wasm32-wasip1: All wasm and json
    files copied here
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of harmonizing the various test suites, so that testsuite/
is always a built dir.

Before, it was:
  - tests/assemblyscript/: Root of npm repo

  - tests/assemblyscript/testsuite: AS source files, JSON test files;
    built .wasm files dumped here

Now it is:
  - tests/assemblyscript/wasm32-wasip1: Root of npm package for wasip1 builds

  - tests/assemblyscript/wasm32-wasip1/src: Assemblyscript source, but
    also JSON

  - tests/assemblyscript/testsuite/: Removed; instead it is a built dir

  - tests/assemblyscript/testsuite/wasm32-wasip1: All wasm and json
    files copied here
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of harmonizing the various test suites, so that testsuite/
is always a built dir.

Before, it was:
  - tests/assemblyscript/: Root of npm repo

  - tests/assemblyscript/testsuite: AS source files, JSON test files;
    built .wasm files dumped here

Now it is:
  - tests/assemblyscript/wasm32-wasip1: Root of npm package for wasip1 builds

  - tests/assemblyscript/wasm32-wasip1/src: Assemblyscript source, but
    also JSON

  - tests/assemblyscript/testsuite/: Removed; instead it is a built dir

  - tests/assemblyscript/testsuite/wasm32-wasip1: All wasm and json
    files copied here
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 21, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of harmonizing the various test suites, so that testsuite/
is always a built dir.

Before, it was:
  - tests/assemblyscript/: Root of npm repo

  - tests/assemblyscript/testsuite: AS source files, JSON test files;
    built .wasm files dumped here

Now it is:
  - tests/assemblyscript/wasm32-wasip1: Root of npm package for wasip1 builds

  - tests/assemblyscript/wasm32-wasip1/src: Assemblyscript source, but
    also JSON

  - tests/assemblyscript/testsuite/: Removed; instead it is a built dir

  - tests/assemblyscript/testsuite/wasm32-wasip1: All wasm and json
    files copied here
@@ -0,0 +1,104 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just looking at the https://github.com/WebAssembly/wasi-testsuite/pull/114/files and it seems a lot of duplication, I wonder if we can refactor it in a way that the common part can be reused across different languages?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think yes, but wdyt about me doing that in a followup? It's a bit easier when the three implementations are actually there in the source tree.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine by me. Could you open a tracking issue so we don't forget about this? Thanks

.DS_Store
/tests/c/testsuite/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps it's best to use relative path here?

wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 25, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
loganek pushed a commit that referenced this pull request Aug 26, 2025
As in #112, we
reorganize the directory structure and change to a python build script,
with the goal of harmonizing the various test suites, so that testsuite/
is always a built dir.

Before, it was:
  - tests/assemblyscript/: Root of npm repo

  - tests/assemblyscript/testsuite: AS source files, JSON test files;
    built .wasm files dumped here

Now it is:
  - tests/assemblyscript/wasm32-wasip1: Root of npm package for wasip1 builds

  - tests/assemblyscript/wasm32-wasip1/src: Assemblyscript source, but
    also JSON

  - tests/assemblyscript/testsuite/: Removed; instead it is a built dir

  - tests/assemblyscript/testsuite/wasm32-wasip1: All wasm and json
    files copied here
@loganek loganek merged commit b1978f0 into WebAssembly:main Aug 26, 2025
14 checks passed
wingo added a commit to wingo/wasi-testsuite that referenced this pull request Aug 27, 2025
As in WebAssembly#112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
loganek pushed a commit that referenced this pull request Aug 27, 2025
As in #112, we
reorganize the directory structure and change to a python build script,
with the goal of making space for wasip3.

Before, it was:
  - tests/rust/: Root of cargo package

  - tests/rust/src: Rust source files

  - tests/rust/testsuite: JSON test files, fs-tests.dir; built .wasm files
    dumped here

Now it is:
  - tests/rust/wasm32-wasip1: Root of cargo package for wasip1 builds

  - tests/rust/wasm32-wasip1/src: Rust source, but also JSON and fs-tests.dir

  - tests/rust/testsuite/: Removed; instead it is a built dir

  - tests/rust/testsuite/wasm32-wasip1: All wasm and json files copied here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants