first approach of a regression-test experiment
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1465 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
17
src/experiments/regression-test/CMakeLists.txt
Normal file
17
src/experiments/regression-test/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
set(EXPERIMENT_NAME regression-test)
|
||||
set(EXPERIMENT_TYPE RegressionTest)
|
||||
configure_file(../instantiate-experiment.ah.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah @ONLY
|
||||
)
|
||||
|
||||
#experiment sources
|
||||
set(MY_EXPERIMENT_SRCS
|
||||
experiment.hpp
|
||||
experiment.cc
|
||||
)
|
||||
|
||||
#### include directories ####
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
## build library
|
||||
add_library(${EXPERIMENT_NAME} ${MY_EXPERIMENT_SRCS})
|
||||
76
src/experiments/regression-test/experiment.cc
Normal file
76
src/experiments/regression-test/experiment.cc
Normal file
@ -0,0 +1,76 @@
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "experiment.hpp"
|
||||
#include "experimentInfo.hpp"
|
||||
#include "sal/SALInst.hpp"
|
||||
#include "sal/Listener.hpp"
|
||||
#include "util/Logger.hpp"
|
||||
#include "config/FailConfig.hpp"
|
||||
|
||||
|
||||
// Check if configuration dependencies are satisfied:
|
||||
#if !defined(CONFIG_EVENT_BREAKPOINTS)
|
||||
#error This experiment needs: breakpoints. Enable these in the configuration.
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace fail;
|
||||
|
||||
bool RegressionTest::run()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
Logger log("Regression-Test", false);
|
||||
log << "experiment start" << endl;
|
||||
|
||||
//Breakpoint-Test
|
||||
log << "Breakpoint-Test start." << endl;
|
||||
|
||||
BPSingleListener mainbp(ANY_ADDR);
|
||||
mainbp.setCounter(1000);
|
||||
|
||||
BPRangeListener bprange(REGRESSION_FUNC_LOOP_DONE, REGRESSION_FUNC_LOOP_DONE);
|
||||
BPSingleListener breakcounter(REGRESSION_FUNC_LOOP_DONE);
|
||||
simulator.addListener(&breakcounter);
|
||||
|
||||
|
||||
while(true){
|
||||
|
||||
BaseListener* ev = simulator.resume();
|
||||
|
||||
if(ev == &breakcounter || ev == &bprange) {
|
||||
|
||||
count++;
|
||||
//First 5 times test BPSingleListener
|
||||
if(count < 5){
|
||||
log << "Loop-Single-Test!" << endl;
|
||||
simulator.addListener(&breakcounter);
|
||||
//Next 5 times test BPRangeListener
|
||||
}else if(count < 10){
|
||||
log << "Loop-Range-Test!" << endl;
|
||||
simulator.addListener(&bprange);
|
||||
//At 10 run of loop start BPSingleListener, BPRangeListener, mainListener
|
||||
//which waits 1000 instructions.
|
||||
}else if(count == 10){
|
||||
log << "loop-limit reached..." << endl;
|
||||
simulator.addListener(&breakcounter);
|
||||
simulator.addListener(&bprange);
|
||||
simulator.addListener(&mainbp);
|
||||
//If mainListener fires not first the test failes.
|
||||
}else if(count >= 10){
|
||||
log << "Breakpoint-Test FAILED."<< endl;
|
||||
break;
|
||||
}
|
||||
//If mainListener fires first the test success.
|
||||
}else if(ev == &mainbp) {
|
||||
log << "Breakpoint-Test SUCCESS." <<endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
simulator.clearListeners(this);
|
||||
|
||||
log << "Breakpoint-Test end" << endl;
|
||||
return true;
|
||||
}
|
||||
14
src/experiments/regression-test/experiment.hpp
Normal file
14
src/experiments/regression-test/experiment.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __REGRESSION_TEST_HPP__
|
||||
#define __REGRESSION_TEST_HPP__
|
||||
|
||||
#include "efw/ExperimentFlow.hpp"
|
||||
|
||||
class RegressionTest : public fail::ExperimentFlow
|
||||
{
|
||||
public:
|
||||
RegressionTest() { }
|
||||
|
||||
bool run();
|
||||
};
|
||||
|
||||
#endif // __REGRESSION_TEST_HPP__
|
||||
13
src/experiments/regression-test/experimentInfo.hpp
Normal file
13
src/experiments/regression-test/experimentInfo.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef __REGRESSION_TEST_EXPERIMENT_INFO_HPP__
|
||||
#define __REGRESSION_TEST_EXPERIMENT_INFO_HPP__
|
||||
|
||||
// autogenerated, don't edit!
|
||||
|
||||
// loop_done() address:
|
||||
// nm -C regressiontest|fgrep loop_done
|
||||
#define REGRESSION_FUNC_LOOP_DONE 0x00003c3e
|
||||
#define REGRESSION_FUNC_MTEST_READ 0x0000a6e8
|
||||
#define REGRESSION_FUNC_MTEST_WRITE 0x0000eb40
|
||||
|
||||
|
||||
#endif
|
||||
32
src/experiments/regression-test/experimentInfo.hpp.sh
Executable file
32
src/experiments/regression-test/experimentInfo.hpp.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
TARGET=experimentInfo.hpp
|
||||
|
||||
[ ! -e "$1" ] && echo "usage: $0 regression-test.elf" && exit 1
|
||||
|
||||
function addrof() { nm -C $1 | (fgrep "$2" || echo 99999999) | awk '{print $1}'; }
|
||||
|
||||
cat >$TARGET <<EOF
|
||||
#ifndef __REGRESSION_TEST_EXPERIMENT_INFO_HPP__
|
||||
#define __REGRESSION_TEST_EXPERIMENT_INFO_HPP__
|
||||
|
||||
// autogenerated, don't edit!
|
||||
|
||||
EOF
|
||||
|
||||
function alldefs() {
|
||||
cat <<EOF
|
||||
// loop_done() address:
|
||||
// nm -C $(basename $1)|fgrep loop_done
|
||||
#define REGRESSION_FUNC_LOOP_DONE 0x`addrof $1 loop_done`
|
||||
#define REGRESSION_FUNC_MTEST_READ 0x`addrof $1 mtest_read`
|
||||
#define REGRESSION_FUNC_MTEST_WRITE 0x`addrof $1 mtest_write`
|
||||
EOF
|
||||
}
|
||||
|
||||
alldefs $1 >>$TARGET
|
||||
cat >>$TARGET <<EOF
|
||||
|
||||
|
||||
#endif
|
||||
EOF
|
||||
Reference in New Issue
Block a user