From 862f61d93ba201ca4e2687e71f0e169dbd1fd3b6 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 5 Feb 2014 13:22:27 +0100 Subject: [PATCH] Fix the vm-test runner's error handling --- test/jenkins/files/utils.py | 11 ++++++++--- test/jenkins/run_tests.py | 14 +++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/test/jenkins/files/utils.py b/test/jenkins/files/utils.py index 65066df05..6dcbb4242 100644 --- a/test/jenkins/files/utils.py +++ b/test/jenkins/files/utils.py @@ -117,9 +117,14 @@ class LiveStatusSocket(object): while not self._connected and time.time() - start < timeout: try: self.connect() - except socket.error, error: - if error.errno != 111: - raise + except socket.error: + # Icinga2 does some "magic" with the socket during startup + # which causes random errors being raised (EACCES, ENOENT, ..) + # so we just ignore them until the timeout is reached + time.sleep(1) + if not self._connected: + # Raise the very last exception once the timeout is reached + raise def close(self): if self._connected: diff --git a/test/jenkins/run_tests.py b/test/jenkins/run_tests.py index 1780638c7..a0e9121e0 100755 --- a/test/jenkins/run_tests.py +++ b/test/jenkins/run_tests.py @@ -85,15 +85,23 @@ class TestSuite(object): def _remove_file(self, path): command = self._config['commands']['clean'].format(path) - subprocess.call(command, stdout=DEVNULL, shell=True) + rc = subprocess.call(command, stdout=DEVNULL, shell=True) + if rc != 0: + print 'WARNING: Cannot remove file "{0}" ({1})'.format(path, rc) def _exec_command(self, command): command = self._config['commands']['exec'].format(command) - subprocess.call(command, stdout=DEVNULL, shell=True) + rc = subprocess.call(command, stdout=DEVNULL, shell=True) + if rc != 0: + print 'WARNING: Command "{0}" exited with exit code "{1}"' \ + ''.format(command, rc) def _copy_file(self, source, destination): command = self._config['commands']['copy'].format(source, destination) - subprocess.call(command, stdout=DEVNULL, shell=True) + rc = subprocess.call(command, stdout=DEVNULL, shell=True) + if rc != 0: + print 'WARNING: Cannot copy file "{0}" to "{1}" ({2})' \ + ''.format(source, destination, rc) def _copy_test(self, path): self._copy_file(path, os.path.join(self._config['settings']['test_root'],