forked from M-Labs/nac3
standalone: Add flags to control demo output options
This commit is contained in:
parent
e8a5f0dfef
commit
f34c6053d6
|
@ -16,8 +16,8 @@ demo="$1"
|
|||
|
||||
echo -n "Checking $demo... "
|
||||
./interpret_demo.py "$demo" > interpreted.log
|
||||
./run_demo.sh "${nac3args[@]}" "$demo" > run.log
|
||||
./run_demo_lli.sh "${nac3args[@]}" "$demo" > run_lli.log
|
||||
./run_demo.sh --out run.log "${nac3args[@]}" "$demo"
|
||||
./run_demo.sh --lli --out run_lli.log "${nac3args[@]}" "$demo"
|
||||
diff -Nau interpreted.log run.log
|
||||
diff -Nau interpreted.log run_lli.log
|
||||
echo "ok"
|
||||
|
|
|
@ -7,6 +7,23 @@ if [ -z "$1" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
declare -a nac3args
|
||||
while [ $# -ge 1 ]; do
|
||||
case "$1" in
|
||||
--out)
|
||||
shift
|
||||
outfile="$1"
|
||||
;;
|
||||
--lli)
|
||||
use_lli=1
|
||||
;;
|
||||
*)
|
||||
nac3args+=("$1")
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -e ../../target/release/nac3standalone ]; then
|
||||
nac3standalone=../../target/release/nac3standalone
|
||||
else
|
||||
|
@ -14,9 +31,29 @@ else
|
|||
nac3standalone=../../target/x86_64-unknown-linux-gnu/release/nac3standalone
|
||||
fi
|
||||
|
||||
if [ -z "$use_lli" ]; then
|
||||
rm -f "*.o" demo
|
||||
|
||||
$nac3standalone "$@"
|
||||
$nac3standalone "${nac3args[@]}"
|
||||
|
||||
clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c
|
||||
clang -lm -o demo module.o demo.o
|
||||
|
||||
if [ -z "$outfile" ]; then
|
||||
./demo
|
||||
else
|
||||
./demo > "$outfile"
|
||||
fi
|
||||
else
|
||||
rm -f "*.o" "*.bc" demo
|
||||
|
||||
$nac3standalone --emit-llvm "${nac3args[@]}"
|
||||
|
||||
clang -c -std=gnu11 -Wall -Wextra -O3 -emit-llvm -o demo.bc demo.c
|
||||
|
||||
if [ -z "$outfile" ]; then
|
||||
lli --extra-module demo.bc --extra-module irrt.bc main.bc
|
||||
else
|
||||
lli --extra-module demo.bc --extra-module irrt.bc main.bc > "$outfile"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "No argument supplied"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e ../../target/release/nac3standalone ]; then
|
||||
nac3standalone=../../target/release/nac3standalone
|
||||
else
|
||||
# used by Nix builds
|
||||
nac3standalone=../../target/x86_64-unknown-linux-gnu/release/nac3standalone
|
||||
fi
|
||||
|
||||
rm -f "*.o" "*.bc" demo
|
||||
|
||||
$nac3standalone --emit-llvm "$@"
|
||||
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
|
Loading…
Reference in New Issue