Changeset 5d85ad3 in mod_gnutls


Ignore:
Timestamp:
Jul 23, 2015, 11:40:15 AM (3 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
dbec528
Parents:
56056de
Message:

Test suite: Remove loop for multiple test cases in runtests script

It is not needed any more, and removing it simplifies the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtests

    r56056de r5d85ad3  
    151151fi
    152152
    153 for t in $testid; do
    154     if [ -z "${flock_cmd}" ]; then
    155         echo "Warning: no lock file set"
    156         sleep "$TEST_GAP"
    157     fi
    158     t="$(realpath ${t})"
    159     export srcdir="$(realpath ${srcdir})"
    160     export TEST_NAME="$(basename "$t")"
    161     output="outputs/${TEST_NAME}.output"
    162     rm -f "$output"
    163 
    164     if [ -e ${t}/fail.* ]; then
    165         EXPECTED_FAILURE="$(printf " (expected: %s)" fail.*)"
    166     else
    167         unset EXPECTED_FAILURE
    168     fi
    169     printf "TESTING: %s%s\n" "$TEST_NAME" "$EXPECTED_FAILURE"
    170     trap apache_down_err EXIT
    171     if [ -n "${USE_MSVA}" ]; then
    172         MONKEYSPHERE_VALIDATION_AGENT_SOCKET="http://127.0.0.1:$MSVA_PORT" \
    173             ${flock_cmd} \
    174             ${APACHE2} -f "${t}/apache.conf" -k start \
    175             || [ -e "${t}/fail.server" ]
    176     else
    177         ${flock_cmd} \
    178             ${APACHE2} -f "${t}/apache.conf" -k start \
    179             || [ -e "${t}/fail.server" ]
    180     fi
    181 
    182     # PID file for sleep command (explanation below)
    183     sleep_pidfile="$(mktemp mod_gnutls_test-XXXXXX.pid)"
    184 
    185     # The sleep call keeps the pipe from the subshell to gnutls-cli
    186     # open. Without it gnutls-cli would terminate as soon as sed is
    187     # done, and not wait for a response from the server, leading to
    188     # failing tests. Sending sleep to the background allows the test
    189     # case to proceed instead of waiting for it to return. The sleep
    190     # process is stopped after gnutls-cli terminates.
    191     if (sed "s/__HOSTNAME__/${TEST_HOST}/" <${t}/input && \
    192         run_with_pidfile "${sleep_pidfile}" sleep "${TEST_QUERY_DELAY}" &) | \
    193         gnutls-cli -p "${TEST_PORT}" $(cat ${t}/gnutls-cli.args) "${TEST_HOST}" \
    194         >"$output";
    195     then
    196         if [ -e ${t}/fail* ]; then
    197             printf "%s should have failed but succeeded\n" "$(basename "$t")" >&2
    198             exit 1
    199         fi
    200     else
    201         if [ ! -e ${t}/fail* ]; then
    202             printf "%s should have succeeded but failed\n" "$(basename "$t")" >&2
    203             exit 1
    204         fi
    205     fi
    206 
    207     kill_by_pidfile "${sleep_pidfile}"
    208     unset sleep_pidfile
    209 
    210     if [ -e ${t}/output ] ; then
    211         diff_output_filter_headers "${t}/output" "$output" "-q"
    212     fi
    213     if [ -n "${USE_MSVA}" ]; then
    214         trap stop_msva EXIT
    215     else
    216         trap - EXIT
    217     fi
    218     ${APACHE2} -f "${t}/apache.conf" -k stop || [ -e ${t}/fail.server ]
    219     printf "SUCCESS: %s\n" "$TEST_NAME"
    220 done
     153if [ -z "${flock_cmd}" ]; then
     154    echo "Warning: no lock file set"
     155    sleep "$TEST_GAP"
     156fi
     157t="$(realpath ${testid})"
     158export srcdir="$(realpath ${srcdir})"
     159export TEST_NAME="$(basename "$t")"
     160output="outputs/${TEST_NAME}.output"
     161rm -f "$output"
     162
     163if [ -e ${t}/fail.* ]; then
     164    EXPECTED_FAILURE="$(printf " (expected: %s)" fail.*)"
     165else
     166    unset EXPECTED_FAILURE
     167fi
     168printf "TESTING: %s%s\n" "$TEST_NAME" "$EXPECTED_FAILURE"
     169trap apache_down_err EXIT
     170if [ -n "${USE_MSVA}" ]; then
     171    MONKEYSPHERE_VALIDATION_AGENT_SOCKET="http://127.0.0.1:$MSVA_PORT" \
     172                                        ${flock_cmd} \
     173                                        ${APACHE2} -f "${t}/apache.conf" -k start \
     174        || [ -e "${t}/fail.server" ]
     175else
     176    ${flock_cmd} \
     177        ${APACHE2} -f "${t}/apache.conf" -k start \
     178        || [ -e "${t}/fail.server" ]
     179fi
     180
     181# PID file for sleep command (explanation below)
     182sleep_pidfile="$(mktemp mod_gnutls_test-XXXXXX.pid)"
     183
     184# The sleep call keeps the pipe from the subshell to gnutls-cli
     185# open. Without it gnutls-cli would terminate as soon as sed is
     186# done, and not wait for a response from the server, leading to
     187# failing tests. Sending sleep to the background allows the test
     188# case to proceed instead of waiting for it to return. The sleep
     189# process is stopped after gnutls-cli terminates.
     190if (sed "s/__HOSTNAME__/${TEST_HOST}/" <${t}/input && \
     191           run_with_pidfile "${sleep_pidfile}" sleep "${TEST_QUERY_DELAY}" &) | \
     192       gnutls-cli -p "${TEST_PORT}" $(cat ${t}/gnutls-cli.args) "${TEST_HOST}" \
     193                  >"$output";
     194then
     195    if [ -e ${t}/fail* ]; then
     196        printf "%s should have failed but succeeded\n" "$(basename "$t")" >&2
     197        exit 1
     198    fi
     199else
     200    if [ ! -e ${t}/fail* ]; then
     201        printf "%s should have succeeded but failed\n" "$(basename "$t")" >&2
     202        exit 1
     203    fi
     204fi
     205
     206kill_by_pidfile "${sleep_pidfile}"
     207unset sleep_pidfile
     208
     209if [ -e ${t}/output ] ; then
     210    diff_output_filter_headers "${t}/output" "$output" "-q"
     211fi
     212if [ -n "${USE_MSVA}" ]; then
     213    trap stop_msva EXIT
     214else
     215    trap - EXIT
     216fi
     217${APACHE2} -f "${t}/apache.conf" -k stop || [ -e ${t}/fail.server ]
     218printf "SUCCESS: %s\n" "$TEST_NAME"
    221219
    222220if [ -n "${USE_MSVA}" ]; then
Note: See TracChangeset for help on using the changeset viewer.