Skip to content

WASIX test revamp#6055

Merged
zebreus merged 31 commits intomainfrom
wasix-test-revamp
Mar 2, 2026
Merged

WASIX test revamp#6055
zebreus merged 31 commits intomainfrom
wasix-test-revamp

Conversation

@zebreus
Copy link
Contributor

@zebreus zebreus commented Jan 14, 2026

Description

Copilot AI review requested due to automatic review settings January 14, 2026 16:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR revamps the WASIX test infrastructure by introducing a new test utility framework and comprehensive context switching tests. The changes replace the old inline test compilation approach with a more structured system using build scripts and test utilities.

Changes:

  • Added wasixcc_test_utils.rs providing utilities for compiling and running WASIX tests
  • Refactored context_switching.rs to use the new build script-based test approach
  • Added 19 new context switching test cases with corresponding C source files and build scripts
  • Updated .gitignore to exclude build artifacts while preserving source files

Reviewed changes

Copilot reviewed 57 out of 76 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
lib/wasix/tests/wasixcc_test_utils.rs New test utility framework with compilation and execution helpers
lib/wasix/tests/context_switching.rs Refactored to use build scripts instead of inline compilation
lib/wasix/tests/.gitignore Updated patterns for new test structure
lib/wasix/tests/context_switching/*/build.sh Simple build scripts for each test case
lib/wasix/tests/context_switching//.c Comprehensive test cases for context switching scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marxin
Copy link
Contributor

marxin commented Feb 26, 2026

When running locally, I noticed a couple of failing tests due to:

  stderr ───
    Build stdout:
    Build stderr: main.c:2:10: fatal error: 'ffi.h' file not found
        2 | #include <ffi.h>
          |          ^~~~~~~
    1 error generated.
    Error: Command failed with status: exit status: 1; the command was: "/home/marxin/.wasixcc/llvm/bin/clang" "--sysroot" "/home/marxin/.wasixcc/sysroot/sysroot-exnref-ehpic" "--target=wasm32-wasi" "-c" "-matomics" "-mbulk-memory" "-mmutable-globals" "-pthread" "-mthread-model" "posix" "-fno-trapping-math" "-D_WASI_EMULATED_MMAN" "-D_WASI_EMULATED_SIGNAL" "-D_WASI_EMULATED_PROCESS_CLOCKS" "-fwasm-exceptions" "-mllvm" "--wasm-enable-eh" "-mllvm" "--wasm-enable-sjlj" "-mllvm" "--wasm-use-legacy-eh=false" "-fPIC" "-ftls-model=global-dynamic" "-fvisibility=default" "-fPIC" "-I/home/marxin/.wasixcc/sysroot/usr/local/include" "-iwithsysroot" "/usr/local/include/c++/v1" "-c" "main.c" "-o" "main.o"

What am I missing?

@zebreus
Copy link
Contributor Author

zebreus commented Feb 26, 2026

@marxin You are missing the compatible sysroot (which means a sysroot with libffi)

@marxin
Copy link
Contributor

marxin commented Feb 26, 2026

@marxin You are missing the compatible sysroot (which means a sysroot with libffi)

❯ l ~/.wasixcc/sysroot/
Permissions Size User   Date Modified Name
drwxr-xr-x     - marxin 26 Feb 09:23   sysroot
drwxr-xr-x     - marxin 26 Feb 09:23   sysroot-eh
drwxr-xr-x     - marxin 26 Feb 09:23   sysroot-ehpic
drwxr-xr-x     - marxin 26 Feb 09:23   sysroot-exnref-eh
drwxr-xr-x     - marxin 26 Feb 09:23   sysroot-exnref-ehpic

How should I install it?

@marxin
Copy link
Contributor

marxin commented Feb 26, 2026

@zebreus cool! Your testing effort exposed a Cranelift EH defect: #6244. I am going to disable the test for now so that it does not block your PR effort.

Copy link
Contributor

@marxin marxin left a comment

Choose a reason for hiding this comment

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

For the newly added file, please run clang-format so that we have a unified coding style (and we'll get rid of trailing spaces).

I will do that in a subsequent PR, seems there are other files (outside of this PR) that need it as well.

Copy link
Contributor

@marxin marxin left a comment

Choose a reason for hiding this comment

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

Would be nice if we could get rid of tests/wasix/test.sh and port all the tests in the sub-folder to the new infrastructure.

@marxin marxin marked this pull request as ready for review February 26, 2026 09:51
@zebreus
Copy link
Contributor Author

zebreus commented Mar 2, 2026

@marxin I think it's a good idea to commit the new test files already clang-formatted. There is a clang format config to make the output similar to rustfmt at https://gist.github.com/julyfun/8a739e0529818a4a41bf1762e6859fbf which might be nice. Alternatively we could just use the defaults of clang-format

@marxin
Copy link
Contributor

marxin commented Mar 2, 2026

@marxin I think it's a good idea to commit the new test files already clang-formatted.

Great, then please use the default format configuration. I don't care about the style itself at all (I only obey rustfmt), but it would be nice to have an uniform formatting.

@zebreus zebreus force-pushed the wasix-test-revamp branch from 69026d4 to e9ba585 Compare March 2, 2026 11:49
@zebreus zebreus merged commit 079027f into main Mar 2, 2026
76 checks passed
@zebreus zebreus deleted the wasix-test-revamp branch March 2, 2026 21:52
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