[Mono.Posix] Fix signal tests to run on OS X, Android.
authorJonathan Pryor <jonpryor@vt.edu>
Thu, 24 Sep 2015 21:15:36 +0000 (17:15 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Thu, 24 Sep 2015 21:15:36 +0000 (17:15 -0400)
commit3f3df2694529b6fc3b88bf9c83c76d792ff47428
tree424531c50185c618f264dfedb0de5620f87cbd54
parentb5c06e6babbc84925c7ee1f13977ef7508fa79cf
[Mono.Posix] Fix signal tests to run on OS X, Android.

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=33558

Several of the Signal-related tests were disabled when running on OS X
because OS X doesn't provide reliable delivery: it will try to deliver
a signal, but if it's already been delivered it won't continue
delivering them. This results in failures such as:

1) MonoTests.Mono.Unix.UnixSignalTest.TestWaitAny :   Expected: 23061
  But was:  100000

(Note that "Expected" and "actual" are reversed. Oops.)

Thus, signals are delivered, just "not enough."

As It Happens™, Android is similar: running these tests on
Xamarin.Android results in test failures because not enough signals
are received. (It's not as bad as OS X -- only ~10% off -- but it's
not *all* of the signals either.)

Fix the tests so that they *don't* require that we receive as many
signals as we raise. Instead, assert that all of the UnixSignal
instances actually have a UnixSignal.Count value greater than 0, i.e.
that they've been signaled AT ALL.

Loosening up the tests in this manner allows the tests to pass on
OS X, and should allow things to work as expected on Android.
mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs