2023-09-29 15:17:45 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2024-08-05 19:04:25 +08:00
|
|
|
echo "No argument supplied"
|
|
|
|
exit 1
|
2023-09-29 15:17:45 +08:00
|
|
|
fi
|
|
|
|
|
2023-10-04 11:18:49 +08:00
|
|
|
declare -a nac3args
|
2024-08-09 12:26:59 +08:00
|
|
|
while [ $# -gt 1 ]; do
|
2024-08-05 19:04:25 +08:00
|
|
|
case "$1" in
|
|
|
|
--help)
|
2024-08-09 12:26:59 +08:00
|
|
|
echo "Usage: check_demo.sh [--debug] [-i686] -- [NAC3ARGS...] demo"
|
2024-08-05 19:04:25 +08:00
|
|
|
exit
|
|
|
|
;;
|
2024-08-09 12:26:59 +08:00
|
|
|
--debug)
|
|
|
|
debug=1
|
|
|
|
;;
|
2024-08-05 19:04:25 +08:00
|
|
|
-i686)
|
|
|
|
i686=1
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
2024-08-09 12:26:59 +08:00
|
|
|
echo "Unrecognized argument \"$1\""
|
|
|
|
exit 1
|
2024-08-05 19:04:25 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2023-10-04 11:18:49 +08:00
|
|
|
while [ $# -gt 1 ]; do
|
|
|
|
nac3args+=("$1")
|
|
|
|
shift
|
|
|
|
done
|
2024-08-09 12:26:59 +08:00
|
|
|
demo="$1"
|
2024-08-05 19:04:25 +08:00
|
|
|
|
2023-09-29 15:17:45 +08:00
|
|
|
|
2024-07-26 10:42:40 +08:00
|
|
|
echo "### Checking $demo..."
|
|
|
|
|
|
|
|
echo ">>>>>> Running $demo with the Python interpreter"
|
2023-09-29 15:17:45 +08:00
|
|
|
./interpret_demo.py "$demo" > interpreted.log
|
2023-09-29 16:43:48 +08:00
|
|
|
|
2024-08-05 19:04:25 +08:00
|
|
|
if [ -n "$i686" ]; then
|
|
|
|
echo "...... Trying NAC3's 32-bit code generator output"
|
2024-08-09 12:26:59 +08:00
|
|
|
if [ -n "$debug" ]; then
|
|
|
|
./run_demo.sh --debug -i686 --out run_32.log -- "${nac3args[@]}" "$demo"
|
|
|
|
else
|
|
|
|
./run_demo.sh -i686 --out run_32.log -- "${nac3args[@]}" "$demo"
|
|
|
|
fi
|
2024-08-05 19:04:25 +08:00
|
|
|
diff -Nau interpreted.log run_32.log
|
|
|
|
fi
|
2024-07-26 10:42:40 +08:00
|
|
|
|
|
|
|
echo "...... Trying NAC3's 64-bit code generator output"
|
2024-08-09 12:26:59 +08:00
|
|
|
if [ -n "$debug" ]; then
|
|
|
|
./run_demo.sh --debug --out run_64.log -- "${nac3args[@]}" "$demo"
|
|
|
|
else
|
|
|
|
./run_demo.sh --out run_64.log -- "${nac3args[@]}" "$demo"
|
|
|
|
fi
|
2024-07-26 10:42:40 +08:00
|
|
|
diff -Nau interpreted.log run_64.log
|
|
|
|
|
|
|
|
echo "...... OK"
|
|
|
|
|
|
|
|
rm -f interpreted.log \
|
2024-08-05 19:04:25 +08:00
|
|
|
run_32.log run_64.log
|