2 PATH
=/sbin
:/bin
:/usr
/sbin
:/usr
/bin
5 [[ -e .testdir
]] && . .testdir
6 if [[ -z "$TESTDIR" ]] ||
[[ ! -d "$TESTDIR" ]]; then
7 TESTDIR
=$
(mktemp
-d --tmpdir="/var/tmp" -t dracut-test.XXXXXX
)
9 echo "TESTDIR=\"$TESTDIR\"" > .testdir
12 command -v test_check
&>/dev
/null || test_check
() {
16 # terminal sequence to set color to a 'success' color (currently: green)
17 function SETCOLOR_SUCCESS
() { echo -en '\033[0;32m'; }
18 # terminal sequence to set color to a 'failure' color (currently: red)
19 function SETCOLOR_FAILURE
() { echo -en '\033[0;31m'; }
20 # terminal sequence to set color to a 'warning' color (currently: yellow)
21 function SETCOLOR_WARNING
() { echo -en '\033[0;33m'; }
22 # terminal sequence to reset to the default color.
23 function SETCOLOR_NORMAL
() { echo -en '\033[0;39m'; }
26 if (( $EUID != 0 )); then
27 SETCOLOR_FAILURE
; echo "Tests must be run as root! Please use 'sudo'."; SETCOLOR_NORMAL
36 echo "TEST RUN: $TEST_DESCRIPTION"
37 test_check
&& test_run
41 echo "TEST SETUP: $TEST_DESCRIPTION"
42 test_check
&& test_setup
45 echo "TEST CLEANUP: $TEST_DESCRIPTION"
52 echo -n "TEST: $TEST_DESCRIPTION ";
53 if ! test_check
2&>test.log
; then
59 if [ "$V" != "1" ]; then
61 test_setup
&& test_run
67 ) </dev
/null
>test.log
2>&1
71 test_setup
&& test_run
77 ) </dev
/null
2>&1 |
tee test.log
81 if [ $ret -eq 0 ]; then
90 echo "see $(pwd)/test.log"