Fix test scripts to support both OS X and Linux System
Problem: 1. Test Script cannot determine number of logical cores on OS X with `cat /proc/cpuinfo | grep processor | wc -l` 2. sed command cannot run on OS X, e.g. sed: 1: "../../DRAMSys/tests/TLM ...": invalid command code . Solution 1. Add logic to determine number of logical cores on Testing Host’s OS 2. Fix sed command to support both OS X and Linux by adding -i flag suffix to add to the backed-up file 3. Cleaning backup files
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Authors:
|
||||
# Matthias Jung, Felipe S. Prado
|
||||
# Matthias Jung, Felipe S. Prado, Thanh C. Tran
|
||||
#
|
||||
|
||||
# Test TLM Compliance:
|
||||
@@ -38,34 +38,45 @@
|
||||
|
||||
# Run Simulation:
|
||||
|
||||
$numberOfCores = `cat /proc/cpuinfo | grep processor | wc -l`;
|
||||
# Get number of Cores:
|
||||
use Config;
|
||||
my $numberOfCores;
|
||||
if ($Config{osname} eq "darwin")
|
||||
{
|
||||
$numberOfCores = `sysctl -n hw.ncpu`;
|
||||
}
|
||||
elsif ($Config{osname} eq "linux")
|
||||
{
|
||||
$numberOfCores = `cat /proc/cpuinfo | grep processor | wc -l`;
|
||||
}
|
||||
|
||||
chdir("../../../build/simulator/");
|
||||
|
||||
$exampleInitiatorLine = `grep -n '#define USE_EXAMPLE_INITIATOR' ../../DRAMSys/simulator/src/simulation/SimulationManager.h | cut -d: -f 1`;
|
||||
chomp $exampleInitiatorLine;
|
||||
|
||||
system("sed -i '" . $exampleInitiatorLine . "s^.*^#define USE_EXAMPLE_INITIATOR 1^' ../../DRAMSys/simulator/src/simulation/SimulationManager.h");
|
||||
system("sed -i.bu '" . $exampleInitiatorLine . "s^.*^#define USE_EXAMPLE_INITIATOR 1^' ../../DRAMSys/simulator/src/simulation/SimulationManager.h");
|
||||
|
||||
`make -j$numberOfCores > /dev/null 2>&1`;
|
||||
|
||||
$storeModeLine = `grep -n '<StoreMode value=' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml | cut -d: -f 1`;
|
||||
chomp $storeModeLine;
|
||||
|
||||
system("sed -i '" . $storeModeLine . "s^.*^ <StoreMode value=\"Store\"/>^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml");
|
||||
system("sed -i.bu '" . $storeModeLine . "s^.*^ <StoreMode value=\"Store\"/>^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml");
|
||||
|
||||
`./dramSys ../../DRAMSys/tests/TLM_compliance/sim-batch.xml &> ../../DRAMSys/tests/TLM_compliance/output.txt`;
|
||||
|
||||
if("" ne `grep "Error: tlm2_protocol_checker" ../../DRAMSys/tests/TLM_compliance/output.txt`)
|
||||
{
|
||||
clean_backup_files();
|
||||
exit -1;
|
||||
}
|
||||
|
||||
system("sed -i '" . $exampleInitiatorLine . "s^.*^#define USE_EXAMPLE_INITIATOR 0^' ../../DRAMSys/simulator/src/simulation/SimulationManager.h");
|
||||
system("sed -i.bu '" . $exampleInitiatorLine . "s^.*^#define USE_EXAMPLE_INITIATOR 0^' ../../DRAMSys/simulator/src/simulation/SimulationManager.h");
|
||||
|
||||
`make -j$numberOfCores > /dev/null 2>&1`;
|
||||
|
||||
system("sed -i '" . $storeModeLine . "s^.*^ <StoreMode value=\"NoStorage\"/>^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml");
|
||||
system("sed -i.bu '" . $storeModeLine . "s^.*^ <StoreMode value=\"NoStorage\"/>^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml");
|
||||
|
||||
`rm -f sim-batch/TLM_compliance_test*.tdb`;
|
||||
|
||||
@@ -73,10 +84,17 @@ system("sed -i '" . $storeModeLine . "s^.*^ <StoreMode value=\"NoStorage\"/>^
|
||||
|
||||
if("" ne `grep "Error: tlm2_protocol_checker" ../../DRAMSys/tests/TLM_compliance/output.txt`)
|
||||
{
|
||||
clean_backup_files();
|
||||
exit -1;
|
||||
}
|
||||
clean_backup_files();
|
||||
exit 0;
|
||||
|
||||
sub clean_backup_files {
|
||||
`rm -rf ../../DRAMSys/simulator/src/simulation/SimulationManager.h.bu`;
|
||||
`rm -rf ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml.bu`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,12 +32,14 @@
|
||||
# Authors:
|
||||
# Matthias Jung
|
||||
# Eder F. Zulian
|
||||
# Thanh C. Tran
|
||||
#
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use Term::ANSIColor;
|
||||
use Time::localtime;
|
||||
use Config;
|
||||
|
||||
my $pathSelector = shift || "";
|
||||
|
||||
@@ -56,7 +58,15 @@ print color("red")," +---+\n";
|
||||
print color("red")," ||| ", color("green"),"DRAMSys Automated Test System\n", color("reset");
|
||||
|
||||
# Get number of Cores:
|
||||
my $numberOfCores = `cat /proc/cpuinfo | grep processor | wc -l`;
|
||||
my $numberOfCores;
|
||||
if ($Config{osname} eq "darwin")
|
||||
{
|
||||
$numberOfCores = `sysctl -n hw.ncpu`;
|
||||
}
|
||||
elsif ($Config{osname} eq "linux")
|
||||
{
|
||||
$numberOfCores = `cat /proc/cpuinfo | grep processor | wc -l`;
|
||||
}
|
||||
|
||||
# Navigate to Build Folder
|
||||
chdir("../../") || die("chdir");
|
||||
@@ -84,7 +94,7 @@ else
|
||||
# Find all tests:
|
||||
# Navigate to Build Folder
|
||||
chdir("../DRAMSys/tests") || die("chdir");
|
||||
my @tests = split(/\n/,`find -iname test.pl`);
|
||||
my @tests = split(/\n/,`find . -iname test.pl`);
|
||||
|
||||
# Run Tests:
|
||||
foreach(@tests)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Authors:
|
||||
# Matthias Jung, Felipe S. Prado
|
||||
# Matthias Jung, Felipe S. Prado, Thanh C. Tran
|
||||
#
|
||||
|
||||
# Test Timing Compliance:
|
||||
@@ -53,9 +53,9 @@ chdir("../../../build/simulator/");
|
||||
|
||||
foreach (@powerDownModes)
|
||||
{
|
||||
system("sed -i '" . $powerAnalysisLine . "s^.*^ <PowerAnalysis value=\"1\" />^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml");
|
||||
system("sed -i '" . $bankwiseLogicLine . "s^.*^ <BankwiseLogic value=\"0\"/>^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml");
|
||||
system("sed -i '" . $powerDownModeLine . "s^.*^ <PowerDownMode value=\"$_\" />^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml");
|
||||
system("sed -i.bu '" . $powerAnalysisLine . "s^.*^ <PowerAnalysis value=\"1\" />^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml");
|
||||
system("sed -i.bu '" . $bankwiseLogicLine . "s^.*^ <BankwiseLogic value=\"0\"/>^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml");
|
||||
system("sed -i.bu '" . $powerDownModeLine . "s^.*^ <PowerDownMode value=\"$_\" />^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml");
|
||||
|
||||
`./dramSys ../../DRAMSys/tests/timing_compliance/sim-batch.xml`;
|
||||
|
||||
@@ -68,12 +68,13 @@ foreach (@powerDownModes)
|
||||
|
||||
if("All tests passed\n" ne `grep "All tests passed" ../../DRAMSys/tests/timing_compliance/output.txt`)
|
||||
{
|
||||
clean_backup_files();
|
||||
exit -1;
|
||||
}
|
||||
}
|
||||
|
||||
system("sed -i '" . $powerAnalysisLine . "s^.*^ <PowerAnalysis value=\"0\" />^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml");
|
||||
system("sed -i '" . $bankwiseLogicLine . "s^.*^ <BankwiseLogic value=\"1\"/>^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml");
|
||||
system("sed -i.bu '" . $powerAnalysisLine . "s^.*^ <PowerAnalysis value=\"0\" />^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml");
|
||||
system("sed -i.bu '" . $bankwiseLogicLine . "s^.*^ <BankwiseLogic value=\"1\"/>^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml");
|
||||
|
||||
`./dramSys ../../DRAMSys/tests/timing_compliance/sim-batch.xml`;
|
||||
|
||||
@@ -83,10 +84,17 @@ foreach (@powerDownModes)
|
||||
|
||||
if("All tests passed\n" ne `grep "All tests passed" ../../DRAMSys/tests/timing_compliance/output.txt`)
|
||||
{
|
||||
clean_backup_files();
|
||||
exit -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
clean_backup_files();
|
||||
exit 0;
|
||||
|
||||
sub clean_backup_files {
|
||||
`rm -rf ../../DRAMSys/tests/timing_compliance/sim-batch.xml.bu`;
|
||||
`rm -rf ../../DRAMSys/tests/timing_compliance/fifoStrict.xml.bu`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user