diff options
Diffstat (limited to 'share/perl/test/OpenSimTest.pm')
-rw-r--r-- | share/perl/test/OpenSimTest.pm | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/share/perl/test/OpenSimTest.pm b/share/perl/test/OpenSimTest.pm new file mode 100644 index 0000000..a24ae22 --- /dev/null +++ b/share/perl/test/OpenSimTest.pm | |||
@@ -0,0 +1,53 @@ | |||
1 | package OpenSimTest; | ||
2 | |||
3 | use strict; | ||
4 | use PerformanceTest; | ||
5 | use OpenSimTest::Config; | ||
6 | use OpenSimTest::UserTester; | ||
7 | use OpenSimTest::GridTester; | ||
8 | use OpenSimTest::AssetTester; | ||
9 | use OpenSimTest::InventoryTester; | ||
10 | |||
11 | sub init { | ||
12 | UserTester::init(); | ||
13 | GridTester::init(); | ||
14 | AssetTester::init(); | ||
15 | InventoryTester::init(); | ||
16 | } | ||
17 | |||
18 | sub SingleTest { | ||
19 | my $url = shift; | ||
20 | my $methodname = shift; | ||
21 | my @ARGS = @_; | ||
22 | |||
23 | if (!$OpenSimTest::Config::HANDLER_LIST{$methodname}) { | ||
24 | Carp::croak("unknown handler name: [$methodname]"); | ||
25 | } else { | ||
26 | my $handler = $OpenSimTest::Config::HANDLER_LIST{$methodname}; | ||
27 | my $result = $handler->($url, @ARGS); | ||
28 | return $result; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | sub PerformanceCompare { | ||
33 | my $server_name = shift; | ||
34 | my $count = shift; | ||
35 | my @args = @_; | ||
36 | my $test = new PerformanceTest(); | ||
37 | { | ||
38 | my @params = @args; | ||
39 | unshift(@params, $OpenSimTest::Config::APACHE_SERVERS{$server_name}); | ||
40 | $test->add_test("APACHE::$args[0]", \&OpenSimTest::SingleTest, \@params); | ||
41 | } | ||
42 | { | ||
43 | my @params = @args; | ||
44 | unshift(@params, $OpenSimTest::Config::OPENSIM_SERVERS{$server_name}); | ||
45 | $test->add_test("OPENSIM::$args[0]", \&OpenSimTest::SingleTest, \@params); | ||
46 | } | ||
47 | $test->set_count($count); | ||
48 | $test->start(); | ||
49 | print "\n\n"; | ||
50 | #$test->bref_result(); | ||
51 | } | ||
52 | |||
53 | 1; | ||