-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun_test.sh
More file actions
executable file
·40 lines (33 loc) · 1.11 KB
/
Copy pathrun_test.sh
File metadata and controls
executable file
·40 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/sh
# Run from the "tests" folder and pass the instance name as an argument
test="wit_components/$1"
# Build the guest
sh skeletons/wit_components/build_guest.sh "$1"
if [ $? -ne 0 ]; then
exit 1
fi
# copy the "wit_components" skeleton
cp -r skeletons/wit_components/host_sys instance
cp -r skeletons/wit_components/host_js instance
# copy the host code
cp $test/host.rs instance/host_sys/src/host.rs
cp $test/host.rs instance/host_js/src/host.rs
# expand the code
cd instance/host_sys && cargo expand --lib --tests > expanded.rs && cd ../..
cd instance/host_js && cargo expand --tests --target wasm32-unknown-unknown > expanded.rs && cd ../..
# run the sys host test
cd instance/host_sys && cargo test --lib -- --nocapture && cd ../..
if [ $? -ne 0 ]; then
echo
echo "Oh no, there is an error in the $test sys host."
echo "Inspect the instance folder for more detail."
exit 1
fi
# run the js host test
cd instance/host_js && wasm-pack test --node && cd ../..
if [ $? -ne 0 ]; then
echo
echo "Oh no, there is an error in the $test js host."
echo "Inspect the instance folder for more detail."
exit 1
fi