Skip to content

Commit

Permalink
wasip1 target
Browse files Browse the repository at this point in the history
  • Loading branch information
petersalomonsen committed Oct 5, 2024
1 parent 667ac4a commit 01b0d73
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
#!/bin/bash
RUSTFLAGS='-C link-args=--initial-memory=67108864' cargo wasi test -- --show-output --nocapture

rm target/wasm32-wasip1/debug/deps/quickjs_rust_near-*.wasm
# Compile the test without running it
echo "Compiling tests for wasm32-wasip1 target..."
RUSTFLAGS='-C link-args=--initial-memory=67108864' cargo test --target=wasm32-wasip1 --no-run

# Check if the compilation was successful
if [ $? -ne 0 ]; then
echo "Compilation failed. Exiting."
exit 1
fi

# Locate the test file in the target/wasm32-wasip1/debug/deps directory
echo "Locating test file..."
TEST_FILE=$(find target/wasm32-wasip1/debug/deps -name "quickjs_rust_near-*.wasm" -print -quit)

# Check if the test file was found
if [ -z "$TEST_FILE" ]; then
echo "No test file found. Exiting."
exit 1
fi

echo "Found test file: $TEST_FILE"

# Run the test file using wasmtime
echo "Running tests with wasmtime..."
wasmtime "$TEST_FILE"

# Check if the tests ran successfully
if [ $? -eq 0 ]; then
echo "Tests ran successfully!"
else
echo "Tests failed."
exit 1
fi

0 comments on commit 01b0d73

Please sign in to comment.