-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunTest.pl
More file actions
executable file
·41 lines (39 loc) · 1.35 KB
/
runTest.pl
File metadata and controls
executable file
·41 lines (39 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl -w
# Script to run multiple tests on each machine easily.
# Written by: Fekete Andras 2015-03-30
use strict;
my $MAXTHREAD = 32;
my $MAXDIFFICULTY = 9;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$year += 1900;
$mon++;
my $machineName = `uname -n`;
chomp($machineName);
my $fileName = "$machineName-$year-$mon-$mday-$hour-$min";
if(!-d "data") { mkdir("data") || die "Can't create directory for data"; }
my $FILE;
my @progs = qw( asmProc prime );
foreach my $curProg (@progs) {
open($FILE,">data/$fileName-$curProg.csv") || die "Can't create a test log file.";
&printPlaces($FILE, "numThread\t"); # get the header looking like in the program
&printPlaces($FILE,`./main_$curProg 1`);
for(my $i = 2; $i <= $MAXTHREAD; $i++) {
&printPlaces($FILE,"$i\t" . `./main_$curProg $i | sed -n '2p'`); # ignores the header
}
close($FILE);
}
foreach my $curProg (@progs) {
open($FILE,">data/$fileName-$curProg-difficulty.csv") || die "Can't create a test log file.";
&printPlaces($FILE, "difficulty\t"); # get the header looking like in the program
&printPlaces($FILE,`./main_$curProg 8 1`);
for(my $i = 2; $i <= $MAXDIFFICULTY; $i++) {
&printPlaces($FILE,"$i\t" . `./main_$curProg 8 $i | sed -n '2p'`); # ignores the header
}
close($FILE);
}
sub printPlaces() {
my $FILE = shift;
my $str = shift;
print $str;
print $FILE $str;
}