Skip to content

Commit 2b853ff

Browse files
authoredDec 9, 2024··
test: improve test infrastructure (#554)
This change represents a rather large re-design in how `wasi-libc` builds and runs its tests. Initially, #346 retrieved the `libc-test` repository and built a subset of those tests to give us some amount of test coverage. Later, because there was no way to add custom C tests, #522 added a `smoke` directory which allowed this. But (a) each of these test suites was built and run separately and (b) it was unclear how to add more tests flexibly--some tests should only run on `*p2` targets or `*-threads` targets, e.g. This change reworks all of this so that all tests are built the same way, in the same place. For downloaded tests like those from `libc-test`, I chose to add "stub tests" that `#include` the original version. This not only keeps all enabled tests in one place, it also allows us to add "directives," C comments that the `Makefile` uses to filter out tests for certain targets or add special compile, link or run flags. These rudimentary scripts, along with other Bash logic I moved out of the Makefile now live in the `scripts` directory. Finally, all of this is explained more clearly in an updated `README.md`. The hope with documenting this a bit better is that it would be easier for drive-by contributors to be able to either dump in new C tests for regressions they may find or enable more libc-tests. As of my current count, we only enable 40/75 of libc-test's functional tests, 0/228 math tests, 0/69 regression tests, and 0/79 API tests. Though many of these may not apply to WASI programs, it would be nice to explore how many more of these tests can be enabled to increase wasi-libc's test coverage. This change should explain how to do that and, with directives, make it possible to condition how the tests compile and run.
1 parent 29c22a4 commit 2b853ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+529
-164
lines changed
 

‎.github/workflows/main.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,13 @@ jobs:
125125
export WASIP1_DIR=$(realpath $($CLANG_DIR/clang -print-resource-dir)/lib/wasip1/)
126126
export WASIP2_DIR=$(realpath $($CLANG_DIR/clang -print-resource-dir)/lib/wasip2/)
127127
mkdir -p $WASI_DIR $WASIP1_DIR $WASIP2_DIR
128-
cp download/libclang_rt.builtins-wasm32.a $WASI_DIR
129-
cp download/libclang_rt.builtins-wasm32.a $WASIP1_DIR
130-
cp download/libclang_rt.builtins-wasm32.a $WASIP2_DIR
128+
cp build/download/libclang_rt.builtins-wasm32.a $WASI_DIR
129+
cp build/download/libclang_rt.builtins-wasm32.a $WASIP1_DIR
130+
cp build/download/libclang_rt.builtins-wasm32.a $WASIP2_DIR
131131
TARGET_TRIPLE=wasm32-wasi make test
132-
rm -r build
133132
TARGET_TRIPLE=wasm32-wasip1 make test
134-
rm -r build
135133
TARGET_TRIPLE=wasm32-wasip2 make test
136-
rm -r build
137134
TARGET_TRIPLE=wasm32-wasi-threads make test
138-
rm -r build
139135
TARGET_TRIPLE=wasm32-wasip1-threads make test
140136
# The older version of Clang does not provide the expected symbol for the
141137
# test entrypoints: `undefined symbol: __main_argc_argv`.

‎test/.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
build
2-
download
32
run
4-
5-
smoke/*.dir

0 commit comments

Comments
 (0)
Please sign in to comment.