aboutsummaryrefslogblamecommitdiffstats
path: root/test.sh
blob: f59412c03da78b4354087739a740dd9c56d8d707 (plain) (tree)



































                                                                     
#!/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