tests: Speed up the file test and make it more reliable

Philip Withnall requested to merge pwithnall/glib:fix-file-test into master

Sometimes this test was timing out due to the file monitor notifications taking longer than the arbitrary 2s delay before ending the test and checking its results at the end of iclosed_cb().

Avoid that timing-dependence by ending the test when the expected file monitor notifications are seen, or after a 10s timeout (if so, the test is failed).

This makes the test run 4× faster in the normal case, as it’s no longer waiting for a timeout to elapse if the file monitor notifications come in sooner.

Signed-off-by: Philip Withnall withnall@endlessm.com

Merge request reports