aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/test/OpenSimTest.pm
blob: a24ae22860baeb2096df9a56be8afae250299dbb (plain)
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
package OpenSimTest;

use strict;
use PerformanceTest;
use OpenSimTest::Config;
use OpenSimTest::UserTester;
use OpenSimTest::GridTester;
use OpenSimTest::AssetTester;
use OpenSimTest::InventoryTester;

sub init {
	UserTester::init();
	GridTester::init();
	AssetTester::init();
	InventoryTester::init();
}

sub SingleTest {
	my $url = shift;
	my $methodname = shift;
	my @ARGS = @_;

	if (!$OpenSimTest::Config::HANDLER_LIST{$methodname}) {
	    Carp::croak("unknown handler name: [$methodname]");
	} else {
	    my $handler = $OpenSimTest::Config::HANDLER_LIST{$methodname};
	    my $result = $handler->($url, @ARGS);
		return $result;
	}
}

sub PerformanceCompare {
	my $server_name = shift;
	my $count = shift;
	my @args = @_;
	my $test = new PerformanceTest();
	{
		my @params = @args;
		unshift(@params, $OpenSimTest::Config::APACHE_SERVERS{$server_name});
		$test->add_test("APACHE::$args[0]", \&OpenSimTest::SingleTest, \@params);
	}
	{
		my @params = @args;
		unshift(@params, $OpenSimTest::Config::OPENSIM_SERVERS{$server_name});
		$test->add_test("OPENSIM::$args[0]", \&OpenSimTest::SingleTest, \@params);
	}
	$test->set_count($count);
	$test->start();
	print "\n\n";
	#$test->bref_result();
}

1;