Commit 0e1c5761 authored by Kevin Tew's avatar Kevin Tew

testsuite/testswap more docs and simplification

parent f246595d
TO INSTALL REQUIREMENTS
ssh-agent running with SSH emulab keys added
emulab client certificate and key
TBConfig.pm set up correctly
INSTALLATION INSTRUCTIONS
cpan HAS to be configured and functional
cpan Module::Install
perl Makefile.PL perl Makefile.PL
make make
TO FUN TO RUN Tests
make test make test
make t/old/old.t
make t/topologies/basic.t make t/topologies/basic.t
Module::Install is a perl library for installing perl modules/frameworks like testswap
If you need help getting CPAN to run as non-root:
http://www.google.com/search?q=cpan+install+to+home+dir
How to install Perl CPAN modules into my HOME directory?
https://help.webfaction.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=132
Using CPAN with a non-root account
http://sial.org/howto/perl/life-with-cpan/non-root/
Module::Install http://search.cpan.org/~adamk/Module-Install/
use SemiModern::Perl;
package TBConfig; package TBConfig;
use SemiModern::Perl;
use Sys::Hostname; use Sys::Hostname;
use Crypt::X509; use Crypt::X509;
use Tools qw(slurp); use Tools qw(slurp);
......
DOC
POD
-default run kill
buildup, teardown - Test::Class
Add parameterization examples
Add parse links from xmlserver
EXAMPLES
traffic generation`
test groupings test groupings
linkinfo
event system event system
convert more old tests convert more old tests
general result code handling general result code handling
better parallel support better parallel support
move xmlrpc tests to t/xmlrpc
THINKING ABOUT IT
Test::Class
MOSTLY DONE MOSTLY DONE
Parse NodeInfo Parse NodeInfo
......
testswap is a object orient / declarative test framework for the emulab testbed.
LIBRARY CODE
./lib/TestBed/TestSuite/
Core framework modules that the testwriter should use
./lib/TestBed/XMLRPC/Client/
The XMLRPC client interface that the core modules use to do their work
shouldn't be directly used by the testwriter
./lib/TestBed/Wrap/
command line utility wrappers
./lib/Tools/
utility modules and functions used by the framework
TESTS
./t/topologies/
topology swap tests
./t/*.t
xmlrpc tests
./t/lib
testswap framework tests
e('PROJECT_ID', 'EXPERIMENT_ID'); #new experiment
ep(); #new plain experiment for calling "class methods" on
dpe('EXPERIMENT_ID') #default project new experiment
./README - initial getting started doc
./TBConfig.pm - global configuration values
./tbts - testbed testsuite driver
./sc - shortcut driver for interactive user
./lib/SemiModern/Perl.pm - provides perl5.10 say to older perls
./lib/TestBed/TestSuite.pm - provides e() ep() dpe() macros
./lib/TestBed/TestSuite/Node.pm - represents a emulab node
./lib/TestBed/TestSuite/Project.pm - represents a emulab project
./lib/TestBed/TestSuite/Experiment.pm - represents a emulab experiment
./lib/TestBed/TestSuite/Experiment/Macros.pm - holds some obselete macros
./lib/TestBed/XMLRPC/Client.pm - XMLRPC utility classes
./lib/TestBed/XMLRPC/Client/NodeInfo.pm
./lib/TestBed/XMLRPC/Client/Experiment.pm
./lib/TestBed/XMLRPC/Client/Pretty.pm - XMLRPC pretty printers
./lib/TestBed/XMLRPC/Client/Emulab.pm
./lib/TestBed/Wrap/tevc.pm - tevc wrapper
./lib/TestBed/Wrap/linktest.pm - linktest wrapper
./lib/Tools.pm - utility functions
./lib/Tools/TBSSH.pm - testbed ssh functions
./lib/Tools/Network.pm - network utility functions (ping traceroute)
./doc/architecture.txt
./doc/cheatsheet.txt
./doc/dirmap.txt
./Makefile.PL - Module::Install makefile
./t/harness - perl test harness
./t/topologies/basic.t - basic topology test
./t/topologies/simple.t - simple topology test
./t/old/old.t - old testsuite tests
./t/old/oldtestsuite.pm - old testsuite data
./t/emulab.t - emulab XMLRPC tests
./t/experiment.t - experiment XMLRPC tests
./t/lib - testswap framework tests
./t/lib/tools.t - testswap framework tools tests
./t/lib/tools/network.t - testswap framework network tests
#!/usr/bin/perl
package TestBed::TestSuite;
use SemiModern::Perl;
use TestBed::TestSuite::Experiment;
use Data::Dumper;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(e ep dpe);
sub ep { TestBed::TestSuite::Experiment->new }
sub e { TestBed::TestSuite::Experiment->new('pid'=> shift, 'eid' => shift) }
sub dpe { TestBed::TestSuite::Experiment->new('pid'=> $TBConfig::DEFAULT_PID, 'eid' => shift) }
1;
...@@ -60,11 +60,22 @@ sub trytest(&$) { ...@@ -60,11 +60,22 @@ sub trytest(&$) {
} }
} }
sub startrunkill {
my ($e, $ns, $worker) = @_;
my $eid = $e->eid;
trytest {
$e->startexp_ns_wait($ns) && die "batchexp $eid failed";
$worker->($e) && die "worker function failed";
$e->end && die "exp end $eid failed";
} $e;
}
#class methods
sub launchpingkill { sub launchpingkill {
my ($pid, $eid, $ns) = @_; my ($pid, $eid, $ns) = @_;
my $e = e($pid, $eid); my $e = e($pid, $eid);
trytest { trytest {
$e->batchexp_ns_wait($ns) && die "batchexp $eid failed"; $e->startexp_ns_wait($ns) && die "batchexp $eid failed";
$e->ping_test && die "connectivity test $eid failed"; $e->ping_test && die "connectivity test $eid failed";
$e->end && die "exp end $eid failed"; $e->end && die "exp end $eid failed";
} $e; } $e;
...@@ -74,7 +85,7 @@ sub launchpingswapkill { ...@@ -74,7 +85,7 @@ sub launchpingswapkill {
my ($pid, $eid, $ns) = @_; my ($pid, $eid, $ns) = @_;
my $e = e($pid, $eid); my $e = e($pid, $eid);
trytest { trytest {
$e->batchexp_ns_wait($ns) && die "batchexp $eid failed"; $e->startexp_ns_wait($ns) && die "batchexp $eid failed";
$e->ping_test && die "connectivity test $eid failed"; $e->ping_test && die "connectivity test $eid failed";
$e->swapout_wait && die "swap out $eid failed"; $e->swapout_wait && die "swap out $eid failed";
$e->swapin_wait && die "swap in $eid failed"; $e->swapin_wait && die "swap in $eid failed";
...@@ -82,4 +93,5 @@ sub launchpingswapkill { ...@@ -82,4 +93,5 @@ sub launchpingswapkill {
$e->end && die "exp end $eid failed"; $e->end && die "exp end $eid failed";
} $e; } $e;
} }
1; 1;
...@@ -5,7 +5,8 @@ use Test::More qw(no_plan); ...@@ -5,7 +5,8 @@ use Test::More qw(no_plan);
use Data::Dumper; use Data::Dumper;
require 't/old/oldtestsuite.pm'; require 't/old/oldtestsuite.pm';
our @pass = qw(basic cbr complete5 delaylan1 delaylink); our @pass = qw(basic cbr complete5 delaylan1 delaylink);
our @who_knows = qw( ixp lan1 multilink nodes singlenode trafgen simplelink simplex setip red ping ); our @who_knows_passed = qw( lan1 multilink );
our @who_knows = qw( ixp lan1 nodes singlenode trafgen simplelink simplex setip red ping );
our @should_fail = qw(negprerun toomanylinks toofast); our @should_fail = qw(negprerun toomanylinks toofast);
=pod =pod
...@@ -14,8 +15,10 @@ S fixed (you will have to change the ns file depending on which nodes are ...@@ -14,8 +15,10 @@ S fixed (you will have to change the ns file depending on which nodes are
available) available)
=cut =cut
for (@pass) { #for (@pass) {
say "Running " . $_; for (@who_knows) {
my $ns = $Testbed::OldTestSuite::data->{$_}->{'nsfile'}; my $ns = $Testbed::OldTestSuite::data->{$_}->{'nsfile'};
ok(launchpingkill('tbres', $_, $ns)); say "Running " . $_;
say $ns;
ok(launchpingkill('tbres', $_, $ns), $_);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment