diff --git a/.gitignore b/.gitignore index e4466fb8..06b27a1f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ /build-simulation /release-simulation *.*~ -build-*/ +build*/ ._.DS_Store .DS_Store *.swp diff --git a/DRAMSys/tests/.gitignore b/DRAMSys/tests/.gitignore new file mode 100644 index 00000000..2211df63 --- /dev/null +++ b/DRAMSys/tests/.gitignore @@ -0,0 +1 @@ +*.txt diff --git a/DRAMSys/tests/error/.gitignore b/DRAMSys/tests/error/.gitignore new file mode 100644 index 00000000..1567411f --- /dev/null +++ b/DRAMSys/tests/error/.gitignore @@ -0,0 +1 @@ +*.stl diff --git a/DRAMSys/tests/error/generateErrorTest.pl b/DRAMSys/tests/error/generateErrorTest.pl old mode 100644 new mode 100755 diff --git a/DRAMSys/tests/error/sim-batch.xml b/DRAMSys/tests/error/sim-batch.xml index b4129576..a7ab19c0 100644 --- a/DRAMSys/tests/error/sim-batch.xml +++ b/DRAMSys/tests/error/sim-batch.xml @@ -1,27 +1,27 @@ - + - + - + - + - + - test_error.stl + ../../../tests/error/test_error.stl diff --git a/DRAMSys/tests/error/test.pl b/DRAMSys/tests/error/test.pl new file mode 100644 index 00000000..f060b551 --- /dev/null +++ b/DRAMSys/tests/error/test.pl @@ -0,0 +1,80 @@ +#!/usr/bin/perl -w +# Copyright (c) 2015, University of Kaiserslautern +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: +# Matthias Jung +# Eder F. Zulian +# + +# Test error: +# This test runs the simulation with error model enabled. +# The main configuration file for this test is DRAMSys/tests/error/sim-batch.xml. +# +use warnings; +use strict; +use Term::ANSIColor; + +# Create the input file (first make sure the script is executable) +chdir("../../DRAMSys/tests/error"); +`chmod u+x ./generateErrorTest.pl`; +`./generateErrorTest.pl > test_error.stl`; + +# Run Simulation: +chdir("../../../build/simulator/"); +`./dramSys ../../DRAMSys/tests/error/sim-batch.xml > ../../DRAMSys/tests/error/output.txt`; + +chdir("../../DRAMSys/tests/error"); + +my @channels_retention_errors = (); +@channels_retention_errors = split(/\n/,`cat output.txt | grep 'Number of Retention Error Events' | cut -d= -f2 | sed 's/ //g'`); + +if (!@channels_retention_errors) { + print color("red"), "\tError: ", color("green"), "error model output information not found.\n"; + print color("yellow"), "\tCheck if error model is enabled.\n"; + exit -1 +} + +my $errors_found = 0; +foreach (@channels_retention_errors) { + print "$_\n"; + $errors_found += $_; +} + +print color("green"), "Number of Retention Errors Events (all banks): $errors_found\n"; + +if ($errors_found == 0) { + # Fail, errors expected but not found. + exit -1; +} + +# Success, at least one error was found. +exit 0; +