pjs/testing/tinderbox-standalone-tests/Tests/AliveTestReturnToken.pm

30 строки
970 B
Perl

# Same as AliveTest, but look for a token in the log and return
# the value. (used for startup iteration test).
sub AliveTestReturnToken {
my ($test_name, $build_dir, $args, $timeout_secs, $token, $delimiter) = @_;
my $status;
my $rv = 0;
# Same as in AliveTest, needs to match in order to find the log file.
my $binary = @$args[0];
my $binary_basename = File::Basename::basename($binary);
my $binary_dir = File::Basename::dirname($binary);
my $binary_log = "$build_dir/$test_name.log";
$status = AliveTest($test_name, $build_dir, $args, $timeout_secs);
# Look for and return token
if ($status) {
$rv = Util::extract_token_from_file($binary_log, $token, $delimiter);
chomp($rv);
chop($rv) if ($rv =~ /\r$/); # cygwin perl doesn't chomp dos-newlinesproperly so use chop.
if ($rv) {
print "AliveTestReturnToken: token value = $rv\n";
}
}
return $rv;
}
return 1;