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