Changeset 0f65ea9 in mod_gnutls
- Timestamp:
- Jan 3, 2020, 5:05:34 AM (2 years ago)
- Branches:
- asyncio, master, proxy-ticket
- Children:
- 905063e
- Parents:
- 076049a
- Location:
- test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
test/mgstest/__init__.py
r076049a r0f65ea9 1 1 #!/usr/bin/python3 2 2 3 # Copyright 2019 Fiona Klute3 # Copyright 2019-2020 Fiona Klute 4 4 # 5 5 # Licensed under the Apache License, Version 2.0 (the "License"); … … 67 67 return m 68 68 return None 69 70 71 72 def require_match(regexp, file, error_message=None): 73 """Return the first match of the regular expression in file (by line), 74 or raise TestExpectationFailed. 75 76 If error_message is not None the exception message will be that 77 string, otherwise a generic message containing the regular 78 expression pattern. Technically applicable to any iterable 79 containing strings, not just files opened for reading. 80 81 """ 82 m = first_line_match(regexp, file) 83 if m: 84 return m 85 86 if error_message: 87 raise TestExpectationFailed(error_message) 88 else: 89 raise TestExpectationFailed(f'No match found for {regexp.pattern}!') -
test/test-28_HTTP2_support.bash
r076049a r0f65ea9 14 14 fi 15 15 16 # expected output files 17 log="outputs/28_HTTP2_support.log" 18 output="outputs/28_HTTP2_support.output" 19 20 ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number 28 \ 21 --log-connection "${log}" --log-responses "${output}" 22 23 echo "Checking for HTTP/2 in logged header:" 24 grep "HTTP/2 200" "${log}" 25 echo "Checking for TLS session status:" 26 grep "Current TLS session: (TLS" "${output}" 16 . ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number 28 -
test/tests/28_HTTP2_support/hooks.py
r076049a r0f65ea9 1 1 import os 2 import re 2 3 import subprocess 4 from mgstest import require_match 3 5 4 6 def run_connection(testname, conn_log, response_log): … … 15 17 print(proc.stdout) 16 18 print(proc.stdout, file=response_log) 19 20 def post_check(conn_log, response_log): 21 print('Checking for HTTP/2 in logged header:') 22 print(require_match(re.compile(r'\bHTTP/2 200\b'), conn_log).group(0)) 23 print('Checking for TLS session status:') 24 print(require_match(re.compile(r'^Current TLS session:\s\(TLS.*$'), 25 response_log) 26 .group(0))
Note: See TracChangeset
for help on using the changeset viewer.