openSUSE / Mojo-IOLoop-ReadWriteProcess

Execute external programs or internal code blocks as separate process
Other
10 stars 13 forks source link

Fix sporadic 01_run.t failure -- "process is still running" #41

Closed cfconrad closed 2 years ago

cfconrad commented 2 years ago

We encountered flaky 01_run.t tests with the error looks like:

 #   Failed test 'process is still running'
 #   at t/01_run.t line 235.
 #          got: '0'
 #     expected: '1'
 # Looks like you failed 1 test of 38.

 #   Failed test 'process execute()'
 #   at t/01_run.t line 302.

It occurs in one out of ~300 runs. This fix assume, that we actually send the SIGTERM before the executed script term_trap.sh has setup it's traphandler to ignore such signal.

The fix just listen on STDOUT of the script to get informed, once the sighandlers are setted and then continue.

A sleep would be ok as well, but it's harder to judge how long is a good sleep :).

cfconrad commented 2 years ago

Related to https://github.com/openSUSE/Mojo-IOLoop-ReadWriteProcess/issues/40 With this change, I have 1400 successful runs.

okurz commented 2 years ago

I have seen the update and all checks passed, congrats :) But, still, could you please ensure to run tests locally with coverage analysis enabled for verification?

cfconrad commented 2 years ago

Done with 1479 iterations...

okurz commented 2 years ago

Done with 1479 iterations...

Could you please state what command you used for that so that coverage analysis is enabled?

cfconrad commented 2 years ago
#!/bin/bash -e
count=0;
perl Build.PL

while true; do
    count=$(($count + 1 ));
    echo "LOOP $count";
    TEST_SHARED=1 TEST_SUBREAPER=1 cover -test -report codecovbash
done

And this patch

diff --git a/Build.PL b/Build.PL
index ad9d29b..92f7a60 100644
--- a/Build.PL
+++ b/Build.PL
@@ -48,8 +48,9 @@ my %args = (
     script_files => [glob('script/*'), glob('bin/*')],
     PL_files => {},

-    test_files           => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
+    test_files           => 't/01_run.t',
     recursive_test_files => 1,
+    verbose => 1,

 );