summaryrefslogtreecommitdiffstats
path: root/contrib/libucl/tests/run_tests.sh
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-03-11 13:06:09 +0000
committerbapt <bapt@FreeBSD.org>2014-03-11 13:06:09 +0000
commitf5e5e1abc374123d2b581f2b35426177552eeb6a (patch)
treeb257b9b6742cb9db068c00d02be3cc1a2b786480 /contrib/libucl/tests/run_tests.sh
parenta8ce2796e7e1065757e29a768cc1ecf19436be4a (diff)
downloadFreeBSD-src-f5e5e1abc374123d2b581f2b35426177552eeb6a.zip
FreeBSD-src-f5e5e1abc374123d2b581f2b35426177552eeb6a.tar.gz
MFC: r262398,r262399,r262410,r262975
Import libucl into head UCL is heavily infused by nginx configuration as the example of a convenient configuration system. However, UCL is fully compatible with JSON format and is able to parse json files. UCL is used by pkg(8) for its configuration file as well for the manifest format in packages, it will be used in base for the pkg boostrap (signature checking and configuration file parsing.) libucl has been developped and is maintained by vsevolod@
Diffstat (limited to 'contrib/libucl/tests/run_tests.sh')
-rwxr-xr-xcontrib/libucl/tests/run_tests.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/contrib/libucl/tests/run_tests.sh b/contrib/libucl/tests/run_tests.sh
new file mode 100755
index 0000000..6c7751e
--- /dev/null
+++ b/contrib/libucl/tests/run_tests.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+if [ $# -lt 1 ] ; then
+ echo 'Specify binary to run as the first argument'
+ exit 1
+fi
+
+
+for _tin in ${TEST_DIR}/*.in ; do
+ _t=`echo $_tin | sed -e 's/.in$//'`
+ $1 $_t.in $_t.out
+ if [ $? -ne 0 ] ; then
+ echo "Test: $_t failed, output:"
+ cat $_t.out
+ rm $_t.out
+ exit 1
+ fi
+ if [ -f $_t.res ] ; then
+ diff -s $_t.out $_t.res -u 2>/dev/null
+ if [ $? -ne 0 ] ; then
+ rm $_t.out
+ echo "Test: $_t output missmatch"
+ exit 1
+ fi
+ fi
+ rm $_t.out
+done
+
+if [ $# -gt 2 ] ; then
+ $3 ${TEST_DIR}/generate.out
+ diff -s ${TEST_DIR}/generate.out ${TEST_DIR}/generate.res -u 2>/dev/null
+ if [ $? -ne 0 ] ; then
+ rm ${TEST_DIR}/generate.out
+ echo "Test: generate.res output missmatch"
+ exit 1
+ fi
+ rm ${TEST_DIR}/generate.out
+fi
+
+sh -c "xz -c < /dev/null > /dev/null"
+if [ $? -eq 0 -a $# -gt 1 ] ; then
+ echo 'Running speed tests'
+ for _tin in ${TEST_DIR}/*.xz ; do
+ echo "Unpacking $_tin..."
+ xz -cd < $_tin > ${TEST_DIR}/test_file
+ # Preread file to cheat benchmark!
+ cat ${TEST_DIR}/test_file > /dev/null
+ echo "Starting benchmarking for $_tin..."
+ $2 ${TEST_DIR}/test_file
+ if [ $? -ne 0 ] ; then
+ echo "Test: $_tin failed"
+ rm ${TEST_DIR}/test_file
+ exit 1
+ fi
+ rm ${TEST_DIR}/test_file
+ done
+fi
+
OpenPOWER on IntegriCloud