bodo-hugo-barwich / Process

Perl Module for Multiprocessing
Other
1 stars 2 forks source link

Adapting Automated Tests for perl 5.10 #17

Closed domibay-hugo closed 4 years ago

domibay-hugo commented 4 years ago

As the Issue #15 comes to show the failed Tests are due to an different Behaviour of the Perl open3() implementation. So adapting the Tests is the only way to build a Workaround to be able to still check the library correctness reliably. The adapted Automated Tests run now correctly in perl 5.10:

$ /usr/share/doc/perl-Process-SubProcess/tests/test_subprocess.t
ok 1 - require Process::SubProcess;
Test: 'runSubProcess() Function' do ...
ex 0 (28340): ''
sys err 2 [29]: 'Illegal seek'
ok 2 - STDOUT Ref is returned
ok 3 - STDERR Ref is returned
ok 4 - EXIT CODE is returned
ok 5 - EXIT CODE is numeric
ok 6 - EXIT CODE is correct
EXIT CODE: '4'
ok 7 - STDOUT was captured
STDOUT: 'Start - Time Now: '1601633378.82676' s
script 'test_script.pl' START 0
script 'test_script.pl' PAUSE '3' ...
script 'test_script.pl' END 1
End - Time Now: '1601633381.827' s
script 'test_script.pl' done in '3000.2429485321' ms
script 'test_script.pl' EXIT '4'
'
ok 8 - STDERR was captured
STDERR: 'script 'test_script.pl' START 0 ERROR
script 'test_script.pl' END 1 ERROR
'

Test: 'Read Timeout' do ...
ok 9 - Read Timeout is set
ok 10 - Profiling enabled
ex 0 (28391): ''
sys err 2 [29]: 'Illegal seek'
ok 11 - script 'test_script.pl': Launch succeed
ok 12 - script 'test_script.pl': Execution finished correctly
ok 13 - Measured Time is smaller than the Read Timeout
Execution Time: '3.016486'
EXIT CODE: '0'
STDOUT: 'Start - Time Now: '1601633381.84474' s
script 'test_script.pl' START 0
script 'test_script.pl' PAUSE '3' ...
script 'test_script.pl' END 1
End - Time Now: '1601633384.84498' s
script 'test_script.pl' done in '3000.23913383484' ms
script 'test_script.pl' EXIT '0'
'
STDERR: 'script 'test_script.pl' START 0 ERROR
script 'test_script.pl' END 1 ERROR
'

Test: 'Execution Timeout' do ...
ok 14 - Execution Timeout is set
ex 0 (28600): ''
sys err 2 [29]: 'Illegal seek'
ok 15 - script 'test_script.pl': Launch succeed
ok 16 - script 'test_script.pl': Execution failed as expected
ok 17 - ERROR CODE '4' is correct
ok 18 - EXIT CODE is correct
ERROR CODE: '4'
EXIT CODE: '-1'
ok 19 - STDOUT was captured
STDOUT: ''
ok 20 - STDERR was captured
ok 21 - STDERR has Execution Timeout
STDERR: 'script 'test_script.pl' START 0 ERROR
Sub Process (28600) : Execution timed out!
Execution Time '2 / 2'
Process will be terminated.
Sub Process (28600) : Process terminating ...
'

Test: 'Script not found' do ...
ex 0 (28601): ''
sys err 2 [29]: 'Illegal seek'
ok 22 - script 'no_script.sh': Execution is correct
ok 23 - ERROR CODE '1' is correct
ok 24 - EXIT CODE '255' is correct
ERROR CODE: '1'
EXIT CODE: '255'
ok 25 - STDOUT was captured
STDOUT: ''
ok 26 - STDERR was captured
ok 27 - STDERR has open3() Error
STDERR: 'open3: exec of /usr/share/doc/perl-Process-SubProcess/tests/no_script.sh failed at /usr/share/perl5/vendor_perl/Process/SubProcess.pm line 473
'

Test: 'No Permission' do ...
ex 0 (28602): ''
sys err 2 [29]: 'Illegal seek'
ok 28 - script 'noexec_script.pl': Execution is correct
ok 29 - ERROR CODE '1' is correct
ok 30 - EXIT CODE '255' is correct
ok 31 - STDOUT was captured
STDOUT: ''
ok 32 - STDERR was captured
ok 33 - STDERR has open3() Error
STDERR: 'open3: exec of /usr/share/doc/perl-Process-SubProcess/tests/noexec_script.pl failed at /usr/share/perl5/vendor_perl/Process/SubProcess.pm line 473
'

Test: 'Sub Process Bash Error' do ...
ex 0 (28603): ''
sys err 2 [29]: 'Illegal seek'
ok 34 - script 'nobashbang_script.pl': Launch succeed
ok 35 - script 'nobashbang_script.pl': Execution finished correctly
ok 36 - ERROR CODE '1' is correct
ok 37 - EXIT CODE '2' is correct
ok 38 - STDERR Ref is returned
ok 39 - STDERR has Bash Error
STDERR: '/usr/share/doc/perl-Process-SubProcess/tests/nobashbang_script.pl: line 1: !#/usr/bin/perl: No such file or directory
/usr/share/doc/perl-Process-SubProcess/tests/nobashbang_script.pl: line 3: syntax error near unexpected token `'script died.''
/usr/share/doc/perl-Process-SubProcess/tests/nobashbang_script.pl: line 3: `die('script died.');'
'

Test: 'Sub Process Perl Exception' do ...
ex 0 (28605): ''
sys err 2 [29]: 'Illegal seek'
ok 40 - script 'exception_script.pl': Launch succeed
ok 41 - script 'exception_script.pl': Execution finished correctly
ok 42 - ERROR CODE '1' is correct
ok 43 - EXIT CODE '255' is correct
ok 44 - STDERR Ref is returned
ok 45 - STDERR has Perl Exception
STDERR: 'script died. at /usr/share/doc/perl-Process-SubProcess/tests/exception_script.pl line 3.
'

1..45