Added timestamp and duration for every test step.

This commit is contained in:
Éder F. Zulian
2015-09-08 14:34:14 +02:00
parent d19d2425dc
commit 929239ace5

View File

@@ -31,11 +31,15 @@
#
# Authors:
# Matthias Jung
# Eder F. Zulian
#
use warnings;
use strict;
use Term::ANSIColor;
use Time::localtime;
my $timestamp_color = "green";
print color("red")," |||\n";
print color("red")," +---+ Microelectronic Systems\n";
@@ -53,18 +57,20 @@ chdir("../../");
chdir("build/");
# Build the Project:
print color("reset"),"\nBuild Project\t";
my $starttime = time();
print "\n", color($timestamp_color), timestamp(), color("reset"),"Build Project\t";
`qmake ../DRAMSys/dram.vp.system.pro >/dev/null 2>&1`;
`make -j$numberOfCores > /dev/null 2>&1`;
my $took = time() - $starttime;
# Check if Build was sucessful:
if( -e "./simulator/dramSys" )
{
print color("reset"),"[ ", color("green"), "done", color("reset"), " ]\n";
print color("reset"),"[ ", color("green"), "done", color("reset"), " ]\t", "(", $took, " seconds)\n";
}
else
{
print color("reset"),"[ ", color("red"), "fail", color("reset"), " ]\n";
print color("reset"),"[ ", color("red"), "fail", color("reset"), " ]\t", "(", $took, " seconds)\n";
exit -1;
}
@@ -80,16 +86,18 @@ foreach(@tests)
{
my $name = $1;
chdir("./$name");
print color("reset"),"Test: ".$name."\t";
print color($timestamp_color), timestamp(), color("reset"),"Test: ".$name."\t";
$starttime = time();
`perl test.pl`;
$took = time() - $starttime;
if( $? == 0 )
{
print color("reset"),"[ ", color("green"), "done", color("reset"), " ]\n";
print color("reset"),"[ ", color("green"), "done", color("reset"), " ]\t", "(", $took, " seconds)\n";
}
else
{
print color("reset"),"[ ", color("red"), "fail", color("reset"), " ]\n";
print color("reset"),"[ ", color("red"), "fail", color("reset"), " ]\t", "(", $took, " seconds)\n";
}
chdir("../");
}
@@ -98,3 +106,11 @@ foreach(@tests)
exit -1;
}
}
sub timestamp {
my $t = localtime;
return sprintf( "[%04d-%02d-%02d %02d:%02d:%02d]\t",
$t->year + 1900, $t->mon + 1, $t->mday,
$t->hour, $t->min, $t->sec );
}