| 1 | #! /bin/sh | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 | # The following two are the ANSI sequences for start and end embolden | 
|---|
| 5 | case $TERM in | 
|---|
| 6 | vt*|ansi*|con*|xterm*|linux*|screen*) | 
|---|
| 7 | S=[1m | 
|---|
| 8 | E=[m | 
|---|
| 9 | ;; | 
|---|
| 10 | *) | 
|---|
| 11 | S= | 
|---|
| 12 | E= | 
|---|
| 13 | ;; | 
|---|
| 14 | esac | 
|---|
| 15 |  | 
|---|
| 16 | SCRIPTDIR=. | 
|---|
| 17 |  | 
|---|
| 18 | TEST_SRCDIR="XXXSRCXXX"; | 
|---|
| 19 | if test "x${TOP_SRCDIR}" = x; then | 
|---|
| 20 | # not within source tree, and not called with 'make testN' | 
|---|
| 21 | if test -f "${TEST_SRCDIR}/src/samhain.c"; then | 
|---|
| 22 | TOP_SRCDIR="${TEST_SRCDIR}"; export TOP_SRCDIR | 
|---|
| 23 | if test -f test/testcompile.sh; then | 
|---|
| 24 | SCRIPTDIR=test | 
|---|
| 25 | fi | 
|---|
| 26 | # not within source tree, not called by 'make', and in 'test' subdir | 
|---|
| 27 | elif test -f "../${TEST_SRCDIR}/src/samhain.c"; then | 
|---|
| 28 | cd .. | 
|---|
| 29 | SCRIPTDIR=test | 
|---|
| 30 | TOP_SRCDIR="${TEST_SRCDIR}"; export TOP_SRCDIR | 
|---|
| 31 | # within source tree, and not called with 'make testN' | 
|---|
| 32 | else | 
|---|
| 33 | if test -f ../src/samhain.c; then | 
|---|
| 34 | cd .. | 
|---|
| 35 | SCRIPTDIR=test | 
|---|
| 36 | TOP_SRCDIR=. | 
|---|
| 37 | export TOP_SRCDIR | 
|---|
| 38 | elif test -f ./src/samhain.c; then | 
|---|
| 39 | SCRIPTDIR=test | 
|---|
| 40 | TOP_SRCDIR=. | 
|---|
| 41 | export TOP_SRCDIR | 
|---|
| 42 | else | 
|---|
| 43 | echo "Please set the environment variable TOP_SRCDIR to the" | 
|---|
| 44 | echo "top directory in the samhain source tree." | 
|---|
| 45 | exit 1 | 
|---|
| 46 | fi | 
|---|
| 47 | fi | 
|---|
| 48 | else | 
|---|
| 49 | # called by make | 
|---|
| 50 | if test -f "${TOP_SRCDIR}/src/samhain.c"; then | 
|---|
| 51 | SCRIPTDIR=test | 
|---|
| 52 | else | 
|---|
| 53 | if test -f "../${TOP_SRCDIR}/src/samhain.c"; then | 
|---|
| 54 | cd ..; SCRIPTDIR=test | 
|---|
| 55 | else | 
|---|
| 56 | echo "Please set the environment variable TOP_SRCDIR to the" | 
|---|
| 57 | echo "top directory in the samhain source tree." | 
|---|
| 58 | exit 1 | 
|---|
| 59 | fi | 
|---|
| 60 | fi | 
|---|
| 61 | fi | 
|---|
| 62 |  | 
|---|
| 63 | export SCRIPTDIR | 
|---|
| 64 |  | 
|---|
| 65 | PW_DIR=`pwd`; export PW_DIR | 
|---|
| 66 |  | 
|---|
| 67 | if test x$1 = x1; then | 
|---|
| 68 | exec ${SCRIPTDIR}/testcompile.sh | 
|---|
| 69 | fi | 
|---|
| 70 | if test x$1 = x2; then | 
|---|
| 71 | exec ${SCRIPTDIR}/testhash.sh | 
|---|
| 72 | fi | 
|---|
| 73 | if test x$1 = x3; then | 
|---|
| 74 | exec ${SCRIPTDIR}/testrun_1.sh | 
|---|
| 75 | fi | 
|---|
| 76 | if test x$1 = x4; then | 
|---|
| 77 | exec ${SCRIPTDIR}/testrun_1a.sh | 
|---|
| 78 | fi | 
|---|
| 79 | if test x$1 = x5; then | 
|---|
| 80 | exec ${SCRIPTDIR}/testext.sh | 
|---|
| 81 | fi | 
|---|
| 82 | if test x$1 = x6; then | 
|---|
| 83 | exec ${SCRIPTDIR}/testtimesrv.sh | 
|---|
| 84 | fi | 
|---|
| 85 | if test x$1 = x7; then | 
|---|
| 86 | exec ${SCRIPTDIR}/testrun_1b.sh | 
|---|
| 87 | fi | 
|---|
| 88 | if test x$1 = x10; then | 
|---|
| 89 | exec ${SCRIPTDIR}/testrun_2.sh $2 | 
|---|
| 90 | fi | 
|---|
| 91 | if test x$1 = x11; then | 
|---|
| 92 | exec ${SCRIPTDIR}/testrun_2a.sh $2 | 
|---|
| 93 | fi | 
|---|
| 94 | if test x$1 = x12; then | 
|---|
| 95 | exec ${SCRIPTDIR}/testrun_2b.sh $2 | 
|---|
| 96 | fi | 
|---|
| 97 | if test x$1 = x13; then | 
|---|
| 98 | exec ${SCRIPTDIR}/testrun_2c.sh $2 | 
|---|
| 99 | fi | 
|---|
| 100 | if test x$1 = x14; then | 
|---|
| 101 | exec ${SCRIPTDIR}/testrun_2d.sh $2 | 
|---|
| 102 | fi | 
|---|
| 103 | if test x$1 = xall; then | 
|---|
| 104 | ${SCRIPTDIR}/testcompile.sh | 
|---|
| 105 | ${SCRIPTDIR}/testhash.sh | 
|---|
| 106 | ${SCRIPTDIR}/testrun_1.sh | 
|---|
| 107 | ${SCRIPTDIR}/testrun_1a.sh | 
|---|
| 108 | ${SCRIPTDIR}/testext.sh | 
|---|
| 109 | ${SCRIPTDIR}/testtimesrv.sh | 
|---|
| 110 | ${SCRIPTDIR}/testrun_1b.sh | 
|---|
| 111 | ${SCRIPTDIR}/testrun_2.sh $2 | 
|---|
| 112 | ${SCRIPTDIR}/testrun_2a.sh $2 | 
|---|
| 113 | fi | 
|---|
| 114 |  | 
|---|
| 115 | echo "Usage (in brackets: config files used):" | 
|---|
| 116 | echo | 
|---|
| 117 | echo "  ${S}test.sh 1${E}            -- Compilation with many different options" | 
|---|
| 118 | echo "  ${S}test.sh 2${E}            -- Hash function" | 
|---|
| 119 | echo "  ${S}test.sh 3${E}            -- Standalone init/check    (testrc_1)" | 
|---|
| 120 | echo "  ${S}test.sh 4${E}            -- Microstealth init/check  (testrc_1)" | 
|---|
| 121 | echo "  ${S}test.sh 5${E}            -- External program call    (testrc_1ext.in)" | 
|---|
| 122 | echo "  ${S}test.sh 6${E}            -- Timeserver option        (testrc_1)" | 
|---|
| 123 | echo "  ${S}test.sh 7${E}            -- GnuPG signed files       (testrc_1)" | 
|---|
| 124 | # | 
|---|
| 125 | # | 
|---|
| 126 | # | 
|---|
| 127 | echo "  ${S}test.sh 10 hostname${E}  -- Test c/s init/check      (testrc_2.in)" | 
|---|
| 128 | echo "  ${S}test.sh 11 hostname${E}  -- Test full c/s init/check (testrc_2.in)" | 
|---|
| 129 | echo "  ${S}test.sh 12 hostname${E}  -- Test full c/s w/gpg      (testrc_2.in)" | 
|---|
| 130 | echo "  ${S}test.sh 13 hostname${E}  -- Test full c/s w/mysql    (testrc_2.in)" | 
|---|
| 131 | echo "  ${S}test.sh 14 hostname${E}  -- Test c/s w/syslog logging(testrc_2.in)" | 
|---|
| 132 | echo "  ${S}test.sh a  hostname${E}  -- All except 7,12+" | 
|---|
| 133 |  | 
|---|
| 134 | echo | 
|---|
| 135 | echo "Scripts used: (1) ./testcompile.sh  (2) ./testhash.sh    (3) ./testrun_1.sh" | 
|---|
| 136 | echo "              (4) ./testrun_1a.sh   (5) ./testext.sh     (6) ./testtimesrv.sh" | 
|---|
| 137 | echo "              (7) ./testrun_1b.sh  (10) ./testrun_2.sh  (11) ./testrun_2a.sh" | 
|---|
| 138 | echo "             (12) ./testrun_2b.sh  (13) ./testrun_2c.sh (14) ./testrun_2d.sh" | 
|---|
| 139 |  | 
|---|