1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/usr/bin/env perl
=pod
=head1 Tests for the globus openssl error code
Tests to exercise the error handling functionality of the globus
openssl error library.
=cut
use strict;
use Test::More;
use File::Basename;
use lib dirname($0);
$ENV{PATH} = dirname($0).":.:".$ENV{PATH};
my $test_prog = 'globus_openssl_error_test';
my $stdoutfile = dirname($0)."/$test_prog.stdout";
my @tests;
my @todo;
sub basic_func
{
my ($errors,$rc) = ("",0);
ok($rc = system("$test_prog 1>$test_prog.log.stdout 2>$test_prog.log.stderr") == 0, "run $test_prog");
ok(open(EXPECTED, "<$stdoutfile"), "Open $stdoutfile");
ok(open(LOGGED, "<$test_prog.log.stdout"), "Open $test_prog.log.stdout");
$rc = 0;
while ( my $line = <EXPECTED> )
{
my $logged = <LOGGED>;
chomp($line);
chomp($logged);
$rc++ unless ( $logged =~ /$line/ );
}
ok($rc == 0, "Match reference output");
}
sub sig_handler
{
if( -e "$test_prog.log.stdout" )
{
unlink("$test_prog.log.stdout");
}
}
$SIG{'INT'} = 'sig_handler';
$SIG{'QUIT'} = 'sig_handler';
$SIG{'KILL'} = 'sig_handler';
push(@tests, "basic_func();");
# Now that the tests are defined, set up the Test to deal with them.
plan tests => 4*scalar(@tests), todo => \@todo;
# And run them all.
foreach (@tests)
{
eval "&$_";
}
|