summaryrefslogtreecommitdiff
path: root/src/aif-test.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-07-21 18:51:33 +0200
committerDieter Plaetinck <dieter@plaetinck.be>2009-07-21 18:51:33 +0200
commit59d9b7dfd24e53c205cff5a75057e218e781fd1a (patch)
treef80369d205401093804580e3f5f90f4a87909b10 /src/aif-test.sh
parentf711f60ecc63dddc8fb1d62fdb4dcfa3a08fa2e2 (diff)
experimental test suite, with one test
Diffstat (limited to 'src/aif-test.sh')
-rwxr-xr-xsrc/aif-test.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/aif-test.sh b/src/aif-test.sh
new file mode 100755
index 0000000..4d2110e
--- /dev/null
+++ b/src/aif-test.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+echo "Aif-test: a 'unit-testing' tool for AIF"
+echo " for a list of available tests: find /usr/share/aif/tests/"
+[ "$1" != runtime] && echo "\$1: type of test to execute (runtime. no support for buildtime yet)" >&2 && exit 1
+[ -z "$2" ] && echo "\$2: name of test to execute" >&2 && exit 1
+
+test_dir="/usr/share/aif/tests/$1/$2"
+[ ! -d "$test_dir" ] && echo "No such test found: $test_dir" >&2 && exit 2
+
+echo "Running test $test_dir. THIS WILL PROBABLY ERASE DATA ON ONE OR MORE OF YOUR HARD DISKS. TO ABORT PRESS CTRL-C WITHIN 10 SECONDS"
+sleep 10
+
+# this script should install the system
+$test_dir/install.sh || fail=1
+
+# this script does any additional things such as touching files that we should recognize later
+$test_dir/setup_test.sh || fail=1
+
+# this script will do the actual testing (network check, recognize filesystems and files, ..)
+cp $test_dir/perform_test.sh /mnt/etc/rc.d/perform_test || fail=1
+
+# make sure the test will run on the target system
+sed -i's#DAEMONS=(\(.*\))#DAEMONS=(\1 perform_test)#' /mnt/etc/rc.conf || fail=1
+
+[ "$fail" == '1' ] && echo "Something failed. will not reboot" >&2 && exit 3
+
+reboot