Skip to content

Commit 757c262

Browse files
committed
Add a way to run the testsuite in compile-only mode.
1 parent a73a2b3 commit 757c262

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

tests/run.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
#!/bin/bash
22
set -ueo pipefail
33

4-
# Top-level test runner. Usage is "run.sh <runwasi>" where <runwasi> is a
5-
# WASI-capable runtime.
4+
# Top-level test runner. Usage is "run.sh" to run tests in compile-only mode,
5+
# or "run.sh <runwasi>" where <runwasi> is a WASI-capable runtime to run the
6+
# tests in full compile and execute mode.
67

7-
runwasi="$1"
8+
# Determine the wasm runtime to use, if one is provided.
9+
if [ $# -gt 0 ]; then
10+
runwasi="$1"
11+
else
12+
runwasi=""
13+
fi
814

915
cd compile-only
1016
for options in -O0 -O2 "-O2 -flto"; do
1117
echo "===== Testing compile-only with $options ====="
1218
for file in *.c; do
1319
echo "Testing compile-only $file..."
14-
../testcase.sh true clang "$options" "$file"
20+
../testcase.sh "" clang "$options" "$file"
1521
done
1622
for file in *.cc; do
1723
echo "Testing compile-only $file..."
18-
../testcase.sh true clang++ "$options" "$file"
24+
../testcase.sh "" clang++ "$options" "$file"
1925
done
2026
done
2127
cd - >/dev/null

tests/testcase.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ fi
2626

2727
echo "Testing $input..."
2828

29-
# Determine the input file to write to stdin.
29+
# Compile the testcase.
3030
"$clang" $options $file_options "$input" -o "$wasm"
31+
32+
# If we don't have a runwasi command, we're just doing compile-only testing.
33+
if [ "$runwasi" == "" ]; then
34+
exit 0
35+
fi
36+
37+
# Determine the input file to write to stdin.
3138
if [ -e "$input.stdin" ]; then
3239
stdin="$input.stdin"
3340
else

0 commit comments

Comments
 (0)