aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-03-29 21:48:09 +0300
committerGitHub <noreply@github.com>2018-03-29 21:48:09 +0300
commitbe3387d937addd30b3aa1ec0639bba419ceee477 (patch)
treecd5b9e75f5309311ac1da6d6d1db9b613120f6b4 /run_unittests.py
parent37d379ebe5ebf935297fe18478dfa311afa64d24 (diff)
parentddc6f72507a19c32b34f560c5f2b8c07a80682e7 (diff)
downloadmeson-be3387d937addd30b3aa1ec0639bba419ceee477.zip
meson-be3387d937addd30b3aa1ec0639bba419ceee477.tar.gz
meson-be3387d937addd30b3aa1ec0639bba419ceee477.tar.bz2
Merge pull request #3322 from sarum9in/run_timeout
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 6ab549c..96a98eb 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -524,16 +524,18 @@ class BasePlatformTests(unittest.TestCase):
Run a command while printing the stdout and stderr to stdout,
and also return a copy of it
'''
- p = subprocess.Popen(command, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, env=os.environ.copy(),
- universal_newlines=True, cwd=workdir)
- output = p.communicate()[0]
- print(output)
+ # If this call hangs CI will just abort. It is very hard to distinguish
+ # between CI issue and test bug in that case. Set timeout and fail loud
+ # instead.
+ p = subprocess.run(command, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, env=os.environ.copy(),
+ universal_newlines=True, cwd=workdir, timeout=60 * 5)
+ print(p.stdout)
if p.returncode != 0:
- if 'MESON_SKIP_TEST' in output:
+ if 'MESON_SKIP_TEST' in p.stdout:
raise unittest.SkipTest('Project requested skipping.')
raise subprocess.CalledProcessError(p.returncode, command)
- return output
+ return p.stdout
def init(self, srcdir, extra_args=None, default_args=True, inprocess=False):
self.assertPathExists(srcdir)