From b6afd1bfdaff1a5345405d1627b31202d8be90a5 Mon Sep 17 00:00:00 2001 From: David Mak Date: Fri, 29 Sep 2023 15:17:45 +0800 Subject: [PATCH] standalone: Split check_demos into check_demo Allows individual tests to be executed. --- nac3standalone/demo/check_demo.sh | 17 +++++++++++++++++ nac3standalone/demo/check_demos.sh | 8 ++------ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100755 nac3standalone/demo/check_demo.sh diff --git a/nac3standalone/demo/check_demo.sh b/nac3standalone/demo/check_demo.sh new file mode 100755 index 00000000..5ea8e182 --- /dev/null +++ b/nac3standalone/demo/check_demo.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +if [ -z "$1" ]; then + echo "Requires at least one argument" + exit 1 +fi + +demo="${@:-1}" +set -- "${@:1:$(($# - 1))}" + +echo -n "Checking $demo... " +./interpret_demo.py "$demo" > interpreted.log +./run_demo.sh "$@" "$demo" > run.log +diff -Nau interpreted.log run.log +echo "ok" diff --git a/nac3standalone/demo/check_demos.sh b/nac3standalone/demo/check_demos.sh index d7fa8b16..ae21142b 100755 --- a/nac3standalone/demo/check_demos.sh +++ b/nac3standalone/demo/check_demos.sh @@ -4,12 +4,8 @@ set -e count=0 for demo in src/*.py; do - echo -n "checking $demo... " - ./interpret_demo.py $demo > interpreted.log - ./run_demo.sh "$@" $demo > run.log - diff -Nau interpreted.log run.log - echo "ok" - let "count+=1" + ./check_demo.sh "$@" "$demo" + ((count += 1)) done echo "Ran $count demo checks - PASSED"