diff options
author | Wolfgang Müller | 2021-03-10 17:09:13 +0100 |
---|---|---|
committer | Wolfgang Müller | 2021-03-10 17:09:13 +0100 |
commit | 3bce19d12d93f1b27e7d2f2acbef0926417d5390 (patch) | |
tree | 3700afd21af95a0904be6aaf3378fc75e3955b10 /test.sh | |
parent | 1d767c0bdd6476a4ba9a998b8953ec8b9ad9f21c (diff) | |
download | bosun-1.3.0.tar.gz |
Add a first draft of the test suite1.3.0
The introduction of a test suite makes future changes easier to
troubleshoot and verify. Whilst this is only a first draft, it should be
stable enough to be used in normal development and should cover the
entirety of bosun's functionality.
Diffstat (limited to '')
-rw-r--r-- | test.sh | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -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 |