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: |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 16 | --j <NUM>, To run vtest with multiple jobs / threads for a faster overall result |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 17 | run-regtests.sh ./fasttest --j 16 |
| 18 | |
| 19 | --v, to run verbose |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 20 | run-regtests.sh --v, disables the default vtest 'quiet' parameter |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 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 | |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 28 | --vtestparams <ARGS>, passes custom ARGS to vtest |
| 29 | run-regtests.sh --vtestparams "-n 10" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 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 | 78f31bf | 2019-04-12 16:53:41 +0200 | [diff] [blame] | 34 | --use-htx to use the HTX in tests (deprecated, the default mode now) |
| 35 | |
| 36 | --no-htx to use the legacy HTTP in tests |
| 37 | run-regtests.sh --no-htx, sets the macro \${no-htx} |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 38 | In .vtc files, in HAProxy configuration, you should use the following line |
| 39 | to "templatize" your tests: |
| 40 | |
| 41 | \${no-htx} option http-use-htx |
| 42 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 43 | Including text below into a .vtc file will check for its requirements |
| 44 | related to haproxy's target and compilation options |
| 45 | # Below targets are not capable of completing this test succesfully |
| 46 | #EXCLUDE_TARGET=freebsd, abns sockets are not available on freebsd |
| 47 | |
| 48 | #EXCLUDE_TARGETS=dos,freebsd,windows |
| 49 | |
| 50 | # Below option is required to complete this test succesfully |
| 51 | #REQUIRE_OPTION=OPENSSL, this test needs OPENSSL compiled in. |
| 52 | |
Christopher Faulet | 7e245df | 2018-12-21 15:18:02 +0100 | [diff] [blame] | 53 | #REQUIRE_OPTIONS=ZLIB|SLZ,OPENSSL,LUA |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 54 | |
| 55 | # To define a range of versions that a test can run with: |
| 56 | #REQUIRE_VERSION=0.0 |
| 57 | #REQUIRE_VERSION_BELOW=99.9 |
| 58 | |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 59 | Configure environment variables to set the haproxy and vtest binaries to use |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 60 | setenv HAPROXY_PROGRAM /usr/local/sbin/haproxy |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 61 | setenv VTEST_PROGRAM /usr/local/bin/vtest |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 62 | or |
| 63 | export HAPROXY_PROGRAM=/usr/local/sbin/haproxy |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 64 | export VTEST_PROGRAM=/usr/local/bin/vtest |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 65 | EOF |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 66 | exit 0 |
| 67 | } |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 68 | |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 69 | add_range_to_test_list() |
| 70 | { |
| 71 | level0="*.vtc" |
| 72 | level1="h*.vtc" |
| 73 | level2="s*.vtc" |
| 74 | level3="l*.vtc" |
| 75 | level4="b*.vtc" |
| 76 | level5="k*.vtc" |
| 77 | level6="e*.vtc" |
| 78 | |
| 79 | new_range=$(echo $1 | tr '-' ' ') |
| 80 | non_digit=$(echo $new_range | grep '[^0-9 ]') |
| 81 | if [ -n "$non_digit" ] ; then |
| 82 | return |
| 83 | fi |
| 84 | if [ "$new_range" = "$1" ] ; then |
| 85 | if [ $1 -gt 6 ] ; then |
| 86 | return |
| 87 | fi |
| 88 | eval echo '$'level$1 |
| 89 | return |
| 90 | fi |
| 91 | if [ -z "$new_range" ] ; then |
| 92 | return |
| 93 | fi |
| 94 | list= |
| 95 | for l in $(seq $new_range) ; do |
| 96 | if [ -n "l" ] ; then |
| 97 | if [ -z "$list" ] ; then |
| 98 | list="$(eval echo '$'level${l})" |
| 99 | else |
| 100 | list="$list $(eval echo '$'level${l})" |
| 101 | fi |
| 102 | fi |
| 103 | done |
| 104 | |
| 105 | echo $list |
| 106 | } |
| 107 | |
| 108 | |
| 109 | build_test_list() |
| 110 | { |
| 111 | # Remove any spacing character |
| 112 | LEVEL="$(echo $LEVEL | tr -d ' ')" |
| 113 | # Replave any comma character by a space character |
| 114 | LEVEL="$(echo $LEVEL | tr ',' ' ')" |
| 115 | list= |
| 116 | for range in $LEVEL ; do |
| 117 | if [ -z "$list" ] ; then |
| 118 | list=$(add_range_to_test_list $range) |
| 119 | else |
| 120 | list="$list $(add_range_to_test_list $range)" |
| 121 | fi |
| 122 | done |
| 123 | |
| 124 | echo $list |
| 125 | } |
| 126 | |
| 127 | build_find_expr() |
| 128 | { |
| 129 | expr= |
| 130 | for i in $@; do |
| 131 | if [ -z "$expr" ] ; then |
| 132 | expr="-name \"$i\"" |
| 133 | else |
| 134 | expr="$expr -o -name \"$i\"" |
| 135 | fi |
| 136 | done |
| 137 | |
| 138 | echo $expr |
| 139 | } |
| 140 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 141 | _startswith() { |
| 142 | _str="$1" |
| 143 | _sub="$2" |
| 144 | echo "$_str" | grep "^$_sub" >/dev/null 2>&1 |
| 145 | } |
| 146 | |
| 147 | _findtests() { |
| 148 | set -f |
| 149 | LEVEL=${LEVEL:-0}; |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 150 | list=$(build_test_list "$LEVEL") |
| 151 | if [ -z "$list" ] ; then |
| 152 | echo "Invalid level specification '"$LEVEL"' or no file was found." |
| 153 | exit 1 |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 154 | fi |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 155 | EXPR=$(build_find_expr $list) |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 156 | |
Frederic Lecaille | d4f36e3 | 2018-12-13 22:15:05 +0100 | [diff] [blame] | 157 | for i in $( find "$1" $(eval echo $EXPR) ); do |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 158 | skiptest= |
Willy Tarreau | 939193a | 2018-12-06 15:49:27 +0100 | [diff] [blame] | 159 | require_version="$(sed -ne 's/^#REQUIRE_VERSION=//p' "$i")" |
| 160 | require_version_below="$(sed -ne 's/^#REQUIRE_VERSION_BELOW=//p' "$i")" |
Christopher Faulet | 7e245df | 2018-12-21 15:18:02 +0100 | [diff] [blame] | 161 | require_options="$(sed -ne 's/^#REQUIRE_OPTIONS=//p' "$i" | sed -e 's/,/ /g')" |
| 162 | exclude_targets="$(sed -ne 's/^#EXCLUDE_TARGETS=//p' "$i" | sed -e 's/,/ /g')" |
| 163 | |
| 164 | requiredoption="$(sed -ne 's/^#REQUIRE_OPTION=//p' "$i" | sed -e 's/,.*//')" |
| 165 | if [ -n "$requiredoption" ]; then |
| 166 | require_options="$require_options $requiredoption" |
| 167 | fi |
| 168 | |
| 169 | excludedtarget="$(sed -ne 's/^#EXCLUDE_TARGET=//p' "$i" | sed -e 's/,.*//')" |
| 170 | if [ -n "$excludedtarget" ]; then |
| 171 | exclude_targets="$exclude_targets $excludedtarget" |
| 172 | fi |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 173 | |
| 174 | if [ -n "$require_version" ]; then |
| 175 | if [ $(_version "$HAPROXY_VERSION") -lt $(_version "$require_version") ]; then |
| 176 | echo " Skip $i because option haproxy is version: $HAPROXY_VERSION" |
| 177 | echo " REASON: this test requires at least version: $require_version" |
| 178 | skiptest=1 |
| 179 | fi |
| 180 | fi |
| 181 | if [ -n "$require_version_below" ]; then |
| 182 | if [ $(_version "$HAPROXY_VERSION") -ge $(_version "$require_version_below") ]; then |
| 183 | echo " Skip $i because option haproxy is version: $HAPROXY_VERSION" |
| 184 | echo " REASON: this test requires a version below: $require_version_below" |
| 185 | skiptest=1 |
| 186 | fi |
| 187 | fi |
| 188 | |
Christopher Faulet | 7e245df | 2018-12-21 15:18:02 +0100 | [diff] [blame] | 189 | for excludedtarget in $exclude_targets; do |
| 190 | if [ "$excludedtarget" = "$TARGET" ]; then |
| 191 | echo " Skip $i because haproxy is compiled for the excluded target $TARGET" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 192 | skiptest=1 |
| 193 | fi |
| 194 | done |
Christopher Faulet | 7e245df | 2018-12-21 15:18:02 +0100 | [diff] [blame] | 195 | |
| 196 | for requiredoption in $require_options; do |
| 197 | alternatives=$(echo "$requiredoption" | sed -e 's/|/ /g') |
| 198 | found= |
| 199 | for alt in $alternatives; do |
Willy Tarreau | 87586e1 | 2019-03-27 13:52:39 +0100 | [diff] [blame] | 200 | if echo "$FEATURES" | grep -qw "\+$alt"; then |
Christopher Faulet | 7e245df | 2018-12-21 15:18:02 +0100 | [diff] [blame] | 201 | found=1; |
| 202 | fi |
| 203 | done |
| 204 | if [ -z $found ]; then |
| 205 | echo " Skip $i because haproxy is not compiled with the required option $requiredoption" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 206 | skiptest=1 |
| 207 | fi |
| 208 | done |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 209 | |
| 210 | if [ -z $skiptest ]; then |
| 211 | echo " Add test: $i" |
| 212 | testlist="$testlist $i" |
| 213 | fi |
| 214 | done |
| 215 | } |
| 216 | |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 217 | _cleanup() |
| 218 | { |
| 219 | DIRS=$(find "${TESTDIR}" -maxdepth 1 -type d -name "haregtests-*" -exec basename {} \; 2>/dev/null) |
| 220 | if [ -z "${DIRS}" ]; then |
| 221 | echo "No reg-tests log directory found" |
| 222 | else |
| 223 | echo "Cleanup following reg-tests log directories:" |
| 224 | for d in ${DIRS}; do |
| 225 | echo " o ${TESTDIR}/$d" |
| 226 | done |
| 227 | read -p "Continue (y/n)?" reply |
| 228 | case "$reply" in |
| 229 | y|Y) |
| 230 | for d in ${DIRS}; do |
| 231 | rm -r "${TESTDIR}/$d" |
| 232 | done |
| 233 | echo "done" |
| 234 | exit 0 |
| 235 | ;; |
| 236 | *) |
| 237 | echo "aborted" |
| 238 | exit 1 |
| 239 | ;; |
| 240 | esac |
| 241 | fi |
| 242 | } |
| 243 | |
| 244 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 245 | _process() { |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 246 | while [ ${#} -gt 0 ]; do |
| 247 | if _startswith "$1" "-"; then |
| 248 | case "${1}" in |
| 249 | --j) |
| 250 | jobcount="$2" |
| 251 | shift |
| 252 | ;; |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 253 | --vtestparams) |
| 254 | vtestparams="$2" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 255 | shift |
| 256 | ;; |
| 257 | --v) |
| 258 | verbose="" |
Christopher Faulet | 2a7cf92 | 2018-12-19 10:22:01 +0100 | [diff] [blame] | 259 | ;; |
| 260 | --debug) |
| 261 | verbose="" |
| 262 | debug="-v" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 263 | ;; |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 264 | --keep-logs) |
| 265 | keep_logs="-L" |
| 266 | ;; |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 267 | --LEVEL) |
| 268 | LEVEL="$2" |
| 269 | shift |
| 270 | ;; |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 271 | --use-htx) |
| 272 | no_htx="" |
| 273 | ;; |
Christopher Faulet | 78f31bf | 2019-04-12 16:53:41 +0200 | [diff] [blame] | 274 | --no-htx) |
| 275 | no_htx="no " |
| 276 | ;; |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 277 | --clean) |
| 278 | _cleanup |
| 279 | exit 0 |
| 280 | ;; |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 281 | --help) |
| 282 | _help |
| 283 | ;; |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 284 | *) |
| 285 | echo "Unknown parameter : $1" |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 286 | exit 1 |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 287 | ;; |
| 288 | esac |
| 289 | else |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 290 | REGTESTS="${REGTESTS} $1" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 291 | fi |
| 292 | shift 1 |
| 293 | done |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | _version() { |
| 297 | echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\012", $1,$2,$3,$4); }'; |
| 298 | } |
| 299 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 300 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 301 | HAPROXY_PROGRAM="${HAPROXY_PROGRAM:-${PWD}/haproxy}" |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 302 | VTEST_PROGRAM="${VTEST_PROGRAM:-vtest}" |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 303 | TESTDIR="${TMPDIR:-/tmp}" |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 304 | REGTESTS="" |
| 305 | |
| 306 | jobcount="" |
| 307 | verbose="-q" |
Christopher Faulet | 2a7cf92 | 2018-12-19 10:22:01 +0100 | [diff] [blame] | 308 | debug="" |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 309 | keep_logs="-l" |
Christopher Faulet | 78f31bf | 2019-04-12 16:53:41 +0200 | [diff] [blame] | 310 | no_htx="" |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 311 | testlist="" |
| 312 | |
| 313 | _process "$@"; |
| 314 | |
| 315 | echo "" |
| 316 | echo "########################## Preparing to run tests ##########################" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 317 | |
| 318 | preparefailed= |
| 319 | if ! [ -x "$(command -v $HAPROXY_PROGRAM)" ]; then |
| 320 | echo "haproxy not found in path, please specify HAPROXY_PROGRAM environment variable" |
| 321 | preparefailed=1 |
| 322 | fi |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 323 | if ! [ -x "$(command -v $VTEST_PROGRAM)" ]; then |
| 324 | echo "vtest not found in path, please specify VTEST_PROGRAM environment variable" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 325 | preparefailed=1 |
| 326 | fi |
| 327 | if [ $preparefailed ]; then |
| 328 | exit 1 |
| 329 | fi |
| 330 | |
Willy Tarreau | ad25c26 | 2019-03-27 14:00:10 +0100 | [diff] [blame] | 331 | { read HAPROXY_VERSION; read TARGET; read FEATURES; } << EOF |
| 332 | $($HAPROXY_PROGRAM -vv |grep 'HA-Proxy version\|TARGET.*=\|^Feature' | sed 's/.* [:=] //') |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 333 | EOF |
| 334 | |
| 335 | HAPROXY_VERSION=$(echo $HAPROXY_VERSION | cut -d " " -f 3) |
| 336 | echo "Testing with haproxy version: $HAPROXY_VERSION" |
| 337 | |
| 338 | TESTRUNDATETIME="$(date '+%Y-%m-%d_%H-%M-%S')" |
| 339 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 340 | mkdir -p "$TESTDIR" || exit 1 |
Christopher Faulet | 8d0fdf5 | 2018-12-19 10:18:40 +0100 | [diff] [blame] | 341 | TESTDIR=$(mktemp -d "$TESTDIR/haregtests-$TESTRUNDATETIME.XXXXXX") || exit 1 |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 342 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 343 | export TMPDIR="$TESTDIR" |
| 344 | export HAPROXY_PROGRAM="$HAPROXY_PROGRAM" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 345 | |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 346 | echo "Target : $TARGET" |
Willy Tarreau | 87586e1 | 2019-03-27 13:52:39 +0100 | [diff] [blame] | 347 | echo "Options : $FEATURES" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 348 | |
| 349 | echo "########################## Gathering tests to run ##########################" |
Christopher Faulet | 78f31bf | 2019-04-12 16:53:41 +0200 | [diff] [blame] | 350 | # if htx is enable, but HAProxy version is lower to 1.9, disable it |
| 351 | if [ $(_version "$HAPROXY_VERSION") -lt $(_version "1.9") ]; then |
| 352 | no_htx="#" |
Christopher Faulet | fa6798f | 2018-12-19 11:22:04 +0100 | [diff] [blame] | 353 | fi |
| 354 | |
Christopher Faulet | 8d67cf8 | 2018-12-18 22:41:20 +0100 | [diff] [blame] | 355 | if [ -z "$REGTESTS" ]; then |
| 356 | _findtests ./ |
| 357 | else |
| 358 | for t in $REGTESTS; do |
| 359 | _findtests $t |
| 360 | done |
| 361 | fi |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 362 | |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 363 | echo "########################## Starting vtest ##########################" |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 364 | echo "Testing with haproxy version: $HAPROXY_VERSION" |
| 365 | _vtresult=0 |
| 366 | if [ -n "$testlist" ]; then |
| 367 | if [ -n "$jobcount" ]; then |
| 368 | jobcount="-j $jobcount" |
| 369 | fi |
Frédéric Lécaille | 4336123 | 2019-01-11 10:10:21 +0100 | [diff] [blame] | 370 | cmd="$VTEST_PROGRAM -k -t 10 -Dno-htx=${no_htx} $keep_logs $verbose $debug $jobcount $vtestparams $testlist" |
Christopher Faulet | 1ecf0ea | 2018-12-18 22:47:23 +0100 | [diff] [blame] | 371 | eval $cmd |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 372 | _vtresult=$? |
| 373 | else |
| 374 | echo "No tests found that meet the required criteria" |
| 375 | fi |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 376 | |
| 377 | |
| 378 | if [ $_vtresult -eq 0 ]; then |
| 379 | # all tests were succesfull, removing tempdir (the last part.) |
| 380 | # ignore errors is the directory is not empty or if it does not exist |
| 381 | rmdir "$TESTDIR" 2>/dev/null |
| 382 | fi |
| 383 | |
| 384 | if [ -d "${TESTDIR}" ]; then |
| 385 | echo "########################## Gathering results ##########################" |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 386 | export TESTDIR |
| 387 | find "$TESTDIR" -type d -name "vtc.*" -exec sh -c 'for i; do |
| 388 | if [ ! -e "$i/LOG" ] ; then continue; fi |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 389 | |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 390 | cat <<- EOF | tee -a "$TESTDIR/failedtests.log" |
| 391 | $(echo "###### $(cat "$i/INFO") ######") |
| 392 | $(echo "## test results in: \"$i\"") |
Frédéric Lécaille | f9a48ef | 2019-01-08 11:30:28 +0100 | [diff] [blame] | 393 | $(grep -E -- "^(----|\* diag)" "$i/LOG") |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 394 | EOF |
Frédéric Lécaille | 51e01b5 | 2018-11-29 21:41:42 +0100 | [diff] [blame] | 395 | done' sh {} + |
PiBa-NL | 7250404 | 2018-11-27 22:26:38 +0100 | [diff] [blame] | 396 | fi |
Christopher Faulet | 9c6df5e | 2018-12-19 10:25:07 +0100 | [diff] [blame] | 397 | |
| 398 | exit $_vtresult |