summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2017-11-22 20:00:33 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2018-04-17 16:22:49 +0000
commit3ac029f674edea1cc91014345f445a9a8d1fc89f (patch)
treecfbe98eb3861f2c813b71b3d7274d40998a8fd0b
parent0b70f5ada9aa4e0a44a26f3adb910ac98de31583 (diff)
Make generated selftest output match for in-source builds
When generate_expected_output.py is run for an in-source build, the raw output contains no paths to the sources for the script to whittle down, as it does for shadow builds, to just the path from qtbase down. So kludge together some extra regexes that can fix that up and tweak some relevant code to provide them with the data they need. Change-Id: I656d7126087bd9ad20b2af6835fba314d90a171d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rwxr-xr-xtests/auto/testlib/selftests/generate_expected_output.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py
index c059b83511..94eb26e481 100755
--- a/tests/auto/testlib/selftests/generate_expected_output.py
+++ b/tests/auto/testlib/selftests/generate_expected_output.py
@@ -116,10 +116,13 @@ class Cleaner (object):
raise Fail('Unable to find', command, 'in $PATH')
# Are we being run from the right place ?
- myNames = scriptPath.split(os.path.sep)
- if not (here.split(os.path.sep)[-5:] == myNames[-6:-1]
+ scriptPath, myName = os.path.split(scriptPath)
+ hereNames, depth = scriptPath.split(os.path.sep), 5
+ hereNames = hereNames[-depth:] # path components from qtbase down
+ assert hereNames[0] == 'qtbase', ('Script moved: please correct depth', hereNames)
+ if not (here.split(os.path.sep)[-depth:] == hereNames
and os.path.isfile(qmake)):
- raise Fail('Run', myNames[-1], 'in its directory of a completed build')
+ raise Fail('Run', myName, 'in its directory of a completed build')
try:
qtver = subprocess.check_output([qmake, '-query', 'QT_VERSION'])
@@ -127,8 +130,17 @@ class Cleaner (object):
raise Fail(what.strerror)
qtver = qtver.strip().decode('utf-8')
- scriptPath = os.path.dirname(scriptPath) # ditch leaf file-name
- sentinel = os.path.sep + 'qtbase' + os.path.sep # '/qtbase/'
+ hereNames = tuple(hereNames)
+ # Add path to specific sources and to tst_*.cpp if missing (for in-source builds):
+ patterns += ((r'(^|[^/])\b(qtestcase.cpp)\b', r'\1qtbase/src/testlib/\2'),
+ # Add more special cases here, if they show up !
+ (r'([[" ])\.\./(counting/tst_counting.cpp)\b',
+ r'\1' + os.path.sep.join(hereNames + (r'\2',))),
+ # The common pattern:
+ (r'(^|[^/])\b(tst_)?([a-z]+\d*)\.cpp\b',
+ r'\1' + os.path.sep.join(hereNames + (r'\3', r'\2\3.cpp'))))
+
+ sentinel = os.path.sep + hereNames[0] + os.path.sep # '/qtbase/'
# Identify the path prefix of our qtbase ancestor directory
# (source, build and $PWD, when different); trim such prefixes
# off all paths we see.