aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-11-22 09:53:16 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-27 16:43:04 +0000
commitf30e4db5169800c25bf79573f650fc2b08d13046 (patch)
tree8785a2eace90c3d9af7be7743cf1b47bc07895f1 /testing
parent06b948036932abce31ee23126af9e2c91205248c (diff)
Build scripts: Add support for ninja
ninja will be recommended build tool/CMake generator for Qt due to its speed. Streamline the option parsing code and add it. Adapt the test runner to find the ctest command in the ninja build file. Change-Id: I61dd6fd4fb26a50af21432e10e7da86123240e0f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'testing')
-rw-r--r--testing/runner.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/testing/runner.py b/testing/runner.py
index 3c99df71c..baa29408c 100644
--- a/testing/runner.py
+++ b/testing/runner.py
@@ -88,21 +88,14 @@ class TestRunner(object):
os.environ['PATH'] = clang_bin_dir + os.pathsep + path
print("Adding %s as detected by %s to PATH" % (clang_bin_dir, clang_dir[1]))
- def _find_ctest(self):
+ def _find_ctest_in_file(self, file_name):
"""
- Find ctest in the Makefile
-
- We no longer use make, but the ctest command directly.
- It is convenient to look for the ctest program using the Makefile.
- This serves us two purposes:
-
- - there is no dependency of the PATH variable,
- - each project is checked whether ctest was configured.
+ Helper for _find_ctest() that finds the ctest binary in a build
+ system file (ninja, Makefile).
"""
- make_path = os.path.join(self.test_dir, "Makefile")
look_for = "--force-new-ctest-process"
line = None
- with open(make_path) as makefile:
+ with open(file_name) as makefile:
for line in makefile:
if look_for in line:
break
@@ -121,6 +114,25 @@ class TestRunner(object):
ctest = re.search(r'(\S+|"([^"]+)")\s+' + look_for, line).groups()
return ctest[1] or ctest[0]
+ def _find_ctest(self):
+ """
+ Find ctest in a build system file (ninja, Makefile)
+
+ We no longer use make, but the ctest command directly.
+ It is convenient to look for the ctest program using the Makefile.
+ This serves us two purposes:
+
+ - there is no dependency of the PATH variable,
+ - each project is checked whether ctest was configured.
+ """
+ candidate_files = ["Makefile", "build.ninja"]
+ for candidate in candidate_files:
+ path = os.path.join(self.test_dir, candidate)
+ if os.path.exists(path):
+ return self._find_ctest_in_file(path)
+ raise RuntimeError('Cannot find any of the build system files {}.'.format(
+ ', '.join(candidate_files)))
+
def _setup(self):
self.ctestCommand = self._find_ctest()