Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tesh 'expect signal' can now accept more than one potential signal
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 7 Oct 2019 19:42:36 +0000 (21:42 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 7 Oct 2019 19:47:38 +0000 (21:47 +0200)
This is mainly for MacOSX which may raise a SIGBUS on stack overflow
instead of SIGSEGV as on Linux.

ChangeLog
docs/manpages/tesh.pod
teshsuite/simix/CMakeLists.txt
teshsuite/simix/stack-overflow/stack-overflow.tesh
tools/tesh/tesh.py

index 6a4153a..24be970 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,7 +75,10 @@ XML:
    only three attributes (id, read_bw, and write_bw). All the other information
    that was declared with the storage related tags now has to be expressed as
    properties. An example of platform using this new tag is available at
-   examples/platforms/hostsè_with_disks.xml
+   examples/platforms/hosts_with_disks.xml
+
+tesh:
+ - 'expect signal' can now accept more than one potential signal.
 
 Fixed bugs (FG#.. -> framagit bugs; FG!.. -> framagit merge requests):
  - FG#28: add sg_actor_self (and other wrappers on this_actor methods)
index 0a9ef6c..259a2fe 100755 (executable)
@@ -43,7 +43,7 @@ the following list. The second char of each line is ignored.
 
  `!' metacommand, which can be one of:
      `timeout' <integer>|no
-     `expect signal' <signal name>
+     `expect signal' <signal name>[|<signal name>]*
      `expect return' <integer>
      `output' <ignore|display>
      `output sort' [integer]
index 0788f98..89801ed 100644 (file)
@@ -28,7 +28,7 @@ ENDIF()
 
 if (NOT enable_memcheck AND NOT enable_address_sanitizer AND NOT enable_thread_sanitizer)
   ADD_TESH_FACTORIES(stack-overflow   "ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simix/stack-overflow --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simix/stack-overflow stack-overflow.tesh)
-  if (WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  if (WIN32)
     SET_TESH_PROPERTIES(stack-overflow "ucontext;raw;boost" WILL_FAIL true)
   endif()
 endif()
index 11c9899..fc8a116 100644 (file)
@@ -1,4 +1,4 @@
-! expect signal SIGSEGV
+! expect signal SIGSEGV|SIGBUS
 $ ${bindir:=.}/stack-overflow --cfg=contexts/stack-size:96 ${srcdir:=.}/examples/platforms/small_platform.xml
 > [Tremblay:master:(1) 0.000000] [test/INFO] Launching our nice bugged recursive function...
 > Access violation or Bus error detected.
index f9ef1d4..2e0d94a 100755 (executable)
@@ -238,7 +238,7 @@ class Cmd(object):
         self.cwd = os.getcwd()
 
         self.ignore_output = False
-        self.expect_return = 0
+        self.expect_return = [0]
 
         self.output_display = False
 
@@ -487,7 +487,7 @@ class Cmd(object):
             print('\n'.join(logs))
             return
 
-        if proc.returncode != self.expect_return:
+        if not proc.returncode in self.expect_return:
             if proc.returncode >= 0:
                 logs.append("Test suite `{file}': NOK (<{cmd}> returned code {code})".format(
                     file=FileReader().filename, cmd=cmdName, code=proc.returncode))
@@ -648,16 +648,17 @@ if __name__ == '__main__':
             cmd.output_display = True
             cmd.ignore_output = True
         elif line[0:15] == "! expect return":
-            cmd.expect_return = int(line[16:])
+            cmd.expect_return = [int(line[16:])]
             #print("expect return "+str(int(line[16:])))
         elif line[0:15] == "! expect signal":
-            sig = line[16:]
-            # get the signal integer value from the signal module
-            if sig not in signal.__dict__:
-                fatal_error("unrecognized signal '" + sig + "'")
-            sig = int(signal.__dict__[sig])
-            # popen return -signal when a process ends with a signal
-            cmd.expect_return = -sig
+            cmd.expect_return = []
+            for sig in (line[16:]).split("|"):
+                # get the signal integer value from the signal module
+                if sig not in signal.__dict__:
+                    fatal_error("unrecognized signal '" + sig + "'")
+                sig = int(signal.__dict__[sig])
+                # popen return -signal when a process ends with a signal
+                cmd.expect_return.append(-sig)
         elif line[0:len("! timeout ")] == "! timeout ":
             if "no" in line[len("! timeout "):]:
                 cmd.timeout = None