diff --git a/DRAMSys/tests/TLM_compliance/test.pl b/DRAMSys/tests/TLM_compliance/test.pl index 5b48873a..ac6a4d73 100644 --- a/DRAMSys/tests/TLM_compliance/test.pl +++ b/DRAMSys/tests/TLM_compliance/test.pl @@ -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 '^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml"); +system("sed -i.bu '" . $storeModeLine . "s^.*^ ^' ../../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^.*^ ^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml"); +system("sed -i.bu '" . $storeModeLine . "s^.*^ ^' ../../DRAMSys/tests/TLM_compliance/fifoStrict.xml"); `rm -f sim-batch/TLM_compliance_test*.tdb`; @@ -73,10 +84,17 @@ system("sed -i '" . $storeModeLine . "s^.*^ ^ 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`; +} + diff --git a/DRAMSys/tests/start.pl b/DRAMSys/tests/start.pl index a04a38e1..2d699ffb 100755 --- a/DRAMSys/tests/start.pl +++ b/DRAMSys/tests/start.pl @@ -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) diff --git a/DRAMSys/tests/timing_compliance/test.pl b/DRAMSys/tests/timing_compliance/test.pl index cd18a4e9..00c256fb 100644 --- a/DRAMSys/tests/timing_compliance/test.pl +++ b/DRAMSys/tests/timing_compliance/test.pl @@ -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^.*^ ^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml"); - system("sed -i '" . $bankwiseLogicLine . "s^.*^ ^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml"); - system("sed -i '" . $powerDownModeLine . "s^.*^ ^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml"); + system("sed -i.bu '" . $powerAnalysisLine . "s^.*^ ^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml"); + system("sed -i.bu '" . $bankwiseLogicLine . "s^.*^ ^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml"); + system("sed -i.bu '" . $powerDownModeLine . "s^.*^ ^' ../../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^.*^ ^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml"); - system("sed -i '" . $bankwiseLogicLine . "s^.*^ ^' ../../DRAMSys/tests/timing_compliance/fifoStrict.xml"); + system("sed -i.bu '" . $powerAnalysisLine . "s^.*^ ^' ../../DRAMSys/tests/timing_compliance/sim-batch.xml"); + system("sed -i.bu '" . $bankwiseLogicLine . "s^.*^ ^' ../../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`; +} +