All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit d169df8a authored by Christopher Alfeld's avatar Christopher Alfeld

Switched to using test lists rather than a directory structure. This more

easily allows tests to be shared across sets.
parent 70631f66
......@@ -155,12 +155,12 @@ Options:
-exitonfail - Exit on any failure.
-session <sessionid> - Specify alternate session ID.
Mode:
run <db> <testdir> [<pid> <eid> <num>]
run <db> <testlist> [<pid> <eid> <num>]
init <db> [<pid> <eid> <num>]
test <testdir>
single <testdir> <tests>
test <testlist>
single <testlist> <tests>
finish
tbtest [-leavedb] [-path <path>] <db> <testdir>
tbtest [-leavedb] [-path <path>] <db> <testlist>
Notes:
......@@ -230,7 +230,7 @@ virtual<->physical mapping.
Test Format
-----------
A test is a directory in testsuite/tests/<testdir> which contains the
A test is a directory in testsuite/tests which contains the
following files:
nsfile.ns - NS file.
dbstate - Any commands to set up the DB.
......
......@@ -103,13 +103,16 @@ while ($nsfile eq "") {
}
}
$dir = "tests/$mode/$name";
$dir = "tests/$name";
mkdir $dir,0755;
system "cp templates/$mode $dir/test";
open(INFO,"> $dir/info");
print INFO $description;
close(INFO);
system "cp $nsfile $dir/nsfile.ns";
open(TESTLIST,">> testlists/$mode");
print TESTLIST "$name\n";
close(TESTLIST);
print "Test generated.\n";
......
......@@ -20,10 +20,10 @@
# -session <sessionid> - Specify an alternate session id.
#
# <mode> is one of:
# run <db> <testdir> [<pid> <eid> <num>] - Do everything.
# run <db> <testlist> [<pid> <eid> <num>] - Do everything.
# init <db> [<pid> <eid> <num>] - Initiatlize.
# test <testdir> - Run tests
# single <testdir> <tests> - Run only <tests>
# test <testlist> - Run tests
# single <tests> - Run only <tests>
# finish - Finish run
# <num> is "X <type> ...", for example "10 pc 16 shark"
......@@ -73,17 +73,17 @@ sub show_help {
print STDERR " -exitonfail - Exit on any failure.\n";
print STDERR " -session <sessionid> - Specify an alternate session id.\n";
print STDERR "Mode:\n";
print STDERR " run <db> <testdir> [<pid> <eid> <num>]\n";
print STDERR " run <db> <testlist> [<pid> <eid> <num>]\n";
print STDERR " init <db> [<pid> <eid> <num>]\n";
print STDERR " test <testdir>\n";
print STDERR " single <testdir> <tests>\n";
print STDERR " test <testlist>\n";
print STDERR " single <tests>\n";
print STDERR " finish\n";
print STDERR "<num>: Must be even lengthed list of <number> <type>.\n";
print STDERR " Ex: \"4 pc 16 shark\"\n";
print STDERR "Examples:\n";
print STDERR " $0 run tbdb frontend\n";
print STDERR " $0 -full run tbdb frontend testbed mytest \"10 pc 16 shark\"\n";
print STDERR " $0 init tbdb;$0 single frontend ping basic;$0 finish\n";
print STDERR " $0 init tbdb;$0 single ping basic;$0 finish\n";
exit(1);
};
......@@ -121,10 +121,10 @@ $statefile = "state";
if ($mode eq "run") {
if ($type eq "frontend") {
if ($#ARGV != 1) {show_help;}
($TBDB,$testdir) = @ARGV;
($TBDB,$testlist) = @ARGV;
} else {
if ($#ARGV != 4) {show_help;}
($TBDB,$testdir,$pid,$eid,$num) = @ARGV;
($TBDB,$testlist,$pid,$eid,$num) = @ARGV;
}
} elsif ($mode eq "init") {
if ($type eq "frontend") {
......@@ -136,10 +136,10 @@ if ($mode eq "run") {
}
} elsif ($mode eq "test") {
if ($#ARGV != 0) {show_help;}
($testdir) = @ARGV;
($testlist) = @ARGV;
} elsif ($mode eq "single") {
if ($#ARGV <= 0) {show_help;}
($testdir,@tests) = @ARGV;
if ($#ARGV == -1) {show_help;}
(@tests) = @ARGV;
} elsif ($mode eq "finish") {
if ($#ARGV != -1) {show_help;}
} else {
......@@ -158,16 +158,6 @@ if (($mode ne "run") && ($mode ne "init")) {
close(STATE);
}
if (($mode eq "run") || ($mode eq "test") || ($mode eq "single")) {
if (! ($testdir =~ m|^/|)) {
$testdirshort = $testdir;
$testdir = "$basedir/tests/$testdir";
} else {
@t = split("/",$testdir);
$testdirshort = $t[$#t];
}
}
if (($type eq "full") && (($mode eq "init") || ($mode eq "run"))) {
@t = split(" ",$num);
if (($#t % 2) == 0) {
......@@ -482,7 +472,7 @@ sub step_test {
# Time to run tests!
prints "Running Tests\n";
prints "Testdir: $testdir\n";
prints "Testlist: $testlist\n";
# Let's add some stuff to our path
$ENV{'PATH'} = "$basepath:$path/install/bin:$path/install/sbin";
......@@ -492,23 +482,26 @@ sub step_test {
my $dir;
if ($#_ == -1) {
opendir(TESTDIR,$testdir);
@tests = readdir(TESTDIR);
closedir(TESTDIR);
open(TESTLIST,"$basedir/testlists/$testlist");
@tests = ();
while (<TESTLIST>) {
chop;
push(@tests,$_);
}
close(TESTLIST);
} else {
@tests = @_;
}
mkdir "tests",0755;
mkdir "tests/$testdirshort",0755;
foreach $test (@tests) {
if (($test eq ".") || ($test eq "..") || ($test eq "CVS")) {
next;
}
prints " $test ";
mkdir "tests/$testdirshort/$test",0755;
chdir "tests/$testdirshort/$test";
mkdir "tests/$test",0755;
chdir "tests/$test";
open(TESTLOG,"> test.log");
# Set up DB state
......@@ -531,8 +524,8 @@ sub step_test {
doexit(1);
}
if (-f "$testdir/$test/dbstate") {
if (tbexect("cat $testdir/$test/dbstate | mysql $testdb",TESTLOG)) {
if (-f "$basedir/tests/$test/dbstate") {
if (tbexect("cat $basedir/tests/$test/dbstate | mysql $testdb",TESTLOG)) {
prints "FAIL - Could not evaluate dbstate.\n";
$fail++;
if ($exitonfail) {doexit(1);}
......@@ -545,7 +538,7 @@ sub step_test {
# The last line of this command will be either PASS
# or FAIL <msg>, all output before that should be sent
# to the log file.
open(TESTFP,"tbstub $testdb testbed test $test $testdir/$test |");
open(TESTFP,"tbstub $testdb testbed test $test $basedir/tests/$test |");
while (<TESTFP>) {
print TESTLOG $_;
$status = $_;
......
basic
basic_rsrv
buddycache
complete5
db1
delaylan1
delaylink
lan1
multilink
negprerun
nodes
ping
set-ip
sharkshelf
simplelink
singlenode
spinglass
tbcmd
trafgen
trivial
basic
basic_rsrv
buddycache
complete5
db1
delaylan1
delaylink
lan1
multilink
negprerun
nodes
ping
set-ip
sharkshelf
simplelink
singlenode
trafgen
trivial
Spinglass test
Contact: rvr@cs.cornell.edu
set ns [new Simulator]
source tb_compat.tcl
set router [$ns node]
tb-set-node-os $router FBSD40-STD
tb-set-node-startup $router /proj/Spinglass/router.script
set node0 [$ns node]
tb-set-hardware $node0 shark
tb-set-node-startup $node0 {/proj/Spinglass/node.script emulab0}
set node1 [$ns node]
tb-set-hardware $node1 shark
tb-set-node-startup $node1 {/proj/Spinglass/node.script emulab0}
set node2 [$ns node]
tb-set-hardware $node2 shark
tb-set-node-startup $node2 {/proj/Spinglass/node.script emulab0}
set node3 [$ns node]
tb-set-hardware $node3 shark
tb-set-node-startup $node3 {/proj/Spinglass/node.script emulab0}
set node4 [$ns node]
tb-set-hardware $node4 shark
tb-set-node-startup $node4 {/proj/Spinglass/node.script emulab0}
set node5 [$ns node]
tb-set-hardware $node5 shark
tb-set-node-startup $node5 {/proj/Spinglass/node.script emulab0}
set node6 [$ns node]
tb-set-hardware $node6 shark
tb-set-node-startup $node6 {/proj/Spinglass/node.script emulab0}
set node7 [$ns node]
tb-set-hardware $node7 shark
tb-set-node-startup $node7 {/proj/Spinglass/node.script emulab0}
set node8 [$ns node]
tb-set-hardware $node8 shark
tb-set-node-startup $node8 {/proj/Spinglass/node.script emulab1}
set node9 [$ns node]
tb-set-hardware $node9 shark
tb-set-node-startup $node9 {/proj/Spinglass/node.script emulab1}
set node10 [$ns node]
tb-set-hardware $node10 shark
tb-set-node-startup $node10 {/proj/Spinglass/node.script emulab1}
set node11 [$ns node]
tb-set-hardware $node11 shark
tb-set-node-startup $node11 {/proj/Spinglass/node.script emulab1}
set node12 [$ns node]
tb-set-hardware $node12 shark
tb-set-node-startup $node12 {/proj/Spinglass/node.script emulab1}
set node13 [$ns node]
tb-set-hardware $node13 shark
tb-set-node-startup $node13 {/proj/Spinglass/node.script emulab1}
set node14 [$ns node]
tb-set-hardware $node14 shark
tb-set-node-startup $node14 {/proj/Spinglass/node.script emulab1}
set node15 [$ns node]
tb-set-hardware $node15 shark
tb-set-node-startup $node15 {/proj/Spinglass/node.script emulab1}
set lan0 [$ns make-lan "$router $node0 $node1 $node2 $node3 $node4
$node5 $node6 $node7" 10Mb 0ms]
set lan1 [$ns make-lan "$router $node8 $node9 $node10 $node11 $node12
$node13 $node14 $node15" 10Mb 0ms]
$ns run
delete from os_info where osid = "MYOS";
insert into os_info (osid,description,version,pid) values ("MYOS","Test OS","0","testbed");
NOT A FULL TEST!
This is a test of all the tb-* commands. It also checks does checks on
virt_lans and virt_nodes to make sure they done the right thing.
source tb_compat.tcl
set ns [new Simulator]
set node0 [$ns node]
set node1 [$ns node]
set node2 [$ns node]
set lan0 [$ns make-lan "$node0 $node1 $node2" 100Mb 0ms]
tb-set-lan-loss $lan0 0.2
tb-set-node-lan-delay $node0 $lan0 100ms
tb-set-node-lan-bandwidth $node0 $lan0 20Mb
tb-set-node-lan-loss $node0 $lan0 0.4
tb-set-node-lan-params $node1 $lan0 150ms 30Mb 0.0
set node3 [$ns node]
set link0 [$ns duplex-link $node0 $node3 100Mb 0ms DropTail]
tb-set-link-loss $link0 0.1
set node4 [$ns node]
$ns duplex-link $node4 $node0 100Mb 0ms DropTail
tb-set-link-loss $node4 $node0 0.025
tb-set-ip $node4 1.0.4.1
tb-set-ip-interface $node0 $node4 1.0.0.1
tb-set-ip-link $node0 $link0 1.0.0.2
tb-set-ip-lan $node0 $lan0 1.0.0.3
set s5 [$ns node]
set s6 [$ns node]
$ns make-lan "$s5 $s6 $node4" 100Mb 0ms
tb-set-hardware $s5 shark
tb-set-hardware $s6 shark
tb-set-hardware $node4 pc
tb-set-node-os $node4 MYOS
tb-set-node-cmdline $node4 "my command line"
tb-set-node-rpms $node4 "my node rpms"
tb-set-node-startup $node4 "my node startup"
tb-set-node-tarfiles $node4 dira tara dirb tarb dirc tarc
tb-set-node-deltas $node4 "deltas!"
$ns run
\ No newline at end of file
tb_prerun("tbprerun",0);
@result = (
["l8","0","100","0.000","node4:0"],
["l8","0","100","0.000","node0:2"],
["lan11","0","100","0.000","s5:0"],
["lan11","0","100","0.000","s6:0"],
["lan11","0","100","0.000","node4:1"],
["link0","0","100","0.051","node0:1"],
["link0","0","100","0.051","node3:0"],
["lan0","100","20","0.400","node0:0"],
["lan0","150","30","0.000","node1:0"],
["lan0","0","100","0.106","node2:0"],
);
tb_compare("select vname,delay,bandwidth,lossrate,member from virt_lans" .
" where pid=\"testbed\" and eid=\"test\"",\@result);
@result = (
["0:1.0.0.3 1:1.0.0.2 2:1.0.0.1","node0","pc"],
["0:1.0.0.2","node1","pc"],
["0:1.0.0.4","node2","pc"],
["0:1.0.0.3","node3","pc"],
["0:1.0.4.1 1:192.168.1.4","node4","pc"],
["0:192.168.1.2","s5","shark"],
["0:192.168.1.3","s6","shark"],
);
tb_compare("select ips,vname,type from virt_nodes" .
" where pid=\"testbed\" and eid=\"test\"",\@result);
@result = (
["0:1.0.4.1 1:192.168.1.4","MYOS","my command line","{my node rpms}","deltas!","my node startup","dira tara dirb tarb dirc tarc","pc"],
);
tb_compare("select ips,osid,cmd_line,rpms,deltas,startupcmd,tarfiles,type" .
" from virt_nodes where pid=\"testbed\" and eid=\"test\"" .
" and vname=\"node4\"",\@result);
tb_run("tbswapin",0);
tb_run("tbswapout",0);
tb_run("tbswapin",0);
tb_run("tbswapout",0);
tb_run("tbend",0);
tb_prerun("tbprerun",0);
tb_run("tbswapin",0);
tb_run("tbswapout",0);
tb_run("tbswapin",0);
tb_run("tbswapout",0);
tb_run("tbend",0);
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