diff options
author | Neil Horman <nhorman@openssl.org> | 2024-02-29 18:01:31 +0100 |
---|---|---|
committer | Neil Horman <nhorman@openssl.org> | 2024-03-02 15:12:54 +0100 |
commit | 5677992679b38950c6a0c3775fd57378e1879ba5 (patch) | |
tree | 7c3386484b5ca88c71f1c63153cfffbdaae82c97 /test/recipes | |
parent | Implement PCT for EDDSA (diff) | |
download | openssl-5677992679b38950c6a0c3775fd57378e1879ba5.tar.xz openssl-5677992679b38950c6a0c3775fd57378e1879ba5.zip |
Dump out qlog json if it is malformed
We're still seeing periodic failures in qlog from malformed json output,
so lets try to catch it.
Modify the verify-qlog.py script to, in the event of an exception in
json.loads, to replay the entire json file to the console, followed by
an exception indicating what line it died trying to parse.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23715)
Diffstat (limited to 'test/recipes')
-rwxr-xr-x | test/recipes/70-test_quic_multistream_data/verify-qlog.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/recipes/70-test_quic_multistream_data/verify-qlog.py b/test/recipes/70-test_quic_multistream_data/verify-qlog.py index b056bf857c..ae11007f3e 100755 --- a/test/recipes/70-test_quic_multistream_data/verify-qlog.py +++ b/test/recipes/70-test_quic_multistream_data/verify-qlog.py @@ -14,6 +14,10 @@ class Unexpected(Exception): def __init__(self, filename, msg): Exception.__init__(self, f"file {repr(filename)}: {msg}") +class Malformed(Exception): + def __init__(self, line, msg): + Exception.__init__(self, f"{line}: {msg}") + event_type_counts = {} frame_type_counts = {} @@ -25,7 +29,13 @@ def load_file(filename): raise Unexpected(filename, "expected JSON-SEQ leader") line = line[1:] - objs.append(json.loads(line)) + try: + objs.append(json.loads(line)) + except: + fi.seek(0) + fdata = fi.read() + print(fdata) + raise Malformed(line, "Malformed json input") return objs def check_header(filename, hdr): |