aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-06-09 13:00:20 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-06-09 20:21:01 +0530
commit3a33a8ef49227c2fce1c0c7143e5529b4208d04e (patch)
tree6dfa901a39b608389214ba5a6a8765f9f428fbda /run_tests.py
parented6a5abee853ed5e4d8c1826b17a0dc29843cd6a (diff)
downloadmeson-3a33a8ef49227c2fce1c0c7143e5529b4208d04e.zip
meson-3a33a8ef49227c2fce1c0c7143e5529b4208d04e.tar.gz
meson-3a33a8ef49227c2fce1c0c7143e5529b4208d04e.tar.bz2
unit tests: Add class to generate failing tests
It is not feasible to test all failure modes by creating projects in `test cases/failing` that would be an explosion of files, and that mechanism is too coarse anyway. We have no way to ensure that the expected error is being raised. See FailureTests.test_dependency for an example.
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/run_tests.py b/run_tests.py
index 1e70784..1549979 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -22,7 +22,9 @@ import subprocess
import tempfile
import platform
from mesonbuild import mesonlib
+from mesonbuild import mesonmain
from mesonbuild.environment import detect_ninja
+from io import StringIO
from enum import Enum
from glob import glob
@@ -118,6 +120,18 @@ def get_fake_options(prefix):
def should_run_linux_cross_tests():
return shutil.which('arm-linux-gnueabihf-gcc-6') and not platform.machine().startswith('arm')
+def run_configure_inprocess(commandlist):
+ old_stdout = sys.stdout
+ sys.stdout = mystdout = StringIO()
+ old_stderr = sys.stderr
+ sys.stderr = mystderr = StringIO()
+ try:
+ returncode = mesonmain.run(commandlist[0], commandlist[1:])
+ finally:
+ sys.stdout = old_stdout
+ sys.stderr = old_stderr
+ return returncode, mystdout.getvalue(), mystderr.getvalue()
+
class FakeEnvironment(object):
def __init__(self):
self.cross_info = None
@@ -164,7 +178,7 @@ if __name__ == '__main__':
os.environ.pop('platform')
# Run tests
print('Running unittests.\n')
- units = ['InternalTests', 'AllPlatformTests']
+ units = ['InternalTests', 'AllPlatformTests', 'FailureTests']
if mesonlib.is_linux():
units += ['LinuxlikeTests']
if should_run_linux_cross_tests():