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 13 additions and 25 deletions

View File

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

View File

@ -13,9 +13,6 @@ while [ $# -ge 1 ]; do
--redirect-exe-stdout) --redirect-exe-stdout)
redirect_exe_stdout=1 redirect_exe_stdout=1
;; ;;
--suppress-nac3-warnings)
suppress_nac3_warnings=1
;;
*) *)
nac3args+=("$1") nac3args+=("$1")
;; ;;
@ -32,14 +29,10 @@ fi
rm -f "*.o" demo rm -f "*.o" demo
if [ -z "$suppress_nac3_warnings" ]; then $nac3standalone "${nac3args[@]}"
$nac3standalone "${nac3args[@]}"
else
$nac3standalone "${nac3args[@]}" >/dev/null
fi
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c
clang -o demo module.o demo.o clang -lm -o demo module.o demo.o
if [ -z "$redirect_exe_stdout" ]; then if [ -z "$redirect_exe_stdout" ]; then
./demo ./demo

View File

@ -13,9 +13,6 @@ while [ $# -ge 1 ]; do
--redirect-exe-stdout) --redirect-exe-stdout)
redirect_exe_stdout=1 redirect_exe_stdout=1
;; ;;
--suppress-nac3-warnings)
suppress_nac3_warnings=1
;;
*) *)
nac3args+=("$1") nac3args+=("$1")
;; ;;
@ -32,11 +29,7 @@ fi
rm -f "*.o" "*.bc" demo rm -f "*.o" "*.bc" demo
if [ -z "$suppress_nac3_warnings" ]; then $nac3standalone --emit-llvm "${nac3args[@]}"
$nac3standalone --emit-llvm "${nac3args[@]}"
else
$nac3standalone --emit-llvm "${nac3args[@]}" >/dev/null
fi
clang -c -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c clang -c -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c