Files
mosh/src/tests/print-exitstatus
T
John Hood 477729b315 tests: improve robustness
Replace some blind timeouts with actual synchronization.
Improve performance on some slow tests.
Tweak some of the remaining timeouts.

This still isn't good enough to get 'make -j9 check'
working reliably on Cygwin for me; I think some Cygwin/
Windows scheduling issues remain.
2016-09-20 06:25:43 -04:00

34 lines
603 B
Perl
Executable File

#!/usr/bin/env perl
#
# Print exitstatus on stderr.
#
use warnings;
use strict;
my $rc = system(@ARGV);
if ($? == -1) {
die "system failed: %!\n";
}
if ($? == 0) {
$rc = 0;
} elsif ($? >= 256) {
$rc = $? >> 8;
} else {
$rc = ($? & 127) | 128;
}
print STDERR "@@@ exitstatus: ${rc} @@@\n";
# Now look for it in log file.
my $grepfilename = $ENV{'MOSH_E2E_TEST'} . ".tmux.log";
for my $i (1..600) {
open(my $grepfile, "<", $grepfilename) or die;
while (<$grepfile>) {
chomp;
/@@@ exitstatus: .* @@@/ && goto gotit;
}
close($grepfile);
sleep .1;
}
gotit:
exit $rc;