source: /cluster/svnroot/bccd-ng/branches/skylar-test_fw/trees/home/bccd/tests/test_defs.pm @ 2729

Last change on this file since 2729 was 2729, checked in by skylar, 10 years ago

adding working liberation test (#520)

File size: 2.3 KB
Line 
1package tests;
2
3use bccd_test_suite;
4use vars qw/ %tests /;
5use Cwd;
6use POSIX;
7use Carp;
8
9%tests = (
10    'test' => sub { #Test the test suite
11        (my $testdir, my $testname) = @_;
12        my $storeOutput =
13            bccd_test_suite::generate_storeOutput($testdir,$testname);
14        system("
15                echo \"BCCD\nBCCD\nBCCD\" $storeOutput
16                echo \"ok, it works.\" $storeOutput
17                ")
18    },
19   
20    'fail' => sub { #Guarantee an error report
21        (my $testdir, my $testname) = @_;
22        my $storeOutput =
23            bccd_test_suite::generate_storeOutput($testdir,$testname);
24        system( "seq 1 100 | sort -R $storeOutput");
25    },
26   
27    'system' => sub { #Print system information
28        (my $testdir, my $testname) = @_;
29        chdir("$ENV{HOME}/tests"); # Hack time
30        my $storeOutput =
31            bccd_test_suite::generate_storeOutput($testdir,$testname);
32        my $out = getcwd()."/$testdir/$testname.dat";
33        open(my $OUT, '>>', $out) or
34            croak "Can't open $out for appending: $!\n";
35        my @uname = POSIX::uname();
36        print $OUT "@uname\n";
37        open(my $CPUI, '<', '/proc/cpuinfo') or
38            croak "Can't open /proc/cpuinfo for reading: $!\n";
39        while(my $line = <$CPUI>) {
40            chomp $line;
41            print $OUT "$line\n";
42        }
43        close($CPUI);
44        close($OUT);
45    },
46   
47    'BCCD' => sub { #Test the BCCD's built-in tests
48       
49    },
50   
51    'GalaxSee' => sub { #Test GalaxSee
52        (my $testdir, my $testname) = @_;
53        bccd_test_suite::mpi_test($testdir, $testname);
54    },
55   
56    'Life' => sub { #Test Conway's Game of Life
57        (my $testdir, my $testname) = @_;
58        bccd_test_suite::mpi_test($testdir, $testname);
59    },
60
61    'liberate' => sub { # Liberate to /dev/hda
62        (my $testdir, my $testname) = @_;
63        chdir("$ENV{HOME}/tests");
64        my $out = getcwd()."/$testdir/$testname.dat";
65        open(my $OUT, '>>', $out) or
66            croak "Can't open $out for appending: $!\n";
67        open(my $LIB, '-|', '/usr/bin/sudo',
68             '/usr/bin/perl', '/root/liberate.pl',
69            '--libdev=/dev/hda') or
70                croak "Can't open /root/liberate.pl: $!\n";
71
72        while(my $line = <$LIB>) {
73            chomp $line;
74            print $LIB "$line\n";
75        }
76
77        close($LIB);
78        close($OUT);
79    },
80    )
81   
Note: See TracBrowser for help on using the repository browser.