This giant patch makes some much needed improvements to the code base. * The engine has been rewritten and lives within engine/graph/ * All of the common interfaces and code now live in engine/ * All of the resources are in one package called engine/resources/ * The Res API can use different "traits" from engine/traits/ * The Res API has been simplified to hide many of the old internals * The Watch & Process loops were previously inverted, but is now fixed * The likelihood of package cycles has been reduced drastically * And much, much more... Unfortunately, some code had to be temporarily removed. The remote code had to be taken out, as did the prometheus code. We hope to have these back in new forms as soon as possible.
82 lines
2.2 KiB
Bash
Executable File
82 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# simple test harness for testing mgmt
|
|
# NOTE: this will rm -rf /tmp/mgmt/
|
|
|
|
echo running "$0"
|
|
set -o errexit
|
|
set -o pipefail
|
|
|
|
#ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
|
|
ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
cd "${ROOT}"
|
|
. test/util.sh
|
|
cd - >/dev/null
|
|
|
|
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
|
|
echo -e "usage: ./"`basename $0`" [[--help] | <test>]"
|
|
echo -e "where: <test> is empty to run all tests, or <file>.sh from shell/ dir"
|
|
exit 1
|
|
fi
|
|
|
|
LINE=$(printf '=%.0s' `seq -s ' ' $(tput cols)`) # a terminal width string
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
|
|
cd "$DIR" >/dev/null # work from main mgmt directory
|
|
failures=""
|
|
count=0
|
|
|
|
# loop through tests
|
|
for i in $DIR/test/shell/*.sh; do
|
|
[ -x "$i" ] || continue # file must be executable
|
|
ii=`basename "$i"` # short name
|
|
# if ARGV has test names, only execute those!
|
|
if [ "$1" != '' ]; then
|
|
[ "$ii" != "$1" ] && continue
|
|
fi
|
|
cd $DIR/test/shell/ >/dev/null # shush the cd operation
|
|
mkdir -p '/tmp/mgmt/' # directory for mgmt to put files in
|
|
#echo "Running: $ii"
|
|
export MGMT_TMPDIR='/tmp/mgmt/' # we can add to env like this
|
|
count=`expr $count + 1`
|
|
set +o errexit # don't kill script on test failure
|
|
out=$($i 2>&1) # run and capture stdout & stderr
|
|
e=$? # save exit code
|
|
set -o errexit # re-enable killing on script failure
|
|
cd - >/dev/null
|
|
if [ -L '/tmp/mgmt/' ]; then # this was once a symlink :(
|
|
fail_test "Can't remove symlink in /tmp/mgmt/"
|
|
fi
|
|
rm -rf '/tmp/mgmt/' # clean up after test
|
|
if [ $e -ne 0 ]; then
|
|
echo -e "FAIL\t$ii" # fail
|
|
# store failures...
|
|
failures=$(
|
|
# prepend previous failures if any
|
|
[ -n "${failures}" ] && echo "$failures" && echo "$LINE"
|
|
echo "Script: $ii"
|
|
# if we see 124, it might be the exit value of timeout!
|
|
[ $e -eq 124 ] && echo "Exited: $e (timeout?)" || echo "Exited: $e"
|
|
if [ "$out" = "" ]; then
|
|
echo "Output: (empty!)"
|
|
else
|
|
echo "Output:"
|
|
echo "$out"
|
|
fi
|
|
)
|
|
else
|
|
echo -e "ok\t$ii" # pass
|
|
fi
|
|
done
|
|
|
|
if [ "$count" = '0' ]; then
|
|
fail_test 'No tests were run!'
|
|
fi
|
|
|
|
# display errors
|
|
if [[ -n "${failures}" ]]; then
|
|
echo 'FAIL'
|
|
echo 'The following tests failed:'
|
|
echo "${failures}"
|
|
exit 1
|
|
fi
|
|
echo 'PASS'
|