OpenSimTest.pm 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package OpenSimTest;
  2. use strict;
  3. use PerformanceTest;
  4. use OpenSimTest::Config;
  5. use OpenSimTest::UserTester;
  6. use OpenSimTest::GridTester;
  7. use OpenSimTest::AssetTester;
  8. use OpenSimTest::InventoryTester;
  9. sub init {
  10. UserTester::init();
  11. GridTester::init();
  12. AssetTester::init();
  13. InventoryTester::init();
  14. }
  15. sub SingleTest {
  16. my $url = shift;
  17. my $methodname = shift;
  18. my @ARGS = @_;
  19. if (!$OpenSimTest::Config::HANDLER_LIST{$methodname}) {
  20. Carp::croak("unknown handler name: [$methodname]");
  21. } else {
  22. my $handler = $OpenSimTest::Config::HANDLER_LIST{$methodname};
  23. my $result = $handler->($url, @ARGS);
  24. return $result;
  25. }
  26. }
  27. sub PerformanceCompare {
  28. my $server_name = shift;
  29. my $count = shift;
  30. my @args = @_;
  31. my $test = new PerformanceTest();
  32. {
  33. my @params = @args;
  34. unshift(@params, $OpenSimTest::Config::APACHE_SERVERS{$server_name});
  35. $test->add_test("APACHE::$args[0]", \&OpenSimTest::SingleTest, \@params);
  36. }
  37. {
  38. my @params = @args;
  39. unshift(@params, $OpenSimTest::Config::OPENSIM_SERVERS{$server_name});
  40. $test->add_test("OPENSIM::$args[0]", \&OpenSimTest::SingleTest, \@params);
  41. }
  42. $test->set_count($count);
  43. $test->start();
  44. print "\n\n";
  45. #$test->bref_result();
  46. }
  47. 1;