Changeset dda3acf in mod_gnutls for test/runtests


Ignore:
Timestamp:
Mar 25, 2015, 6:56:36 AM (5 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
7d2123d
Parents:
6bbc00a
Message:

Speed up tests with background sleep

Until now, a significant part of test run time was spent waiting
TEST_QUERY_DELAY seconds for a response from the server. The sleep call
used for that keeps the pipe from the subshell to gnutls-cli open,
without it, gnutls-cli would terminate as soon as sed is done, leading
to failing tests. However, in many cases the wait is longer than
necessary for the test.

Sending sleep to the background allows the test case to proceed instead
of waiting for sleep to return, but has the disadvantage of leaving the
sleep process dangling until it eventually times out. I think the
significantly reduced test execution time is worth it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtests

    r6bbc00a rdda3acf  
    9191    fi
    9292
    93     if (sed "s/__HOSTNAME__/${TEST_HOST}/" < ./input && sleep "$TEST_QUERY_DELAY") | \
    94         gnutls-cli -p "${TEST_PORT}" $(cat ./gnutls-cli.args) "${TEST_HOST}" > \
    95         "$output" ; then
     93    # The sleep call keeps the pipe from the subshell to gnutls-cli
     94    # open. Without it gnutls-cli would terminate as soon as sed is
     95    # done, and not wait for a response from the server, leading to
     96    # failing tests. Sending sleep to the background allows the test
     97    # case to proceed instead of waiting for it to return, but has the
     98    # disadvantage of leaving the sleep process dangling until it
     99    # eventually times out. Still preferable to a fixed delay.
     100    if (sed "s/__HOSTNAME__/${TEST_HOST}/" <./input && \
     101        sleep "${TEST_QUERY_DELAY}" &) | \
     102        gnutls-cli -p "${TEST_PORT}" $(cat ./gnutls-cli.args) "${TEST_HOST}" \
     103        >"$output";
     104    then
    96105        if [ -e fail* ]; then
    97106            printf "%s should have failed but succeeded\n" "$(basename "$t")" >&2
     
    104113        fi
    105114    fi
     115
    106116    if [ -e output ] ; then
    107117        diff -q -u output <( tail -n "$(wc -l < output)" "$output" )
Note: See TracChangeset for help on using the changeset viewer.