openSUSE / Mojo-IOLoop-ReadWriteProcess

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

Fix sporadic test failures introduced by fb9bc63 #7

Closed okurz closed 4 years ago

okurz commented 4 years ago

As fb9bc63 deleted the internal timeout within the "stop()" method some tests need to be adjusted to prevent sporadic test failures same as already done in fb9bc63 for another test. The fix is done using the same approach, i.e. adding a sleep 1 to give a chance to the subprocesses to print some output.

Verified with 10/10 successful local test runs.

okurz commented 4 years ago

that was fast :) Thank you. Later I will also try a better approach than "sleep 1".

okurz commented 4 years ago

I saw https://travis-ci.org/mudler/Mojo-IOLoop-ReadWriteProcess failing on master sporadically some days ago. We haven't seen this in tests for this PR because this seems to happen only seldomly. I am trying to reproduce and fix this locally but probably I could benefit from your help :)

E.g. I found in https://travis-ci.org/github/mudler/Mojo-IOLoop-ReadWriteProcess/jobs/663007239#L593

    #   Failed test 'Still able to get stdout output, always in getline()'
    #   at t/01_run.t line 190.
    #          got: undef
    #     expected: 'TEST normal print
    # '

and could reproduce it in 2/20 cases. To my understanding – please correct me if I am wrong – $p->getline is called but maybe the process has not yet finished writing to stdout and $p->getline most likely does not wait for it. I don't want to fix that with yet another sleep 1. Should we use IO::Select or a loop with smaller sleep periods or yet another suggestion?