Changeset 54aa269 in mod_gnutls for test/runtests


Ignore:
Timestamp:
Mar 31, 2015, 8:23:43 AM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
ed82a6a
Parents:
f84890d
Message:

Test suite: Exclude "Date" header when comparing actual and expected output

The "Date" header may be sent with Apache error pages, e.g. in case of a failed
proxy request. It is expected to change and must thus be excluded from the
comparison, otherwise tests expecting such an error page will always fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtests

    rf84890d r54aa269  
    3333}
    3434
     35# Compare expected/actual outputs, filtering out the "Date" header
     36# from actual output because it is expected to change. It must have
     37# been manually excluded from the expected output.
     38#
     39# Parameters:
     40# $1: path to expected output
     41# $2: path to actual output
     42# $3: additional options for diff (optional)
     43function diff_output_filter_date()
     44{
     45    expected="$1"
     46    actual="$2"
     47    diff $3 -u "${expected}" <( cat "${actual}" | \
     48        grep -v -P '^Date:\s.*GMT\s?$' | tail -n "$(wc -l < ${expected})" )
     49}
     50
    3551function apache_down_err() {
    3652    printf "FAILURE: %s\n" "$TEST_NAME"
    3753    /usr/sbin/apache2 -f "$(pwd)/apache.conf" -k stop || true
    3854    if [ -e output ]; then
    39         printf "\ngnutls-cli outputs:\n"
    40         diff -u output <( tail -n "$(wc -l < output)" "$output" ) || true
     55        printf "\ngnutls-cli outputs:\n"
     56        diff_output_filter_date "output" "$output" || true
    4157    fi
    4258    printf "\nApache error logs:\n"
     
    115131
    116132    if [ -e output ] ; then
    117         diff -q -u output <( tail -n "$(wc -l < output)" "$output" )
     133        diff_output_filter_date "output" "$output" "-q"
    118134    fi
    119135    /usr/sbin/apache2 -f "$(pwd)/apache.conf" -k stop || [ -e fail.server ]
Note: See TracChangeset for help on using the changeset viewer.