openafs/tests/rx/perf-t
Michael Meffie 624219a1b2 tests: Accommodate c-tap-harness 4.7
The SOURCE and BUILD environment variables have been changed to
C_TAP_SOURCE and C_TAP_BUILD in the new version of c-tap-harness.  The
runtests command syntax has changed as well.

Convert all of the old SOURCE and BUILD environment variables to the new
C_TAP_SOURCE and C_TAP_BUILD names.

Add the required -l command line option to specify the test list.

Add the new runtests -v option to run the tests in verbose mode to make
it easier to see which tests failed.

Change-Id: I209a6dc13d6cd1507519234fce1564fc4641e70b
Reviewed-on: https://gerrit.openafs.org/14295
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2020-08-20 22:36:56 -04:00

49 lines
1.2 KiB
Perl
Executable File

#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests=>4;
use POSIX qw(:sys_wait_h :signal_h);
my $port = 4000;
my $build = $ENV{C_TAP_BUILD};
$build = ".." if (!defined($build));
my $rxperf = $build."/../src/tools/rxperf/rxperf";
# Start up an rxperf server
my $pid = fork();
if ($pid == -1) {
fail("Failed to fork rxperf server");
exit(1);
} elsif ($pid == 0) {
exec({$rxperf}
"rxperf", "server", "-p", $port, "-u", "1024", "-H", "-N");
die("Kabooom ?");
}
pass("Started rxperf server");
# Start up an rxperf client, and run a test
is(0,
system("$rxperf client -c rpc -p $port -S 1048576 -R 1048576 -T 30 -u 1024 -H -N"),
"single threaded client ran successfully");
is (0,
system("$rxperf client -c rpc -p $port -S 1048576 -R 1048576 -T 1 -t 30 -u 1024 -H -N"),
"multi threaded client ran succesfully");
# Kill the server, and check its exit code
kill("TERM", $pid);
waitpid($pid, 0);
if (WIFSIGNALED($?) && WTERMSIG($?) != SIGTERM) {
fail("Server died with signal ".WTERMSIG($?));
} elsif (WIFEXITED($?) && WEXITSTATUS($?) != 0) {
fail("Server exited with code". WEXITSTATUS($?));
} else {
pass("Server exited succesfully");
}