diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2016-01-21 19:11:18 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2016-01-21 19:11:18 +0300 |
commit | 4f6d638a3f98fc89cccf37e6505b1579f8c02baf (patch) | |
tree | 4478327c76f808c970f8e7a1b86093d47a9f6eca /mcs/class/Mono.Posix | |
parent | 40b11bae27db61f82b91679800612028dd9f1244 (diff) |
[Mono.Posix] Make UnixSignalTest.TestRaiseStorm() more reliable
The test was reenabled in 3f3df2694529b6fc3b88bf9c83c76d792ff47428 and we were seeing it randomly fail
on Jenkins on OSX like that:
```
[...]
***** MonoTests.Mono.Unix.UnixSignalTest.TestNoEmitAny
***** MonoTests.Mono.Unix.UnixSignalTest.TestRaise
***** MonoTests.Mono.Unix.UnixSignalTest.TestRaiseAny
***** MonoTests.Mono.Unix.UnixSignalTest.TestRaiseStorm
/bin/sh: line 1: 40164 Hangup: 1 PATH="/Users/builder/jenkins/workspace/test-mono-mainline/label/osx-i386/runtime/_tmpinst/bin:/opt/mono/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" MONO_REGISTRY_PATH="/Users/builder/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" MONO_PATH="./../../class/lib/net_4_x::$MONO_PATH" /Users/builder/jenkins/workspace/test-mono-mainline/label/osx-i386/runtime/mono-wrapper --debug ./../../class/lib/net_4_x/nunit-console.exe Mono.Posix_test_net_4_x.dll -noshadow -labels -exclude=NotOnMac,NotWorking,ValueAdd,CAS,InetAccess -labels -xml=TestResult-net_4_x.xml
make[1]: *** [run-test-lib] Error 1
make[1]: Leaving directory `/Users/builder/jenkins/workspace/test-mono-mainline/label/osx-i386/mcs/class/Mono.Posix'
make: *** [do-run-test] Error 1
```
The problem is that (especially on OSX it seems) the signals raised by the threads in the test can be
delivered after we closed the UnixSignal, which means the default behavior of terminating the program kicks in.
The simplest fix is to just sleep for some time to make sure the signal is delivered and ignored before closing.
Diffstat (limited to 'mcs/class/Mono.Posix')
-rw-r--r-- | mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs b/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs index d621ad51d45..9abc27094c9 100644 --- a/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs +++ b/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs @@ -424,6 +424,10 @@ namespace MonoTests.Mono.Unix { foreach (Thread t in threads) t.Join (); AssertCountSet (usignals); + // signal delivery might take some time, wait a bit before closing + // the UnixSignal so we can ignore it and not terminate the process + // when a SIGHUP/SIGTERM arrives afterwards + Thread.Sleep (1000); CloseSignals (usignals); } |