Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-07-05 16:04:33 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-07-05 16:04:33 -0400
commit0453d78329f1c9aff7e97697db8a7b5702aef0dc (patch)
tree13b2ba8b3f077b88916bfffdc2a9a732709a5ae2 /build-aux/progtest-runner
parent9889838c5eba230af953b9677120dff6da2cd0e1 (diff)
downloadtame-0453d78329f1c9aff7e97697db8a7b5702aef0dc.tar.gz
tame-0453d78329f1c9aff7e97697db8a7b5702aef0dc.tar.bz2
tame-0453d78329f1c9aff7e97697db8a7b5702aef0dc.zip
build-aux: Liberate remaining build scripts
These were forgotten during the initial liberation. * build-aux/Makefile.2.in: New file. * build-aux/Makefile.am: New file. * build-aux/m4/calcdsl.m4: New file. * build-aux/progtest-runner: New file. * build-aux/suppmk-gen: New file.
Diffstat (limited to 'build-aux/progtest-runner')
-rwxr-xr-xbuild-aux/progtest-runner54
1 files changed, 54 insertions, 0 deletions
diff --git a/build-aux/progtest-runner b/build-aux/progtest-runner
new file mode 100755
index 0000000..306cddc
--- /dev/null
+++ b/build-aux/progtest-runner
@@ -0,0 +1,54 @@
+#!/bin/bash
+# Run test cases for supplier
+#
+# Copyright (C) 2018 R-T Specialty, LLC.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+declare path_suppliers="${1?Missing supplier path}"
+declare path_tests="${2?Missing supplier test path}"
+
+declare -i result=0
+
+declare suppliers
+
+# if a file was provided, use it as the sole supplier; otherwise,
+# treat it as a directory of suppliers
+if [ -f "$path_suppliers" ]; then
+ suppliers=( "$path_suppliers" )
+ path_suppliers=$( dirname "$path_suppliers" )
+else
+ suppliers=( "$path_suppliers"/*.xml )
+fi
+
+# run tests for each supplier individually
+for supplier in "${suppliers[@]}"; do
+ base=$( basename "$supplier" .xml )
+ tests=$( find -L "$path_tests"/"$base"/ -name '*.yml' )
+
+ echo
+ echo "$path_suppliers/$base"
+ sed 's/./=/g' <<< "$path_suppliers/$base"
+
+ test -n "$tests" || {
+ echo "error: missing test cases for $base!" >&2
+ exit 1
+ }
+
+ rater/tame/progtest/bin/runner "$path_suppliers/$base.js" $tests \
+ || result=1
+done
+
+exit $result