Changeset 33af2b7 in mod_gnutls for test/runtests


Ignore:
Timestamp:
May 11, 2015, 6:28:20 PM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
31caead
Parents:
e24eed6
git-author:
Thomas Klute <thomas2.klute@…> (05/11/15 18:12:28)
git-committer:
Thomas Klute <thomas2.klute@…> (05/11/15 18:28:20)
Message:

Test suite: Add tests to "dist" target and support VPATH builds

Supporting VPATH builds requires using $srcdir to find non-generated
data rather than fixed relative paths. If test are not called through
the make system, local defaults must be used. Not changing directories
during tests any more makes this easier.

A few files (e.g. templates, generated CRL) have been moved around to
better match the new structure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtests

    re24eed6 r33af2b7  
    2121
    2222if [ 0 != "$BADVARS" ]; then
    23     exit 1
    24 fi
    25 
    26 if [ . != "$(dirname "$0")" ]; then
    27     printf "You should only run this mod-gnutls test suite from the test/ directory of the mod_gnutls source.\n" >&2
    2823    exit 1
    2924fi
     
    8580function apache_down_err() {
    8681    printf "FAILURE: %s\n" "$TEST_NAME"
    87     /usr/sbin/apache2 -f "$(pwd)/apache.conf" -k stop || true
     82    /usr/sbin/apache2 -f "${t}/apache.conf" -k stop || true
    8883    if [ -e output ]; then
    8984        printf "\ngnutls-cli outputs:\n"
     
    9691
    9792    printf "\nApache error logs:\n"
    98     tail "../../logs/${TEST_NAME}.error.log"
     93    tail "logs/${TEST_NAME}.error.log"
    9994
    10095    if [ -n "${USE_MSVA}" ]; then
     
    10499
    105100if [ -z "$tests" ] ; then
    106     tests=./tests/*
     101    tests=${srcdir}/tests/*
    107102else
    108     tests=./tests/"$(printf "%02d" "$tests")"_*
     103    tests=${srcdir}/tests/"$(printf "%02d" "$tests")"_*
    109104fi
    110105
    111106if [ -n "${USE_MSVA}" ]; then
    112     GNUPGHOME=$(pwd)/msva.gnupghome MSVA_KEYSERVER_POLICY=never monkeysphere-validation-agent &
     107    GNUPGHOME=msva.gnupghome MSVA_KEYSERVER_POLICY=never monkeysphere-validation-agent &
    113108    trap stop_msva EXIT
    114109
     
    125120        sleep "$TEST_GAP"
    126121    fi
     122    t="$(realpath ${t})"
     123    export srcdir="$(realpath ${srcdir})"
    127124    export TEST_NAME="$(basename "$t")"
    128     output="../../outputs/${TEST_NAME}.output"
     125    output="outputs/${TEST_NAME}.output"
    129126    rm -f "$output"
    130     cd "$t"
    131     if [ -e fail.* ]; then
     127
     128    if [ -e ${t}/fail.* ]; then
    132129        EXPECTED_FAILURE="$(printf " (expected: %s)" fail.*)"
    133130    else
     
    139136        MONKEYSPHERE_VALIDATION_AGENT_SOCKET="http://127.0.0.1:$MSVA_PORT" \
    140137            ${flock_cmd} \
    141             /usr/sbin/apache2 -f "$(pwd)/apache.conf" -k start \
    142             || [ -e fail.server ]
     138            /usr/sbin/apache2 -f "${t}/apache.conf" -k start \
     139            || [ -e "${t}/fail.server" ]
    143140    else
    144141        ${flock_cmd} \
    145             /usr/sbin/apache2 -f "$(pwd)/apache.conf" -k start \
    146             || [ -e fail.server ]
     142            /usr/sbin/apache2 -f "${t}/apache.conf" -k start \
     143            || [ -e "${t}/fail.server" ]
    147144    fi
    148145
     
    156153    # case to proceed instead of waiting for it to return. The sleep
    157154    # process is stopped after gnutls-cli terminates.
    158     if (sed "s/__HOSTNAME__/${TEST_HOST}/" <./input && \
     155    if (sed "s/__HOSTNAME__/${TEST_HOST}/" <${t}/input && \
    159156        run_with_pidfile "${sleep_pidfile}" sleep "${TEST_QUERY_DELAY}" &) | \
    160         gnutls-cli -p "${TEST_PORT}" $(cat ./gnutls-cli.args) "${TEST_HOST}" \
     157        gnutls-cli -p "${TEST_PORT}" $(cat ${t}/gnutls-cli.args) "${TEST_HOST}" \
    161158        >"$output";
    162159    then
    163         if [ -e fail* ]; then
     160        if [ -e ${t}/fail* ]; then
    164161            printf "%s should have failed but succeeded\n" "$(basename "$t")" >&2
    165162            exit 1
    166163        fi
    167164    else
    168         if [ ! -e fail* ]; then
     165        if [ ! -e ${t}/fail* ]; then
    169166            printf "%s should have succeeded but failed\n" "$(basename "$t")" >&2
    170167            exit 1
     
    175172    unset sleep_pidfile
    176173
    177     if [ -e output ] ; then
    178         diff_output_filter_headers "output" "$output" "-q"
     174    if [ -e ${t}/output ] ; then
     175        diff_output_filter_headers "${t}/output" "$output" "-q"
    179176    fi
    180     /usr/sbin/apache2 -f "$(pwd)/apache.conf" -k stop || [ -e fail.server ]
     177    /usr/sbin/apache2 -f "${t}/apache.conf" -k stop || [ -e ${t}/fail.server ]
    181178    if [ -n "${USE_MSVA}" ]; then
    182179        trap stop_msva EXIT
     
    185182    fi
    186183    printf "SUCCESS: %s\n" "$TEST_NAME"
    187     cd ../..
    188184done
    189185
Note: See TracChangeset for help on using the changeset viewer.