Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[tesh] kill process -> kill whole process group
[simgrid.git] / tools / tesh / tesh.py
index 1faee7f..a8d52eb 100755 (executable)
@@ -290,13 +290,13 @@ class Cmd(object):
         #print (args)
 
         try:
-            proc = subprocess.Popen(args, bufsize=1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
+            proc = subprocess.Popen(args, bufsize=1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, preexec_fn=os.setsid)
         except FileNotFoundError:
             print("["+FileReader().filename+":"+str(self.linenumber)+"] Cannot start '"+args[0]+"': File not found")
             tesh_exit(3)
         except OSError as osE:
             if osE.errno == 8:
-                osE.strerror += "\nOSError: [Errno 8] Executed scripts should start with shebang line (like #!/bin/sh)"
+                osE.strerror += "\nOSError: [Errno 8] Executed scripts should start with shebang line (like #!/usr/bin/env sh)"
             raise osE
 
         cmdName = FileReader().filename+":"+str(self.linenumber)
@@ -304,7 +304,7 @@ class Cmd(object):
             (stdout_data, stderr_data) = proc.communicate("\n".join(self.input_pipe), self.timeout)
         except subprocess.TimeoutExpired:
             print("Test suite `"+FileReader().filename+"': NOK (<"+cmdName+"> timeout after "+str(self.timeout)+" sec)")
-            proc.kill()
+            os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
             tesh_exit(3)
 
         if self.output_display:
@@ -414,6 +414,7 @@ if __name__ == '__main__':
         tesh_exit(1)
 
     if options.cd is not None:
+        print("[Tesh/INFO] change directory to " + options.cd)
         os.chdir(options.cd)
 
     if options.ignore_jenkins:
@@ -431,6 +432,7 @@ if __name__ == '__main__':
            re.compile("For details see http://code.google.com/p/address-sanitizer/issues/detail\\?id=189"),
            re.compile("For details see https://github.com/google/sanitizers/issues/189"),
            re.compile("Python runtime initialized with LC_CTYPE=C .*"),
+           re.compile("cmake: /usr/local/lib/libcurl.so.4: no version information available (required by cmake)"), # Seen on CircleCI
            ]
         TeshState().jenkins = True # This is a Jenkins build