Changeset 351b51f in mod_gnutls


Ignore:
Timestamp:
Apr 4, 2015, 5:19:06 PM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
2cde8111
Parents:
01b5d85
git-author:
Thomas Klute <thomas2.klute@…> (03/25/15 06:56:36)
git-committer:
Thomas Klute <thomas2.klute@…> (04/04/15 17:19:06)
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.

(cherry picked from commit dda3acf949f70564e0ea7be729684765a8c5ce5b)

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/TestMakefile

    r01b5d85 r351b51f  
    1313
    1414export TEST_GAP ?= 1.5
    15 export TEST_QUERY_DELAY ?= 2
     15export TEST_QUERY_DELAY ?= 6
    1616
    1717TEST_LOCK := ./test.lock
  • test/runtests

    r01b5d85 r351b51f  
    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.