Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 1 | #!/bin/sh |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 2 | |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 3 | _help() |
| 4 | { |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 5 | cat << EOF |
| 6 | ### run-regtests.sh ### |
| 7 | Running run-regtests.sh --help shows this information about how to use it |
| 8 | |
| 9 | Run without parameters to run all tests in the current folder (including subfolders) |
| 10 | run-regtests.sh |
| 11 | |
| 12 | Provide paths to run tests from (including subfolders): |
| 13 | run-regtests.sh ./tests1 ./tests2 |
| 14 | |
| 15 | Parameters: |
| 16 | --j <NUM>, To run varnishtest with multiple jobs / threads for a faster overall result |
| 17 | run-regtests.sh ./fasttest --j 16 |
| 18 | |
| 19 | --v, to run verbose |
| 20 | run-regtests.sh --v, disables the default varnishtest 'quiet' parameter |
| 21 | |
Christopher Faulet | 2a7cf92 | 2018-12-19 10:22:01 +0100 | [diff] [blame] | 22 | --debug to show test logs on standard ouput (implies --v) |
| 23 | run-regtests.sh --debug |
| 24 | |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 25 | --keep-logs to keep all log directories (by default kept if test fails) |
| 26 | run-regtests.sh --keep-logs |
| 27 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 28 | --varnishtestparams <ARGS>, passes custom ARGS to varnishtest |
| 29 | run-regtests.sh --varnishtestparams "-n 10" |
| 30 | |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 31 | --clean to cleanup previous reg-tests log directories and exit |
| 32 | run-regtests.sh --clean |
| 33 | |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 34 | --use-htx to use the HTX in tests |
| 35 | run-regtests.sh --use-htx, unsets the macro \${no-htx} |
| 36 | In .vtc files, in HAProxy configuration, you should use the following line |
| 37 | to "templatize" your tests: |
| 38 | |
| 39 | \${no-htx} option http-use-htx |
| 40 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 41 | Including text below into a .vtc file will check for its requirements |
| 42 | related to haproxy's target and compilation options |
| 43 | # Below targets are not capable of completing this test succesfully |
| 44 | #EXCLUDE_TARGET=freebsd, abns sockets are not available on freebsd |
| 45 | |
| 46 | #EXCLUDE_TARGETS=dos,freebsd,windows |
| 47 | |
| 48 | # Below option is required to complete this test succesfully |
| 49 | #REQUIRE_OPTION=OPENSSL, this test needs OPENSSL compiled in. |
| 50 | |
| 51 | #REQUIRE_OPTIONS=ZLIB,OPENSSL,LUA |
| 52 | |
| 53 | # To define a range of versions that a test can run with: |
| 54 | #REQUIRE_VERSION=0.0 |
| 55 | #REQUIRE_VERSION_BELOW=99.9 |
| 56 | |
| 57 | Configure environment variables to set the haproxy and varnishtest binaries to use |
| 58 | setenv HAPROXY_PROGRAM /usr/local/sbin/haproxy |
| 59 | setenv VARNISHTEST_PROGRAM /usr/local/bin/varnishtest |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 60 | or |
| 61 | export HAPROXY_PROGRAM=/usr/local/sbin/haproxy |
| 62 | export VARNISHTEST_PROGRAM=/usr/local/bin/varnishtest |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 63 | EOF |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 64 | exit 0 |
| 65 | } |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 66 | |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 67 | add_range_to_test_list() |
| 68 | { |
| 69 | level0="*.vtc" |
| 70 | level1="h*.vtc" |
| 71 | level2="s*.vtc" |
| 72 | level3="l*.vtc" |
| 73 | level4="b*.vtc" |
| 74 | level5="k*.vtc" |
| 75 | level6="e*.vtc" |
| 76 | |
| 77 | new_range=$(echo $1 | tr '-' ' ') |
| 78 | non_digit=$(echo $new_range | grep '[^0-9 ]') |
| 79 | if [ -n "$non_digit" ] ; then |
| 80 | return |
| 81 | fi |
| 82 | if [ "$new_range" = "$1" ] ; then |
| 83 | if [ $1 -gt 6 ] ; then |
| 84 | return |
| 85 | fi |
| 86 | eval echo '$'level$1 |
| 87 | return |
| 88 | fi |
| 89 | if [ -z "$new_range" ] ; then |
| 90 | return |
| 91 | fi |
| 92 | list= |
| 93 | for l in $(seq $new_range) ; do |
| 94 | if [ -n "l" ] ; then |
| 95 | if [ -z "$list" ] ; then |
| 96 | list="$(eval echo '$'level${l})" |
| 97 | else |
| 98 | list="$list $(eval echo '$'level${l})" |
| 99 | fi |
| 100 | fi |
| 101 | done |
| 102 | |
| 103 | echo $list |
| 104 | } |
| 105 | |
| 106 | |
| 107 | build_test_list() |
| 108 | { |
| 109 | # Remove any spacing character |
| 110 | LEVEL="$(echo $LEVEL | tr -d ' ')" |
| 111 | # Replave any comma character by a space character |
| 112 | LEVEL="$(echo $LEVEL | tr ',' ' ')" |
| 113 | list= |
| 114 | for range in $LEVEL ; do |
| 115 | if [ -z "$list" ] ; then |
| 116 | list=$(add_range_to_test_list $range) |
| 117 | else |
| 118 | list="$list $(add_range_to_test_list $range)" |
| 119 | fi |
| 120 | done |
| 121 | |
| 122 | echo $list |
| 123 | } |
| 124 | |
| 125 | build_find_expr() |
| 126 | { |
| 127 | expr= |
| 128 | for i in $@; do |
| 129 | if [ -z "$expr" ] ; then |
| 130 | expr="-name \"$i\"" |
| 131 | else |
| 132 | expr="$expr -o -name \"$i\"" |
| 133 | fi |
| 134 | done |
| 135 | |
| 136 | echo $expr |
| 137 | } |
| 138 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 139 | _startswith() { |
| 140 | _str="$1" |
| 141 | _sub="$2" |
| 142 | echo "$_str" | grep "^$_sub" >/dev/null 2>&1 |
| 143 | } |
| 144 | |
| 145 | _findtests() { |
| 146 | set -f |
| 147 | LEVEL=${LEVEL:-0}; |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 148 | list=$(build_test_list "$LEVEL") |
| 149 | if [ -z "$list" ] ; then |
| 150 | echo "Invalid level specification '"$LEVEL"' or no file was found." |
| 151 | exit 1 |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 152 | fi |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 153 | EXPR=$(build_find_expr $list) |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 154 | |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 155 | for i in $( find "$1" $(eval echo $EXPR) ); do |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 156 | skiptest= |
Willy Tarreau | 939193a | 2018-12-06 15:49:27 +0100 | [diff] [blame] | 157 | require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")" |
| 158 | require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")" |
| 159 | require_options="$(sed -ne 's/^#REQUIRE_OPTIONS=//p' "$i")" |
| 160 | exclude_targets=",$(sed -ne 's/^#EXCLUDE_TARGETS=//p' "$i")," |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 161 | |
| 162 | if [ -n "$require_version" ]; then |
| 163 | if [ $(_version "$HAPROXY_VERSION") -lt $(_version "$require_version") ]; then |
| 164 | echo " Skip $i because option haproxy is version: $HAPROXY_VERSION" |
| 165 | echo " REASON: this test requires at least version: $require_version" |
| 166 | skiptest=1 |
| 167 | fi |
| 168 | fi |
| 169 | if [ -n "$require_version_below" ]; then |
| 170 | if [ $(_version "$HAPROXY_VERSION") -ge $(_version "$require_version_below") ]; then |
| 171 | echo " Skip $i because option haproxy is version: $HAPROXY_VERSION" |
| 172 | echo " REASON: this test requires a version below: $require_version_below" |
| 173 | skiptest=1 |
| 174 | fi |
| 175 | fi |
| 176 | |
| 177 | if [ -n "$( echo "$exclude_targets" | grep ",$TARGET," )" ]; then |
| 178 | echo " Skip $i because exclude_targets" |
| 179 | echo " REASON: exclude_targets '$exclude_targets' contains '$TARGET'" |
| 180 | skiptest=1 |
| 181 | fi |
| 182 | |
| 183 | #echo "REQUIRE_OPTIONS : $require_options" |
| 184 | for requiredoption in $(echo $require_options | tr "," "\012" ); do |
| 185 | if [ -z "$( echo "$OPTIONS" | grep "USE_$requiredoption=1" )" ] |
| 186 | then |
| 187 | echo " Skip $i because option $requiredoption not found" |
| 188 | echo -n " REASON: " |
| 189 | echo -n "$required" | sed -e 's/.*,//' -e 's/^[[:space:]]//' |
| 190 | echo |
| 191 | skiptest=1 |
| 192 | fi |
| 193 | done |
| 194 | for required in "$(grep "#REQUIRE_OPTION=" "$i")"; |
| 195 | do |
| 196 | if [ -z "$required" ] |
| 197 | then |
| 198 | continue |
| 199 | fi |
| 200 | requiredoption=$(echo "$required" | sed -e 's/.*=//' -e 's/,.*//') |
| 201 | if [ -z "$( echo "$OPTIONS" | grep "USE_$requiredoption=1" )" ] |
| 202 | then |
| 203 | echo " Skip $i because option $requiredoption not found" |
| 204 | echo -n " REASON: " |
| 205 | echo "$required" | sed -e 's/.*,//' -e 's/^[[:space:]]//' |
| 206 | skiptest=1 |
| 207 | fi |
| 208 | done |
| 209 | testtarget=$(grep "#EXCLUDE_TARGET=" "$i") |
| 210 | if [ "$( echo "$testtarget" | grep "#EXCLUDE_TARGET=$TARGET," )" ] |
| 211 | then |
| 212 | echo " Skip $i because: TARGET = $TARGET" |
| 213 | echo -n " REASON: " |
| 214 | echo "$testtarget" | sed -e 's/.*,//' -e 's/^[[:space:]]//' |
| 215 | skiptest=1 |
| 216 | fi |
| 217 | |
| 218 | if [ -z $skiptest ]; then |
| 219 | echo " Add test: $i" |
| 220 | testlist="$testlist $i" |
| 221 | fi |
| 222 | done |
| 223 | } |
| 224 | |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 225 | _cleanup() |
| 226 | { |
| 227 | DIRS=$(find "${TESTDIR}" -maxdepth 1 -type d -name "haregtests-*" -exec basename {} \; 2>/dev/null) |
| 228 | if [ -z "${DIRS}" ]; then |
| 229 | echo "No reg-tests log directory found" |
| 230 | else |
| 231 | echo "Cleanup following reg-tests log directories:" |
| 232 | for d in ${DIRS}; do |
| 233 | echo " o ${TESTDIR}/$d" |
| 234 | done |
| 235 | read -p "Continue (y/n)?" reply |
| 236 | case "$reply" in |
| 237 | y|Y) |
| 238 | for d in ${DIRS}; do |
| 239 | rm -r "${TESTDIR}/$d" |
| 240 | done |
| 241 | echo "done" |
| 242 | exit 0 |
| 243 | ;; |
| 244 | *) |
| 245 | echo "aborted" |
| 246 | exit 1 |
| 247 | ;; |
| 248 | esac |
| 249 | fi |
| 250 | } |
| 251 | |
| 252 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 253 | _process() { |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 254 | while [ ${#} -gt 0 ]; do |
| 255 | if _startswith "$1" "-"; then |
| 256 | case "${1}" in |
| 257 | --j) |
| 258 | jobcount="$2" |
| 259 | shift |
| 260 | ;; |
| 261 | --varnishtestparams) |
| 262 | varnishtestparams="$2" |
| 263 | shift |
| 264 | ;; |
| 265 | --v) |
| 266 | verbose="" |
Christopher Faulet | 2a7cf92 | 2018-12-19 10:22:01 +0100 | [diff] [blame] | 267 | ;; |
| 268 | --debug) |
| 269 | verbose="" |
| 270 | debug="-v" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 271 | ;; |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 272 | --keep-logs) |
| 273 | keep_logs="-L" |
| 274 | ;; |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 275 | --LEVEL) |
| 276 | LEVEL="$2" |
| 277 | shift |
| 278 | ;; |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 279 | --use-htx) |
| 280 | no_htx="" |
| 281 | ;; |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 282 | --clean) |
| 283 | _cleanup |
| 284 | exit 0 |
| 285 | ;; |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 286 | --help) |
| 287 | _help |
| 288 | ;; |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 289 | *) |
| 290 | echo "Unknown parameter : $1" |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 291 | exit 1 |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 292 | ;; |
| 293 | esac |
| 294 | else |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 295 | REGTESTS="${REGTESTS} $1" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 296 | fi |
| 297 | shift 1 |
| 298 | done |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | _version() { |
| 302 | echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\012", $1,$2,$3,$4); }'; |
| 303 | } |
| 304 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 305 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 306 | HAPROXY_PROGRAM="${HAPROXY_PROGRAM:-${PWD}/haproxy}" |
| 307 | VARNISHTEST_PROGRAM="${VARNISHTEST_PROGRAM:-varnishtest}" |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 308 | TESTDIR="${TMPDIR:-/tmp}" |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 309 | REGTESTS="" |
| 310 | |
| 311 | jobcount="" |
| 312 | verbose="-q" |
Christopher Faulet | 2a7cf92 | 2018-12-19 10:22:01 +0100 | [diff] [blame] | 313 | debug="" |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 314 | keep_logs="-l" |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 315 | no_htx="#" |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 316 | testlist="" |
| 317 | |
| 318 | _process "$@"; |
| 319 | |
| 320 | echo "" |
| 321 | echo "########################## Preparing to run tests ##########################" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 322 | |
| 323 | preparefailed= |
| 324 | if ! [ -x "$(command -v $HAPROXY_PROGRAM)" ]; then |
| 325 | echo "haproxy not found in path, please specify HAPROXY_PROGRAM environment variable" |
| 326 | preparefailed=1 |
| 327 | fi |
| 328 | if ! [ -x "$(command -v $VARNISHTEST_PROGRAM)" ]; then |
| 329 | echo "varnishtest not found in path, please specify VARNISHTEST_PROGRAM environment variable" |
| 330 | preparefailed=1 |
| 331 | fi |
| 332 | if [ $preparefailed ]; then |
| 333 | exit 1 |
| 334 | fi |
| 335 | |
| 336 | { read HAPROXY_VERSION; read TARGET; read OPTIONS; } << EOF |
| 337 | $($HAPROXY_PROGRAM -vv |grep 'HA-Proxy version\|TARGET\|OPTIONS' | sed 's/.* = //') |
| 338 | EOF |
| 339 | |
| 340 | HAPROXY_VERSION=$(echo $HAPROXY_VERSION | cut -d " " -f 3) |
| 341 | echo "Testing with haproxy version: $HAPROXY_VERSION" |
| 342 | |
| 343 | TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')" |
| 344 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 345 | mkdir -p "$TESTDIR" || exit 1 |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 346 | TESTDIR=$(mktemp -d "$TESTDIR/haregtests-$TESTRUNDATETIME.XXXXXX") || exit 1 |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 347 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 348 | export TMPDIR="$TESTDIR" |
| 349 | export HAPROXY_PROGRAM="$HAPROXY_PROGRAM" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 350 | |
| 351 | # Mimic implicit build options from haproxy MakeFile that are present for each target: |
| 352 | |
| 353 | if [ $TARGET = generic ] ; then |
| 354 | #generic system target has nothing specific |
| 355 | OPTIONS="$OPTIONS USE_POLL=1 USE_TPROXY=1" |
| 356 | fi |
| 357 | if [ $TARGET = haiku ] ; then |
| 358 | #For Haiku |
| 359 | OPTIONS="$OPTIONS USE_POLL=1 USE_TPROXY=1" |
| 360 | fi |
| 361 | if [ $TARGET = linux22 ] ; then |
| 362 | #This is for Linux 2.2 |
| 363 | OPTIONS="$OPTIONS USE_POLL=1 USE_TPROXY=1 USE_LIBCRYPT=1 USE_DL=1 USE_RT=1" |
| 364 | fi |
| 365 | if [ $TARGET = linux24 ] ; then |
| 366 | #This is for standard Linux 2.4 with netfilter but without epoll() |
| 367 | OPTIONS="$OPTIONS USE_NETFILTER=1 USE_POLL=1 USE_TPROXY=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_DL=1 USE_RT=1" |
| 368 | fi |
| 369 | if [ $TARGET = linux24e ] ; then |
| 370 | #This is for enhanced Linux 2.4 with netfilter and epoll() patch>0.21 |
| 371 | OPTIONS="$OPTIONS USE_NETFILTER=1 USE_POLL=1 USE_EPOLL=1 USE_MY_EPOLL=1 USE_TPROXY=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_DL=1 USE_RT=1" |
| 372 | fi |
| 373 | if [ $TARGET = linux26 ] ; then |
| 374 | #This is for standard Linux 2.6 with netfilter and standard epoll() |
| 375 | OPTIONS="$OPTIONS USE_NETFILTER=1 USE_POLL=1 USE_EPOLL=1 USE_TPROXY=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_FUTEX=1 USE_DL=1 USE_RT=1" |
| 376 | fi |
| 377 | if [ $TARGET = linux2628 ] ; then |
| 378 | #This is for standard Linux >= 2.6.28 with netfilter, epoll, tproxy and splice |
| 379 | OPTIONS="$OPTIONS USE_NETFILTER=1 USE_POLL=1 USE_EPOLL=1 USE_TPROXY=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1 USE_ACCEPT4=1 USE_FUTEX=1 USE_CPU_AFFINITY=1 ASSUME_SPLICE_WORKS=1 USE_DL=1 USE_RT=1 USE_THREAD=1" |
| 380 | fi |
| 381 | if [ $TARGET = solaris ] ; then |
| 382 | #This is for Solaris8 |
| 383 | OPTIONS="$OPTIONS USE_POLL=1 USE_TPROXY=1 USE_LIBCRYPT=1 USE_CRYPT_H=1 USE_GETADDRINFO=1 USE_THREAD=1" |
| 384 | fi |
| 385 | if [ $TARGET = freebsd ] ; then |
| 386 | #This is for FreeBSD |
| 387 | OPTIONS="$OPTIONS USE_POLL=1 USE_KQUEUE=1 USE_TPROXY=1 USE_LIBCRYPT=1 USE_THREAD=1 USE_CPU_AFFINITY=1" |
| 388 | fi |
| 389 | if [ $TARGET = osx ] ; then |
| 390 | #This is for MacOS/X |
| 391 | OPTIONS="$OPTIONS USE_POLL=1 USE_KQUEUE=1 USE_TPROXY=1" |
| 392 | fi |
| 393 | if [ $TARGET = openbsd ] ; then |
| 394 | #This is for OpenBSD >= 5.7 |
| 395 | OPTIONS="$OPTIONS USE_POLL=1 USE_KQUEUE=1 USE_TPROXY=1 USE_ACCEPT4=1 USE_THREAD=1" |
| 396 | fi |
| 397 | if [ $TARGET = netbsd ] ; then |
| 398 | #This is for NetBSD |
| 399 | OPTIONS="$OPTIONS USE_POLL=1 USE_KQUEUE=1 USE_TPROXY=1" |
| 400 | fi |
| 401 | if [ $TARGET = aix51 ] ; then |
| 402 | #This is for AIX 5.1 |
| 403 | OPTIONS="$OPTIONS USE_POLL=1 USE_LIBCRYPT=1" |
| 404 | fi |
| 405 | if [ $TARGET = aix52 ] ; then |
| 406 | #This is for AIX 5.2 and later |
| 407 | OPTIONS="$OPTIONS USE_POLL=1 USE_LIBCRYPT=1" |
| 408 | fi |
| 409 | if [ $TARGET = cygwin ] ; then |
| 410 | #This is for Cygwin |
| 411 | OPTIONS="$OPTIONS USE_POLL=1 USE_TPROXY=1" |
| 412 | fi |
| 413 | |
| 414 | echo "Target : $TARGET" |
| 415 | echo "Options : $OPTIONS" |
| 416 | |
| 417 | echo "########################## Gathering tests to run ##########################" |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 418 | # if 'use-htx' option is set, but HAProxy version is lower to 1.9, disable it |
| 419 | if [ -z "$no_htx" ]; then |
| 420 | if [ $(_version "$HAPROXY_VERSION") -lt $(_version "1.9") ]; then |
| 421 | echo "" |
| 422 | echo "WARNING : Unset HTX for haproxy (version: $HAPROXY_VERSION)" |
| 423 | echo " REASON: this test requires at least version: 1.9" |
| 424 | echo "" |
| 425 | no_htx="#" |
| 426 | fi |
| 427 | fi |
| 428 | |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 429 | if [ -z "$REGTESTS" ]; then |
| 430 | _findtests ./ |
| 431 | else |
| 432 | for t in $REGTESTS; do |
| 433 | _findtests $t |
| 434 | done |
| 435 | fi |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 436 | |
| 437 | echo "########################## Starting varnishtest ##########################" |
| 438 | echo "Testing with haproxy version: $HAPROXY_VERSION" |
| 439 | _vtresult=0 |
| 440 | if [ -n "$testlist" ]; then |
| 441 | if [ -n "$jobcount" ]; then |
| 442 | jobcount="-j $jobcount" |
| 443 | fi |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 444 | cmd="$VARNISHTEST_PROGRAM -k -t 10 -Dno-htx=${no_htx} $keep_logs $verbose $debug $jobcount $varnishtestparams $testlist" |
Christopher Faulet | 1ecf0ea | 2018-12-18 22:47:23 +0100 | [diff] [blame] | 445 | eval $cmd |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 446 | _vtresult=$? |
| 447 | else |
| 448 | echo "No tests found that meet the required criteria" |
| 449 | fi |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 450 | |
| 451 | |
| 452 | if [ $_vtresult -eq 0 ]; then |
| 453 | # all tests were succesfull, removing tempdir (the last part.) |
| 454 | # ignore errors is the directory is not empty or if it does not exist |
| 455 | rmdir "$TESTDIR" 2>/dev/null |
| 456 | fi |
| 457 | |
| 458 | if [ -d "${TESTDIR}" ]; then |
| 459 | echo "########################## Gathering results ##########################" |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 460 | export TESTDIR |
| 461 | find "$TESTDIR" -type d -name "vtc.*" -exec sh -c 'for i; do |
| 462 | if [ ! -e "$i/LOG" ] ; then continue; fi |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 463 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 464 | cat <<- EOF | tee -a "$TESTDIR/failedtests.log" |
| 465 | $(echo "###### $(cat "$i/INFO") ######") |
| 466 | $(echo "## test results in: \"$i\"") |
Christopher Faulet | 6bd82cd | 2018-12-19 11:28:49 +0100 | [diff] [blame] | 467 | $(grep -- ^---- "$i/LOG") |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 468 | EOF |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 469 | done' sh {} + |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 470 | fi |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 471 | |
| 472 | exit $_vtresult |