Changeset 4fb510d in mod_gnutls
- Timestamp:
- Mar 5, 2017, 11:55:51 AM (6 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, main, master, proxy-ticket, upstream
- Children:
- 339a49d
- Parents:
- 5f3222b
- Location:
- test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
test/Makefile.am
r5f3222b r4fb510d 209 209 endif 210 210 # maximum time to wait for MSVA startup (milliseconds) 211 TEST_ MSVA_MAX_WAIT ?= 10000211 TEST_SERVICE_MAX_WAIT ?= 10000 212 212 # wait loop time for MSVA startup (milliseconds) 213 TEST_ MSVA_WAIT ?= 400213 TEST_SERVICE_WAIT ?= 400 214 214 215 215 AM_TESTS_ENVIRONMENT = export APACHE2=@APACHE2@; \ … … 219 219 export TEST_PORT="$(TEST_PORT)"; \ 220 220 export MSVA_PORT="$(MSVA_PORT)"; \ 221 export TEST_ MSVA_MAX_WAIT="$(TEST_MSVA_MAX_WAIT)"; \222 export TEST_ MSVA_WAIT="$(TEST_MSVA_WAIT)"; \221 export TEST_SERVICE_MAX_WAIT="$(TEST_SERVICE_MAX_WAIT)"; \ 222 export TEST_SERVICE_WAIT="$(TEST_SERVICE_WAIT)"; \ 223 223 export TEST_QUERY_TIMEOUT="@TEST_QUERY_TIMEOUT@"; \ 224 224 export BACKEND_HOST="@TEST_HOST@"; \ -
test/common.bash
r5f3222b r4fb510d 15 15 sleep 1 16 16 done 17 } 18 19 20 21 # Usage: verbose_log [...] 22 # 23 # If VERBOSE is not empty, write a log message prefixed with the name 24 # of the calling function. The function is defined to a no-op 25 # otherwise. 26 if [ -n "${VERBOSE}" ]; then 27 function verbose_log 28 { 29 echo "${FUNCNAME[1]}: ${@}" 30 } 31 else 32 function verbose_log 33 { 34 return 35 } 36 fi 37 38 39 40 # Usage: wait_ready COMMAND [TIMEOUT] [STEP] 41 # 42 # Wait until COMMAND terminates with success (zero exit code), or 43 # until the TIMEOUT (in milliseconds) expires. TIMEOUT defaults to 44 # $TEST_SERVICE_MAX_WAIT if unset. A TIMEOUT of zero means to try 45 # once. 46 # 47 # COMMAND is retried every STEP milliseconds, the default is 48 # $TEST_SERVICE_WAIT. Note that the last try may happen a little after 49 # TIMEOUT expires if STEP does not evenly divide it. 50 function wait_ready 51 { 52 local command="${1}" 53 if [ -z "${2}" ]; then 54 local -i timeout="${TEST_SERVICE_MAX_WAIT}" 55 else 56 local -i timeout="${2}" 57 fi 58 local -i step="${3}" 59 [ ${step} -gt 0 ] || step="${TEST_SERVICE_WAIT}" 60 # convert step to seconds because that's what "sleep" needs 61 local sec_step="$((${step} / 1000)).$((${step} % 1000))" 62 63 verbose_log "Waiting for \"${command}\" ..." 64 local -i waited=0 65 until eval "${command}"; do 66 if [ "${waited}" -ge "${timeout}" ]; then 67 echo "${FUNCNAME[0]}: Timed out waiting for \"${command}\"" \ 68 "to succeed (waited ${waited} ms)." >&2 69 return 1 70 fi 71 waited=$((waited + step)); 72 sleep "${sec_step}" 73 verbose_log "waiting (${waited} ms)" 74 done 75 verbose_log "done (waited ${waited} ms)" 17 76 } 18 77 -
test/runtests
r5f3222b r4fb510d 19 19 20 20 BADVARS=0 21 for v in APACHE2 TEST_HOST TEST_PORT TEST_QUERY_TIMEOUT TEST_ MSVA_WAIT \21 for v in APACHE2 TEST_HOST TEST_PORT TEST_QUERY_TIMEOUT TEST_SERVICE_WAIT \ 22 22 MSVA_PORT; do 23 23 if [ ! -v "$v" ]; then … … 127 127 128 128 printf "TESTING: initial MSVA verification\n" 129 # set to 0 if MSVA is up130 ret=1131 129 export MONKEYSPHERE_VALIDATION_AGENT_SOCKET="http://127.0.0.1:$MSVA_PORT" 132 130 133 # convert TEST_MSVA_WAIT to seconds because that's what "sleep" expects 134 TEST_MSVA_SLEEP="$((${TEST_MSVA_WAIT} / 1000)).$((${TEST_MSVA_WAIT} % 1000))" 135 # wait at most TEST_MSVA_MAX_WAIT milliseconds for MSVA to get ready 136 waited=0 137 until [ ${ret} -eq 0 ] \ 138 || [ ${waited} -ge ${TEST_MSVA_MAX_WAIT} ]; do 139 if msva-query-agent https "$(cat client.uid)" x509pem client < client/x509.pem 140 then 141 ret=0 142 else 143 echo "MSVA not ready yet" 144 fi 145 sleep "${TEST_MSVA_SLEEP}" 146 waited=$((${waited} + ${TEST_MSVA_WAIT})) 147 done 148 131 msva_test_cmd="msva-query-agent https \"$(cat client.uid)\" x509pem client < client/x509.pem" 149 132 # check if MSVA is up, fail if not 150 if [ ${ret} -eq 0 ]; then133 if wait_ready "${msva_test_cmd}"; then 151 134 printf "\nSUCCESS: initial MSVA verification\n" 152 135 else … … 207 190 fi 208 191 echo "---- Testing OCSP server ----" 209 ocsptool --ask --nonce --load-issuer authority/x509.pem --load-cert server/x509.pem ${store_ocsp}192 wait_ready "ocsptool --ask --nonce --load-issuer authority/x509.pem --load-cert server/x509.pem ${store_ocsp}" 210 193 echo "---- OCSP test done ----" 211 194 fi
Note: See TracChangeset
for help on using the changeset viewer.