Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | #!/bin/sh |
michael@0 | 2 | |
michael@0 | 3 | FAILED=no |
michael@0 | 4 | |
michael@0 | 5 | if test "x$TEST_OUTPUT_FILE" = "x" |
michael@0 | 6 | then |
michael@0 | 7 | TEST_OUTPUT_FILE=/dev/null |
michael@0 | 8 | fi |
michael@0 | 9 | |
michael@0 | 10 | # /bin/echo is a little more likely to support -n than sh's builtin echo, |
michael@0 | 11 | # printf is even more likely |
michael@0 | 12 | if test "`printf %s hello 2>&1`" = "hello" |
michael@0 | 13 | then |
michael@0 | 14 | ECHO_N="printf %s" |
michael@0 | 15 | else |
michael@0 | 16 | if test -x /bin/echo |
michael@0 | 17 | then |
michael@0 | 18 | ECHO_N="/bin/echo -n" |
michael@0 | 19 | else |
michael@0 | 20 | ECHO_N="echo -n" |
michael@0 | 21 | fi |
michael@0 | 22 | fi |
michael@0 | 23 | |
michael@0 | 24 | if test "$TEST_OUTPUT_FILE" != "/dev/null" |
michael@0 | 25 | then |
michael@0 | 26 | touch "$TEST_OUTPUT_FILE" || exit 1 |
michael@0 | 27 | fi |
michael@0 | 28 | |
michael@0 | 29 | TEST_DIR=. |
michael@0 | 30 | |
michael@0 | 31 | T=`echo "$0" | sed -e 's/test.sh$//'` |
michael@0 | 32 | if test -x "$T/test-init" |
michael@0 | 33 | then |
michael@0 | 34 | TEST_DIR="$T" |
michael@0 | 35 | fi |
michael@0 | 36 | |
michael@0 | 37 | setup () { |
michael@0 | 38 | EVENT_NOKQUEUE=yes; export EVENT_NOKQUEUE |
michael@0 | 39 | EVENT_NODEVPOLL=yes; export EVENT_NODEVPOLL |
michael@0 | 40 | EVENT_NOPOLL=yes; export EVENT_NOPOLL |
michael@0 | 41 | EVENT_NOSELECT=yes; export EVENT_NOSELECT |
michael@0 | 42 | EVENT_NOEPOLL=yes; export EVENT_NOEPOLL |
michael@0 | 43 | unset EVENT_EPOLL_USE_CHANGELIST |
michael@0 | 44 | EVENT_NOEVPORT=yes; export EVENT_NOEVPORT |
michael@0 | 45 | EVENT_NOWIN32=yes; export EVENT_NOWIN32 |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | announce () { |
michael@0 | 49 | echo "$@" |
michael@0 | 50 | echo "$@" >>"$TEST_OUTPUT_FILE" |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | announce_n () { |
michael@0 | 54 | $ECHO_N "$@" |
michael@0 | 55 | echo "$@" >>"$TEST_OUTPUT_FILE" |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | |
michael@0 | 59 | run_tests () { |
michael@0 | 60 | if $TEST_DIR/test-init 2>>"$TEST_OUTPUT_FILE" ; |
michael@0 | 61 | then |
michael@0 | 62 | true |
michael@0 | 63 | else |
michael@0 | 64 | announce Skipping test |
michael@0 | 65 | return |
michael@0 | 66 | fi |
michael@0 | 67 | |
michael@0 | 68 | announce_n " test-eof: " |
michael@0 | 69 | if $TEST_DIR/test-eof >>"$TEST_OUTPUT_FILE" ; |
michael@0 | 70 | then |
michael@0 | 71 | announce OKAY ; |
michael@0 | 72 | else |
michael@0 | 73 | announce FAILED ; |
michael@0 | 74 | FAILED=yes |
michael@0 | 75 | fi |
michael@0 | 76 | announce_n " test-weof: " |
michael@0 | 77 | if $TEST_DIR/test-weof >>"$TEST_OUTPUT_FILE" ; |
michael@0 | 78 | then |
michael@0 | 79 | announce OKAY ; |
michael@0 | 80 | else |
michael@0 | 81 | announce FAILED ; |
michael@0 | 82 | FAILED=yes |
michael@0 | 83 | fi |
michael@0 | 84 | announce_n " test-time: " |
michael@0 | 85 | if $TEST_DIR/test-time >>"$TEST_OUTPUT_FILE" ; |
michael@0 | 86 | then |
michael@0 | 87 | announce OKAY ; |
michael@0 | 88 | else |
michael@0 | 89 | announce FAILED ; |
michael@0 | 90 | FAILED=yes |
michael@0 | 91 | fi |
michael@0 | 92 | announce_n " test-changelist: " |
michael@0 | 93 | if $TEST_DIR/test-changelist >>"$TEST_OUTPUT_FILE" ; |
michael@0 | 94 | then |
michael@0 | 95 | announce OKAY ; |
michael@0 | 96 | else |
michael@0 | 97 | announce FAILED ; |
michael@0 | 98 | FAILED=yes |
michael@0 | 99 | fi |
michael@0 | 100 | test -x $TEST_DIR/regress || return |
michael@0 | 101 | announce_n " regress: " |
michael@0 | 102 | if test "$TEST_OUTPUT_FILE" = "/dev/null" ; |
michael@0 | 103 | then |
michael@0 | 104 | $TEST_DIR/regress --quiet |
michael@0 | 105 | else |
michael@0 | 106 | $TEST_DIR/regress >>"$TEST_OUTPUT_FILE" |
michael@0 | 107 | fi |
michael@0 | 108 | if test "$?" = "0" ; |
michael@0 | 109 | then |
michael@0 | 110 | announce OKAY ; |
michael@0 | 111 | else |
michael@0 | 112 | announce FAILED ; |
michael@0 | 113 | FAILED=yes |
michael@0 | 114 | fi |
michael@0 | 115 | } |
michael@0 | 116 | |
michael@0 | 117 | announce "Running tests:" |
michael@0 | 118 | |
michael@0 | 119 | # Need to do this by hand? |
michael@0 | 120 | setup |
michael@0 | 121 | unset EVENT_NOEVPORT |
michael@0 | 122 | announce "EVPORT" |
michael@0 | 123 | run_tests |
michael@0 | 124 | |
michael@0 | 125 | setup |
michael@0 | 126 | unset EVENT_NOKQUEUE |
michael@0 | 127 | announce "KQUEUE" |
michael@0 | 128 | run_tests |
michael@0 | 129 | |
michael@0 | 130 | setup |
michael@0 | 131 | unset EVENT_NOEPOLL |
michael@0 | 132 | announce "EPOLL" |
michael@0 | 133 | run_tests |
michael@0 | 134 | |
michael@0 | 135 | setup |
michael@0 | 136 | unset EVENT_NOEPOLL |
michael@0 | 137 | EVENT_EPOLL_USE_CHANGELIST=yes; export EVENT_EPOLL_USE_CHANGELIST |
michael@0 | 138 | announce "EPOLL (changelist)" |
michael@0 | 139 | run_tests |
michael@0 | 140 | |
michael@0 | 141 | setup |
michael@0 | 142 | unset EVENT_NODEVPOLL |
michael@0 | 143 | announce "DEVPOLL" |
michael@0 | 144 | run_tests |
michael@0 | 145 | |
michael@0 | 146 | setup |
michael@0 | 147 | unset EVENT_NOPOLL |
michael@0 | 148 | announce "POLL" |
michael@0 | 149 | run_tests |
michael@0 | 150 | |
michael@0 | 151 | setup |
michael@0 | 152 | unset EVENT_NOSELECT |
michael@0 | 153 | announce "SELECT" |
michael@0 | 154 | run_tests |
michael@0 | 155 | |
michael@0 | 156 | setup |
michael@0 | 157 | unset EVENT_NOWIN32 |
michael@0 | 158 | announce "WIN32" |
michael@0 | 159 | run_tests |
michael@0 | 160 | |
michael@0 | 161 | if test "$FAILED" = "yes"; then |
michael@0 | 162 | exit 1 |
michael@0 | 163 | fi |