diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4303d08..b167beb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,15 +42,6 @@ jobs: uses: bytecodealliance/actions/wasmtime/setup@v1 with: version: "18.0.2" - - name: Setup `wasm-tools` for tests - uses: bytecodealliance/actions/wasm-tools/setup@v1 - with: - version: "1.201.0" - - name: Download command adapter for tests - run: curl -f -L --retry 5 -o ${{ runner.temp }}/wasi_snapshot_preview1.command.wasm https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.2/wasi_snapshot_preview1.command.wasm - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # We can't use `--depth 1` here sadly because the GNU config # submodule is not pinned to a particular tag/branch. Please # bump depth (or even better, the submodule), in case of "error: @@ -67,7 +58,7 @@ jobs: run: NINJA_FLAGS=-v make package LLVM_CMAKE_FLAGS=-DLLVM_CCACHE_BUILD=ON shell: bash - name: Run the testsuite - run: NINJA_FLAGS=-v make check RUNTIME=wasmtime ADAPTER=${{ runner.temp }}/wasi_snapshot_preview1.command.wasm WASM_TOOLS=wasm-tools + run: NINJA_FLAGS=-v make check RUNTIME=wasmtime - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/Makefile b/Makefile index 9c7acff..e980abc 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ default: build @echo "Use -fdebug-prefix-map=$(ROOT_DIR)=wasisdk://v$(VERSION)" check: - TARGETS="$(TARGETS)" tests/run.sh "$(BUILD_PREFIX)" "$(RUNTIME)" "$(ADAPTER)" "$(WASM_TOOLS)" + TARGETS="$(TARGETS)" tests/run.sh "$(BUILD_PREFIX)" "$(RUNTIME)" clean: rm -rf build $(DESTDIR) @@ -122,6 +122,11 @@ build/llvm.BUILT: llvm-config touch build/llvm.BUILT +build/wasm-component-ld.BUILT: build/llvm.BUILT + cargo install wasm-component-ld@0.1.5 --root $(BUILD_PREFIX) + touch build/wasm-component-ld.BUILT + + # Flags for running `make` in wasi-libc # $(1): the target that's being built WASI_LIBC_MAKEFLAGS = \ @@ -132,7 +137,7 @@ WASI_LIBC_MAKEFLAGS = \ SYSROOT=$(BUILD_PREFIX)/share/wasi-sysroot \ TARGET_TRIPLE=$(1) -build/wasi-libc.BUILT: build/compiler-rt.BUILT +build/wasi-libc.BUILT: build/compiler-rt.BUILT build/wasm-component-ld.BUILT $(MAKE) $(call WASI_LIBC_MAKEFLAGS,wasm32-wasi) default libc_so $(MAKE) $(call WASI_LIBC_MAKEFLAGS,wasm32-wasip1) default libc_so $(MAKE) $(call WASI_LIBC_MAKEFLAGS,wasm32-wasip2) WASI_SNAPSHOT=p2 default libc_so diff --git a/src/llvm-project b/src/llvm-project index 461274b..26a1d66 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 461274b81d8641eab64d494accddc81d7db8a09e +Subproject commit 26a1d6601d727a96f4301d0d8647b5a42760ae0c diff --git a/tests/general/abort.c.stderr.expected b/tests/general/abort.c.stderr.expected index c6ecf6a..94e6cd1 100644 --- a/tests/general/abort.c.stderr.expected +++ b/tests/general/abort.c.stderr.expected @@ -1,6 +1,6 @@ Error: failed to run main module `abort.c.---.wasm` Caused by: - 0: failed to invoke command default + 0: failed to invoke 1: error while executing at wasm backtrace: 2: wasm trap: wasm `unreachable` instruction executed diff --git a/tests/general/abort.c.stderr.expected.filter b/tests/general/abort.c.stderr.expected.filter index 742503a..272cd59 100755 --- a/tests/general/abort.c.stderr.expected.filter +++ b/tests/general/abort.c.stderr.expected.filter @@ -3,4 +3,5 @@ set -euo pipefail cat \ | sed -e 's/main module `abort\.c\.[^`]*\.wasm`/main module `abort.c.---.wasm`/' \ + | sed -e 's/failed to invoke.*/failed to invoke/' \ | sed -E '/0x[[:xdigit:]]+/d' diff --git a/tests/general/assert-fail.c.stderr.expected b/tests/general/assert-fail.c.stderr.expected index c179f09..1579f8c 100644 --- a/tests/general/assert-fail.c.stderr.expected +++ b/tests/general/assert-fail.c.stderr.expected @@ -2,6 +2,6 @@ Assertion failed: false (assert-fail.c: main: 5) Error: failed to run main module `assert-fail.c.---.wasm` Caused by: - 0: failed to invoke command default + 0: failed to invoke 1: error while executing at wasm backtrace: 2: wasm trap: wasm `unreachable` instruction executed diff --git a/tests/general/assert-fail.c.stderr.expected.filter b/tests/general/assert-fail.c.stderr.expected.filter index d2213dd..f9ffe84 100755 --- a/tests/general/assert-fail.c.stderr.expected.filter +++ b/tests/general/assert-fail.c.stderr.expected.filter @@ -3,4 +3,5 @@ set -euo pipefail cat \ | sed -e 's/main module `assert-fail\.c\.[^`]*\.wasm`/main module `assert-fail.c.---.wasm`/' \ + | sed -e 's/failed to invoke.*/failed to invoke/' \ | sed -E '/0x[[:xdigit:]]+/d' diff --git a/tests/general/sigabrt.c.stderr.expected b/tests/general/sigabrt.c.stderr.expected index 72c425d..605ac5d 100644 --- a/tests/general/sigabrt.c.stderr.expected +++ b/tests/general/sigabrt.c.stderr.expected @@ -3,4 +3,4 @@ Program received fatal signal: Aborted Error: failed to run main module `sigabrt.c.---.wasm` Caused by: - 0: failed to invoke command default + 0: failed to invoke diff --git a/tests/general/sigabrt.c.stderr.expected.filter b/tests/general/sigabrt.c.stderr.expected.filter index 425b060..0f3d78f 100755 --- a/tests/general/sigabrt.c.stderr.expected.filter +++ b/tests/general/sigabrt.c.stderr.expected.filter @@ -3,5 +3,6 @@ set -euo pipefail cat \ | sed -e 's/main module `sigabrt\.c\.[^`]*\.wasm`/main module `sigabrt.c.---.wasm`/' \ + | sed -e 's/failed to invoke.*/failed to invoke/' \ | sed -e 's/source location: @[[:xdigit:]]*$/source location: @----/' \ | head -n 6 diff --git a/tests/run.sh b/tests/run.sh index 080eeae..bc8dd4d 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -17,17 +17,8 @@ wasi_sdk="$1" # Determine the wasm runtime to use, if one is provided. if [ $# -gt 1 ]; then runwasi="$2" - if [ $# -gt 3 ]; then - adapter="$3" - wasm_tools="$4" - else - adapter="" - wasm_tools="" - fi else runwasi="" - adapter="" - wasm_tools="" fi testdir=$(dirname $0) @@ -45,13 +36,13 @@ for target in $TARGETS; do echo "===== Testing compile-only with $options =====" for file in *.c; do echo "Testing compile-only $file..." - ../testcase.sh "$target" "" "" "" "$wasi_sdk/bin/clang" "$options --target=$target" "$file" - ../testcase.sh "$target" "" "" "" "$wasi_sdk/bin/$target-clang" "$options" "$file" + ../testcase.sh "$target" "" "$wasi_sdk/bin/clang" "$options --target=$target" "$file" + ../testcase.sh "$target" "" "$wasi_sdk/bin/$target-clang" "$options" "$file" done for file in *.cc; do echo "Testing compile-only $file..." - ../testcase.sh "$target" "" "" "" "$wasi_sdk/bin/clang++" "$options --target=$target -fno-exceptions" "$file" - ../testcase.sh "$target" "" "" "" "$wasi_sdk/bin/$target-clang++" "$options -fno-exceptions" "$file" + ../testcase.sh "$target" "" "$wasi_sdk/bin/clang++" "$options --target=$target -fno-exceptions" "$file" + ../testcase.sh "$target" "" "$wasi_sdk/bin/$target-clang++" "$options -fno-exceptions" "$file" done done cd - >/dev/null @@ -61,13 +52,13 @@ for target in $TARGETS; do echo "===== Testing with $options =====" for file in *.c; do echo "Testing $file..." - ../testcase.sh "$target" "$runwasi" "$adapter" "$wasm_tools" "$wasi_sdk/bin/clang" "$options --target=$target" "$file" - ../testcase.sh "$target" "$runwasi" "$adapter" "$wasm_tools" "$wasi_sdk/bin/$target-clang" "$options" "$file" + ../testcase.sh "$target" "$runwasi" "$wasi_sdk/bin/clang" "$options --target=$target" "$file" + ../testcase.sh "$target" "$runwasi" "$wasi_sdk/bin/$target-clang" "$options" "$file" done for file in *.cc; do echo "Testing $file..." - ../testcase.sh "$target" "$runwasi" "$adapter" "$wasm_tools" "$wasi_sdk/bin/clang++" "$options --target=$target -fno-exceptions" "$file" - ../testcase.sh "$target" "$runwasi" "$adapter" "$wasm_tools" "$wasi_sdk/bin/$target-clang++" "$options -fno-exceptions" "$file" + ../testcase.sh "$target" "$runwasi" "$wasi_sdk/bin/clang++" "$options --target=$target -fno-exceptions" "$file" + ../testcase.sh "$target" "$runwasi" "$wasi_sdk/bin/$target-clang++" "$options -fno-exceptions" "$file" done done cd - >/dev/null diff --git a/tests/testcase.sh b/tests/testcase.sh index 61c6612..3d88604 100755 --- a/tests/testcase.sh +++ b/tests/testcase.sh @@ -8,18 +8,15 @@ set -ueo pipefail # script, so don't do anything fancy. target="$1" runwasi="$2" -adapter="$3" -wasm_tools="$4" -compiler="$5" -options="$6" -input="$7" +compiler="$3" +options="$4" +input="$5" # Compile names for generated files. wasm="$input.$options.wasm" stdout_observed="$input.$options.stdout.observed" stderr_observed="$input.$options.stderr.observed" exit_status_observed="$input.$options.exit_status.observed" -run_args="" # Optionally load compiler options from a file. if [ -e "$input.options" ]; then @@ -44,11 +41,6 @@ if [ "$runwasi" == "" ]; then exit 0 fi -if [ "$target" == "wasm32-wasip2" -a -n "$adapter" -a -n "$wasm_tools" ]; then - "$wasm_tools" component new --adapt "$adapter" "$wasm" -o "$wasm" - run_args="--wasm component-model" -fi - # Determine the input file to write to stdin. if [ -e "$input.stdin" ]; then stdin="$input.stdin" @@ -74,7 +66,7 @@ fi # Run the test, capturing stdout, stderr, and the exit status. exit_status=0 -"$runwasi" $run_args $env $dir "$wasm" $dirarg \ +"$runwasi" $env $dir "$wasm" $dirarg \ < "$stdin" \ > "$stdout_observed" \ 2> "$stderr_observed" \