aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-10-31 12:57:25 +0100
committerChristian Tismer <tismer@stackless.com>2019-10-31 13:37:02 +0100
commit0019062ff0f64b549f3d5c7ddcb3635e0440a6ab (patch)
treeeed212911463af502c5a24ffa48533c54e5c00db
parent7255f15da73b2d85a63d7636c8e901c224b713b2 (diff)
Make the scrape script robust enough, again
The script scrape_testresults.py analyzes log files in order to find embedded script files for the registry. This script does not try to be absolute water-proof but handled the existing cases well. By chance, the text "BEGIN_FILE", which is used as an indicator, was found in a traceback from the generating script. We modified the search to ignore this text in single quotes, but also changed the originating file testing/runner.py to no longer contain this text in the future. Change-Id: I1fef1cf5e9b85fc94b7ee52edbdf4afa4bf4e35a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/pyside2/tests/registry/scrape_testresults.py4
-rw-r--r--testing/runner.py7
2 files changed, 8 insertions, 3 deletions
diff --git a/sources/pyside2/tests/registry/scrape_testresults.py b/sources/pyside2/tests/registry/scrape_testresults.py
index 4c2e37129..2e8f9c953 100644
--- a/sources/pyside2/tests/registry/scrape_testresults.py
+++ b/sources/pyside2/tests/registry/scrape_testresults.py
@@ -246,7 +246,9 @@ def handle_suburl(idx, n, url, level):
test_name = sub_url.split("/")[-2]
print(os.getpid(), test_name)
response = read_url(sub_url)
- if response and "BEGIN_FILE" in response.text:
+ txt = response.text if response else ''
+ if "BEGIN_FILE" in txt and not "'BEGIN_FILE'" in txt:
+ # find the text, but not a traceback with that text
print(os.getpid(), test_name, "FOUND!")
write_data(test_name, response.text)
else:
diff --git a/testing/runner.py b/testing/runner.py
index 3db84c0fc..83b7b08e6 100644
--- a/testing/runner.py
+++ b/testing/runner.py
@@ -185,15 +185,18 @@ class TestRunner(object):
# 'for line in input:' would read into too large chunks
labelled = True
+ # make sure that this text is not found in a traceback of the runner!
+ text_a = "BEGIN" "_FILE"
+ text_z = "END" "_FILE"
while True:
line = input.readline()
if not line:
break
- if line.startswith('BEGIN_FILE'):
+ if line.startswith(text_a):
labelled = False
txt = line.rstrip()
xprint(label, txt) if label and labelled else xprint(txt)
- if line.startswith('END_FILE'):
+ if line.startswith(text_z):
labelled = True
tee_src = dedent("""\