standalone: Add flags to control demo output options

This commit is contained in:
David Mak 2023-10-03 11:54:34 +08:00
parent 6b3a75c3bd
commit 32f875f765
3 changed files with 58 additions and 6 deletions

View File

@ -12,8 +12,8 @@ set -- "${@:1:$(($# - 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 --suppress-nac3-warnings "$@" "$demo"
./run_demo_lli.sh --redirect-exe-stdout --suppress-nac3-warnings "$@" "$demo"
diff -Nau interpreted.log run.log
diff -Nau interpreted.log run_lli.log
echo "ok"

View File

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

View File

@ -7,6 +7,22 @@ if [ -z "$1" ]; then
exit 1
fi
declare -a nac3args
while [ $# -ge 1 ]; do
case "$1" in
--redirect-exe-stdout)
redirect_exe_stdout=1
;;
--suppress-nac3-warnings)
suppress_nac3_warnings=1
;;
*)
nac3args+=("$1")
;;
esac
shift
done
if [ -e ../../target/release/nac3standalone ]; then
nac3standalone=../../target/release/nac3standalone
else
@ -16,6 +32,16 @@ fi
rm -f "*.o" "*.bc" demo
$nac3standalone --emit-llvm "$@"
if [ -z "$suppress_nac3_warnings" ]; then
$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
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