This commit is contained in:
nora 2023-09-30 18:54:43 +02:00
parent ae189e8b18
commit 043c960708
15 changed files with 206 additions and 23 deletions

View file

@ -1,5 +1,34 @@
#!/usr/bin/env bash
cargo build
./uwuc-gcc hello.c -o target/hello
./target/hello
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cargo build --manifest-path "$SCRIPT_DIR/Cargo.toml"
test_dir=$(mktemp -d)
clean() {
rm -r "${test_dir}"
}
for test in tests/c/*; do
name=$(basename $test .c)
"$SCRIPT_DIR/uwuc-gcc" "$test" -o "$test_dir/$name"
if [ "$?" -ne "0" ]; then
echo "error: failed to compile test $test"
clean
exit 1
fi
OUTPUT=$("$test_dir/$name")
code="$?"
if [ "$code" -ne "0" ]; then
echo "error: test failed with code $code: $test, running $test_dir/$name"
echo "------ output:"
echo "$OUTPUT"
echo "-----"
fi
done
clean