Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the use of logs in unit testing of parmap to fix supernovae
[simgrid.git] / tools / tesh2 / examples / catch-signal.tesh
1 #! ./tesh
2 # This suite builds and uses a program raising a segfault, ie a program dying
3 # of SIGSEV. tesh must detect this condition and report the issue.
4
5 $ rm -rf temp_testdir
6 $ mkdir temp_testdir
7
8 $ cd temp_testdir
9 < #include <stdlib.h>
10 < int main(void) {
11 <   char *A=NULL;
12 <   *A = 1;
13 < }
14 $ cat > segfault.c
15
16 $ gcc -o segfault segfault.c
17
18 ! expect return $EUNXPSIG
19 < $ ./segfault
20 $ tesh --log="log.thresh:info tesh.fmt:%m%n"
21 > Test unit from stdin
22 > [stdin:1] ./segfault
23 > [stdin:1] `./segfault' : NOK (unexpected signal `SIGSEGV' caught)
24 > Output of <stdin:1> so far: 
25 > ||
26 > Test unit `stdin': NOK (<stdin:1> unexpected signal caught)
27
28 $ cd ..
29 $ rm -rf temp_testdir