Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update ASan suppressions for clang.
[simgrid.git] / tools / tesh / tesh.py
index 72ed1e4..a51dac8 100755 (executable)
@@ -5,7 +5,7 @@
 tesh -- testing shell
 ========================
 
-Copyright (c) 2012-2020. The SimGrid Team. All rights reserved.
+Copyright (c) 2012-2021. The SimGrid Team. All rights reserved.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the license (GNU LGPL) which comes with this package.
@@ -95,14 +95,6 @@ def setenv(arg):
 def expandvars2(path):
     return re.sub(r'(?<!\\)\$[A-Za-z_][A-Za-z0-9_]*', '', os.path.expandvars(path))
 
-
-# https://github.com/Cadair/jupyter_environment_kernels/issues/10
-try:
-    FileNotFoundError
-except NameError:
-    # py2
-    FileNotFoundError = OSError
-
 ##############
 #
 # Cleanup on signal
@@ -286,17 +278,16 @@ class Cmd(object):
     # Return False if nothing has been ran.
 
     def run_if_possible(self):
-        if self.can_run():
-            if self.background:
-                lock = _thread.allocate_lock()
-                lock.acquire()
-                TeshState().add_thread(lock)
-                _thread.start_new_thread(Cmd._run, (self, lock))
-            else:
-                self._run()
-            return True
-        else:
+        if not self.can_run():
             return False
+        if self.background:
+            lock = _thread.allocate_lock()
+            lock.acquire()
+            TeshState().add_thread(lock)
+            _thread.start_new_thread(Cmd._run, (self, lock))
+        else:
+            self._run()
+        return True
 
     def _run(self, lock=None):
         # Python threads loose the cwd
@@ -490,15 +481,15 @@ class Cmd(object):
                 return_code = max(2, return_code)
                 print('\n'.join(logs))
                 return
-            else:
-                logs.append("Test suite `{file}': NOK (<{cmd}> got signal {sig})".format(
-                    file=FileReader().filename, cmd=cmdName,
-                    sig=SIGNALS_TO_NAMES_DICT[-proc.returncode]))
-                if lock is not None:
-                    lock.release()
-                return_code = max(max(-proc.returncode, 1), return_code)
-                print('\n'.join(logs))
-                return
+
+            logs.append("Test suite `{file}': NOK (<{cmd}> got signal {sig})".format(
+                file=FileReader().filename, cmd=cmdName,
+                sig=SIGNALS_TO_NAMES_DICT[-proc.returncode]))
+            if lock is not None:
+                lock.release()
+            return_code = max(max(-proc.returncode, 1), return_code)
+            print('\n'.join(logs))
+            return
 
         if lock is not None:
             lock.release()
@@ -554,7 +545,7 @@ if __name__ == '__main__':
             re.compile(r"Picked up JAVA_TOOL_OPTIONS: "),
             re.compile(r"Picked up _JAVA_OPTIONS: "),
             re.compile(r"==[0-9]+== ?WARNING: ASan doesn't fully support"),
-            re.compile(r"==[0-9]+== ?WARNING: ASan is ignoring requested __asan_handle_no_return: stack top:"),
+            re.compile(r"==[0-9]+== ?WARNING: ASan is ignoring requested __asan_handle_no_return: stack "),
             re.compile(r"False positive error reports may follow"),
             re.compile(r"For details see http://code\.google\.com/p/address-sanitizer/issues/detail\?id=189"),
             re.compile(r"For details see https://github\.com/google/sanitizers/issues/189"),