1 | #Automagic BCCD test suite! |
---|
2 | #Runs test scripts and compares with control output in BCCD. |
---|
3 | #Emails differences to bccd-developers@bccd.net |
---|
4 | |
---|
5 | use strict; |
---|
6 | use File::Path; |
---|
7 | |
---|
8 | my $testdir = "test"; |
---|
9 | |
---|
10 | sub generate_storeOutput{ |
---|
11 | (my $testname) = @_; |
---|
12 | return ">> $testdir/$testname.dat 2>> $testdir/$testname.dat"; |
---|
13 | } |
---|
14 | |
---|
15 | sub get_syncdir( ){ |
---|
16 | (my $tmpoutput) = @_; |
---|
17 | open(FILE, "<$tmpoutput") or die "could not open temporary file: $!"; |
---|
18 | my $tmp = ""; |
---|
19 | while ($tmp !~ m/\//){ |
---|
20 | $tmp = readline FILE; |
---|
21 | } |
---|
22 | my $startindex = index($tmp,"/",); |
---|
23 | my $endindex = index($tmp," ",$startindex); |
---|
24 | my $syncdir = substr($tmp,$startindex,$endindex-1); |
---|
25 | close FILE; |
---|
26 | unlink("tmpdir") or die "Could not delete temporary directory: $!"; |
---|
27 | return $syncdir; |
---|
28 | } |
---|
29 | |
---|
30 | my $testname; |
---|
31 | my $storeOutput; |
---|
32 | |
---|
33 | if (-e $testdir){ |
---|
34 | rmtree($testdir) or die "Could not replace existing test directory: $!"; |
---|
35 | } |
---|
36 | mkdir($testdir) or die "Could not make test directory: $!"; |
---|
37 | |
---|
38 | ### GalaxSee test ### |
---|
39 | $testname = "Gal"; |
---|
40 | $storeOutput = generate_storeOutput($testname); |
---|
41 | system("cd ~/Gal $storeOutput |
---|
42 | make clean $storeOutput |
---|
43 | make $storeOutput |
---|
44 | mpirun -np 1 ~/Gal/GalaxSee $storeOutput |
---|
45 | mpirun -np 2 ~/Gal/GalaxSee $storeOutput"); |
---|
46 | #system("bccd-syncdir . ~/machines &> tmpoutput"); |
---|
47 | |
---|
48 | #system("cat tmpoutput $storeOutput"); |
---|
49 | |
---|
50 | #get path to temporary directory |
---|
51 | #get_syncdir("tmpoutput"); |
---|
52 | #unlink "tmpoutput"; |
---|
53 | |
---|
54 | #system("mpirun -machinefile ~/machines\ |
---|
55 | # -np 2 $tempDirectory/GalaxSee $storeOutput"); |
---|
56 | |
---|
57 | ### Life test ### |
---|
58 | $testname = "Life"; |
---|
59 | $storeOutput = generate_storeOutput($testname); |
---|
60 | system("cd ~/Life $storeOutput |
---|
61 | make clean $storeOutput |
---|
62 | make $storeOutput |
---|
63 | mpirun -np 1 ~/Life/Life $storeOutput |
---|
64 | mpirun -np 2 ~/Life/Life $storeOutput"); |
---|
65 | #bccd-syncdir . ~/machines &> tmpoutput"); |
---|
66 | #system("cat tmpoutput $storeOutput"); |
---|
67 | |
---|
68 | #get path to temporary directory |
---|
69 | #get_syncdir("tmpoutput"); |
---|
70 | #unlink "tmpoutput"; |
---|
71 | |
---|
72 | #print "$tempDirectory\n"; |
---|
73 | #system("mpirun -machinefile ~/machines\ |
---|
74 | # -np 2 $tempDirectory/Life $storeOutput"); |
---|