diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-06-30 15:38:55 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-07-03 02:07:59 +0000 |
commit | 063366eb23a81ea2d4079d291a2ff534acf75d2d (patch) | |
tree | 679918ee285e5da4664b5a5f6bb468fba3537a9b /test/framework.py | |
parent | 6898e5cb89fcd40837e3ee8a1a5cbd0218474b12 (diff) |
tests: Have worker return immediately on bad executable
No reason to waste CI cycles if we know the test will not run.
See:
17:55:11 ==============================================================================
17:55:11 VPP Object Model Test
17:55:11 ==============================================================================
17:55:11 Exception in thread Thread-4:
17:55:11 Traceback (most recent call last):
17:55:11 File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
17:55:11 self.run()
17:55:11 File "/w/workspace/vpp-beta-verify-master-ubuntu1804/test/framework.py", line 1475, in run
17:55:11 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
17:55:11 File "/w/workspace/vpp-beta-verify-master-ubuntu1804/test/run/venv/local/lib/python2.7/site-packages/subprocess32.py", line 617, in __init__
17:55:11 restore_signals, start_new_session)
17:55:11 File "/w/workspace/vpp-beta-verify-master-ubuntu1804/test/run/venv/local/lib/python2.7/site-packages/subprocess32.py", line 1415, in _execute_child
17:55:11 raise child_exception_type(errno_num, err_msg)
17:55:11 OSError: [Errno 2] No such file or directory: '/w/workspace/vpp-beta-verify-master-ubuntu1804/test/build/vom_test/vom_test'
17:55:11
17:55:11 17:55:11,328 Timeout! Worker did not finish in 120s
17:55:11 run C++ VOM tests ERROR [ temp dir used by test case: /tmp/vpp-unittest-VOMTestCase-vpMcWF ]
17:55:11
Type: fix
Change-Id: I3d8252807e98a09a8abd70de8a22517151f9d786
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r-- | test/framework.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/framework.py b/test/framework.py index aedfbdf8e52..4bc64a1331b 100644 --- a/test/framework.py +++ b/test/framework.py @@ -1457,15 +1457,24 @@ class VppTestRunner(unittest.TextTestRunner): class Worker(Thread): - def __init__(self, args, logger, env={}): + def __init__(self, args, logger, env=None): self.logger = logger self.args = args + self.process = None self.result = None + env = {} if env is None else env self.env = copy.deepcopy(env) super(Worker, self).__init__() def run(self): executable = self.args[0] + if not os.path.exists(executable) or not os.access( + executable, os.F_OK | os.X_OK): + # Exit code that means some system file did not exist, + # could not be opened, or had some other kind of error. + self.result = os.EX_OSFILE + raise EnvironmentError( + "executable '%s' is not found or executable." % executable) self.logger.debug("Running executable w/args `%s'" % self.args) env = os.environ.copy() env.update(self.env) |