Changeset 232fb60 in mod_gnutls
- Timestamp:
- Mar 31, 2015, 7:03:16 PM (8 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, jessie-backports, master, proxy-ticket, upstream
- Children:
- 1b57c56
- Parents:
- a213967
- Location:
- test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/TestMakefile
ra213967 r232fb60 13 13 14 14 export TEST_GAP ?= 1.5 15 export TEST_QUERY_DELAY ?= 615 export TEST_QUERY_DELAY ?= 30 16 16 17 17 TEST_LOCK := ./test.lock -
test/runtests
ra213967 r232fb60 44 44 function diff_output_filter_headers() 45 45 { 46 expected="$1"47 actual="$2"46 local expected="$1" 47 local actual="$2" 48 48 diff $3 -u "${expected}" <( cat "${actual}" | \ 49 49 grep -v -P '^Date:\s.*GMT\s?$' | \ 50 50 grep -v -P '^Server:\sApache' | \ 51 51 tail -n "$(wc -l < ${expected})" ) 52 } 53 54 # Run a command, storing its PID in the given file 55 # Usage: run_with_pidfile PIDFILE COMMAND [ARGS] 56 function run_with_pidfile() 57 { 58 local pidfile=$1 59 local cmd=$2 60 shift 2 61 echo $BASHPID >${pidfile} 62 exec ${cmd} $* 63 } 64 65 # Kills the process with the PID contained in a given file, then 66 # deletes the file. 67 # Usage: kill_by_pidfile PIDFILE 68 function kill_by_pidfile() 69 { 70 local pidfile="${1}" 71 # In some testcases with expected failure, gnutls-cli sometimes 72 # failed before the subshell in front of the pipe (see gnutls-cli 73 # call below) got so far as to write the PID, much less exec 74 # sleep. So we need to check if there actually is anything to 75 # kill. 76 if [ -n "${pidfile}" ]; then 77 local pid=$(cat "${pidfile}") 78 if [ -n "${pid}" ] && ps -p "${pid}"; then 79 kill "${pid}" 80 fi 81 rm "${pidfile}" 82 fi 52 83 } 53 84 … … 59 90 diff_output_filter_headers "output" "$output" || true 60 91 fi 92 93 if [ -n "${sleep_pidfile}" ]; then 94 kill_by_pidfile "${sleep_pidfile}" 95 fi 96 61 97 printf "\nApache error logs:\n" 62 98 tail "../../logs/${TEST_NAME}.error.log" 99 63 100 if [ -n "${USE_MSVA}" ]; then 64 101 stop_msva … … 110 147 fi 111 148 149 # PID file for sleep command (explanation below) 150 sleep_pidfile="$(mktemp mod_gnutls_test-XXXXXX.pid)" 151 112 152 # The sleep call keeps the pipe from the subshell to gnutls-cli 113 153 # open. Without it gnutls-cli would terminate as soon as sed is 114 154 # done, and not wait for a response from the server, leading to 115 155 # failing tests. Sending sleep to the background allows the test 116 # case to proceed instead of waiting for it to return, but has the 117 # disadvantage of leaving the sleep process dangling until it 118 # eventually times out. Still preferable to a fixed delay. 156 # case to proceed instead of waiting for it to return. The sleep 157 # process is stopped after gnutls-cli terminates. 119 158 if (sed "s/__HOSTNAME__/${TEST_HOST}/" <./input && \ 120 sleep "${TEST_QUERY_DELAY}" &) | \159 run_with_pidfile "${sleep_pidfile}" sleep "${TEST_QUERY_DELAY}" &) | \ 121 160 gnutls-cli -p "${TEST_PORT}" $(cat ./gnutls-cli.args) "${TEST_HOST}" \ 122 161 >"$output"; … … 132 171 fi 133 172 fi 173 174 kill_by_pidfile "${sleep_pidfile}" 134 175 135 176 if [ -e output ] ; then
Note: See TracChangeset
for help on using the changeset viewer.