From 5b4dbc7eddf916bacacb0eba2708e1b6a6999825 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 7 Oct 2019 21:42:36 +0200 Subject: [PATCH] tesh 'expect signal' can now accept more than one potential signal This is mainly for MacOSX which may raise a SIGBUS on stack overflow instead of SIGSEGV as on Linux. --- ChangeLog | 5 ++++- docs/manpages/tesh.pod | 2 +- teshsuite/simix/CMakeLists.txt | 2 +- .../simix/stack-overflow/stack-overflow.tesh | 2 +- tools/tesh/tesh.py | 21 ++++++++++--------- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a4153af20..24be970813 100644 --- 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) diff --git a/docs/manpages/tesh.pod b/docs/manpages/tesh.pod index 0a9ef6ce97..259a2fe72f 100755 --- a/docs/manpages/tesh.pod +++ b/docs/manpages/tesh.pod @@ -43,7 +43,7 @@ the following list. The second char of each line is ignored. `!' metacommand, which can be one of: `timeout' |no - `expect signal' + `expect signal' [|]* `expect return' `output' `output sort' [integer] diff --git a/teshsuite/simix/CMakeLists.txt b/teshsuite/simix/CMakeLists.txt index 0788f98aff..89801ed6f7 100644 --- a/teshsuite/simix/CMakeLists.txt +++ b/teshsuite/simix/CMakeLists.txt @@ -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() diff --git a/teshsuite/simix/stack-overflow/stack-overflow.tesh b/teshsuite/simix/stack-overflow/stack-overflow.tesh index 11c9899b7d..fc8a1168a6 100644 --- a/teshsuite/simix/stack-overflow/stack-overflow.tesh +++ b/teshsuite/simix/stack-overflow/stack-overflow.tesh @@ -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. diff --git a/tools/tesh/tesh.py b/tools/tesh/tesh.py index f9ef1d4775..2e0d94a37d 100755 --- a/tools/tesh/tesh.py +++ b/tools/tesh/tesh.py @@ -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 -- 2.20.1