aboutsummaryrefslogtreecommitdiffstats
path: root/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test.sh')
-rw-r--r--test.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100644
index 0000000..f59412c
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+TMPDIR=${TMPDIR:-/tmp}
+MOCK_ROOT=$TMPDIR/bosun-test
+
+TESTDIR=$PWD/test
+BOSUN_CMD=$PWD/bosun
+
+run_test() {
+ TARGET_DIR=$MOCK_ROOT/$1/mock
+ BOSUN_DIR=$TARGET_DIR/stow
+
+ rm -rf "$TARGET_DIR"
+
+ . test/setup.sh || exit 1
+
+ (
+ cd "$TARGET_DIR/.." || exit 1
+ env -i \
+ PATH="/usr/bin:/bin" \
+ BOSUN_CMD="$BOSUN_CMD" \
+ BOSUN_DIR="$BOSUN_DIR" \
+ sh -c ". $TESTDIR/lib.sh; . $TESTDIR/$1.test"
+ )
+ TESTS_FAILED=$((TESTS_FAILED + $?))
+}
+
+run_test 01-add
+run_test 02-list
+run_test 03-flush
+run_test 04-rebuild
+run_test 05-remove
+run_test 06-default
+
+test $TESTS_FAILED -gt 0 && exit 1
+exit 0