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