From: Mark Wooding Date: Fri, 20 Jan 2012 01:23:41 +0000 (+0000) Subject: server/tests.at: Work around strace's attempt to overwrite core files. X-Git-Tag: 1.0.0pre11~43 X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/commitdiff_plain/96f1fb578dec42612157bbf55253c85ac4793073 server/tests.at: Work around strace's attempt to overwrite core files. When strace sees its child process die from a signal, it sends itself the same signal in order to propagate the exit status accurately. Unfortunately, if the child process left a core dump, it gets overwritten by a useless core dump showing how strace committed suicide. Work around this by running strace in a subdirectory and getting the child process to run back in the parent. Also see Debian bug #656389. --- diff --git a/server/tests.at b/server/tests.at index 4fcd9cd2..188d6504 100644 --- a/server/tests.at +++ b/server/tests.at @@ -70,11 +70,19 @@ while test ! -r $1/server-status && test ! -S $1/admin; do :; done ## Test body... $3 -## End of the test, now run the server. +## End of the test, now run the server. There's an awful hack here. If a +## process running under strace exits with a signal, then strace will kill +## itself with the same signal -- and therefore clobber the original +## process's core file. So we arrange to run strace in one directory and +## have the child process run in another. ) && :; } | { cd $1 + mkdir -p strace-hack/ echo TRIPE $2 >&2 - strace -f -o tripe.trace TRIPE $2 >server-output 2>server-errors + (cd strace-hack/ + ulimit -c hard >/dev/null 2>&1 + strace -f -o ../tripe.trace \ + TRIPE -d.. $2 >../server-output 2>../server-errors) stat=$? echo $stat >server-status if test $stat -ne 0; then