tests: Add a RX functionality test
authorSimon Wilkinson <sxw@your-file-system.com>
Wed, 18 Apr 2012 11:46:31 +0000 (12:46 +0100)
committerDerrick Brashear <shadow@dementix.org>
Thu, 19 Apr 2012 12:07:19 +0000 (05:07 -0700)
Use the rxperf performance testing tools to add a couple of simple
RX tests. The first moves 1Mbyte of data backwards and forwards 30
times. The second starts 30 threads, which each move 1MByte of data
once.

This is by no means an exhaustive test of RX, but the single and
multi-threaded invocations should provide a useful smoke test if
things get very broken.

Change-Id: I11267be067cf6c05a20aeb90a18ed4031502a1b1
Reviewed-on: http://gerrit.openafs.org/7244
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

tests/TESTS
tests/rx/perf-t [new file with mode: 0755]

index 48ade15..82d25f2 100644 (file)
@@ -11,6 +11,7 @@ opr/rbtree
 ptserver/pt_util
 ptserver/pts-man
 rx/event
+rx/perf
 volser/vos-man
 bucoord/backup-man
 kauth/kas-man
diff --git a/tests/rx/perf-t b/tests/rx/perf-t
new file mode 100755 (executable)
index 0000000..fceec18
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests=>4;
+use POSIX "sys_wait_h";
+
+my $port = 4000;
+my $build = $ENV{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($?) != POSIX::SIGTERM) {
+    fail("Server died with signal ".WTERMSIG($?));
+} elsif (WIFEXITED($?) && WEXITSTATUS($?) != 0) {
+    fail("Server exited with code". WEXITSTATUS($?));
+} else {
+    pass("Server exited succesfully");
+}
+
+