aboutsummaryrefslogtreecommitdiffstats
path: root/run_tests.sh
diff options
context:
space:
mode:
authorKonrad Scherer <Konrad.Scherer@windriver.com>2010-07-30 13:08:31 -0400
committerKonrad Scherer <Konrad.Scherer@windriver.com>2010-07-30 13:19:05 -0400
commit7c9033fc63bd40e9cf0562ad5322274c08d3b39f (patch)
tree9537370798b23a9ecd6aba445dd147918ce200f4 /run_tests.sh
parent51591a9413959ca2dda5966f5402d431adc3fb50 (diff)
downloadpseudo-7c9033fc63bd40e9cf0562ad5322274c08d3b39f.tar.gz
pseudo-7c9033fc63bd40e9cf0562ad5322274c08d3b39f.tar.bz2
pseudo-7c9033fc63bd40e9cf0562ad5322274c08d3b39f.zip
Add basic test harness to test pseudo
CQ: WIND00225366 A simple test harness that runs all the scripts in the test directory. Each test script is run inside pseudo and uses exit status to report back whether the test was successful. The script uses the build executables, not the installed ones and each test run starts with an empty database.
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-xrun_tests.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh
new file mode 100755
index 0000000..9915d3b
--- /dev/null
+++ b/run_tests.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+opt_verbose=
+
+usage()
+{
+ echo >&2 "usage:"
+ echo >&2 " run_tests [-v|--verbose]"
+ exit 1
+}
+
+for arg
+do
+ case $arg in
+ --) shift; break ;;
+ -v | --verbose)
+ opt_verbose=-v
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
+#The tests will be run on the build dir, not the installed versions
+#This requires to following be set properly.
+export PSEUDO_PREFIX=${PWD}
+export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
+
+num_tests=0
+num_passed_tests=0
+
+for file in test/test*.sh
+do
+ filename=${file#test/}
+ let num_tests++
+ mkdir -p var/pseudo
+ ./bin/pseudo $file ${opt_verbose}
+ if [ "$?" -eq "0" ]; then
+ let num_passed_tests++
+ if [ "${opt_verbose}" == "-v" ]; then
+ echo "${filename%.sh}: Passed."
+ fi
+ else
+ echo "${filename/%.sh}: Failed."
+ fi
+ rm -rf var
+done
+echo "${num_passed_tests}/${num_tests} test(s) passed."
+