Compare commits

...

3 Commits

Author SHA1 Message Date
David Mak f2cb171982 standalone: Add flags to control demo output options 2023-10-04 11:27:07 +08:00
David Mak d2a0c777fd standalone: Fix parsing NAC3 args in check_demo.sh 2023-10-04 11:26:56 +08:00
David Mak 9bcafdfeac standalone: Fix missing libraries when linking
Fixes `undefined reference to 'pow'` for pow.py using -O0.
2023-10-04 11:26:54 +08:00
3 changed files with 52 additions and 10 deletions

View File

@ -7,15 +7,19 @@ if [ -z "$1" ]; then
exit 1
fi
demo="${@:-1}"
set -- "${@:1:$(($# - 1))}"
declare -a nac3args
while [ $# -gt 1 ]; do
nac3args+=("$1")
shift
done
demo="$1"
echo -n "Checking $demo... "
./interpret_demo.py "$demo" > interpreted.log
./run_demo.sh "$@" "$demo" > run.log
./run_demo_lli.sh "$@" "$demo" > run_lli.log
./run_demo.sh --redirect-exe-stdout "${nac3args[@]}" "$demo"
./run_demo_lli.sh --redirect-exe-stdout "${nac3args[@]}" "$demo"
diff -Nau interpreted.log run.log
diff -Nau interpreted.log run_lli.log
echo "ok"
rm -f interpreted.log run.log run_lli.log
rm -f interpreted.log run.log run_lli.log

View File

@ -7,6 +7,19 @@ if [ -z "$1" ]; then
exit 1
fi
declare -a nac3args
while [ $# -ge 1 ]; do
case "$1" in
--redirect-exe-stdout)
redirect_exe_stdout=1
;;
*)
nac3args+=("$1")
;;
esac
shift
done
if [ -e ../../target/release/nac3standalone ]; then
nac3standalone=../../target/release/nac3standalone
else
@ -16,7 +29,13 @@ fi
rm -f "*.o" demo
$nac3standalone "$@"
$nac3standalone "${nac3args[@]}"
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c
clang -o demo module.o demo.o
./demo
clang -lm -o demo module.o demo.o
if [ -z "$redirect_exe_stdout" ]; then
./demo
else
./demo > run.log
fi

View File

@ -7,6 +7,19 @@ if [ -z "$1" ]; then
exit 1
fi
declare -a nac3args
while [ $# -ge 1 ]; do
case "$1" in
--redirect-exe-stdout)
redirect_exe_stdout=1
;;
*)
nac3args+=("$1")
;;
esac
shift
done
if [ -e ../../target/release/nac3standalone ]; then
nac3standalone=../../target/release/nac3standalone
else
@ -16,6 +29,12 @@ fi
rm -f "*.o" "*.bc" demo
$nac3standalone --emit-llvm "$@"
$nac3standalone --emit-llvm "${nac3args[@]}"
clang -c -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c
lli --extra-module demo.bc --extra-module irrt.bc main.bc
if [ -z "$redirect_exe_stdout" ]; then
lli --extra-module demo.bc --extra-module irrt.bc main.bc
else
lli --extra-module demo.bc --extra-module irrt.bc main.bc > run_lli.log
fi