ecos: preparations for guest-image independent fail client
Additional change: prerequisite data files are not opened in append mode anymore. These files can be easily reproduced, and append mode does more harm than good here. git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1906 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -19,10 +19,9 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace fail;
|
using namespace fail;
|
||||||
|
|
||||||
char const * const trace_filename = "trace.tc"; //TODO: sync with experiment.cc
|
const std::string EcosKernelTestCampaign::dir_images("images");
|
||||||
char const * const results_filename = "ecos_kernel_test.csv";
|
const std::string EcosKernelTestCampaign::dir_prerequisites("prerequisites");
|
||||||
char const * const mm_filename = "memory_map.txt"; //TODO: sync with experiment.cc
|
const std::string EcosKernelTestCampaign::dir_results("results");
|
||||||
char const * const traceinfo_name = "trace_info.txt";
|
|
||||||
|
|
||||||
bool EcosKernelTestCampaign::readMemoryMap(fail::MemoryMap &mm, char const * const filename) {
|
bool EcosKernelTestCampaign::readMemoryMap(fail::MemoryMap &mm, char const * const filename) {
|
||||||
ifstream file(filename);
|
ifstream file(filename);
|
||||||
@ -47,9 +46,9 @@ bool EcosKernelTestCampaign::readMemoryMap(fail::MemoryMap &mm, char const * con
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EcosKernelTestCampaign::writeTraceInfo(unsigned instr_counter, unsigned timeout, unsigned lowest_addr, unsigned highest_addr) {
|
bool EcosKernelTestCampaign::writeTraceInfo(unsigned instr_counter, unsigned timeout, unsigned lowest_addr, unsigned highest_addr) {
|
||||||
ofstream ti(traceinfo_name, ios::out | ios::app);
|
ofstream ti(filename_traceinfo().c_str(), ios::out);
|
||||||
if (!ti.is_open()) {
|
if (!ti.is_open()) {
|
||||||
cout << "failed to open " << traceinfo_name << endl;
|
cout << "failed to open " << filename_traceinfo() << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ti << instr_counter << endl << timeout << endl << lowest_addr << endl << highest_addr << endl;
|
ti << instr_counter << endl << timeout << endl << lowest_addr << endl << highest_addr << endl;
|
||||||
@ -59,9 +58,9 @@ bool EcosKernelTestCampaign::writeTraceInfo(unsigned instr_counter, unsigned tim
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EcosKernelTestCampaign::readTraceInfo(unsigned &instr_counter, unsigned &timeout, unsigned &lowest_addr, unsigned &highest_addr) {
|
bool EcosKernelTestCampaign::readTraceInfo(unsigned &instr_counter, unsigned &timeout, unsigned &lowest_addr, unsigned &highest_addr) {
|
||||||
ifstream file(traceinfo_name);
|
ifstream file(filename_traceinfo().c_str());
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
cout << "failed to open " << traceinfo_name << endl;
|
cout << "failed to open " << filename_traceinfo() << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,6 +90,43 @@ bool EcosKernelTestCampaign::readTraceInfo(unsigned &instr_counter, unsigned &ti
|
|||||||
return (count == 4);
|
return (count == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string EcosKernelTestCampaign::filename_memorymap(const std::string& variant, const std::string& benchmark)
|
||||||
|
{
|
||||||
|
if (variant.size() && benchmark.size()) {
|
||||||
|
return dir_prerequisites + "/" + variant + "_" + benchmark + "_" + "memorymap.txt";
|
||||||
|
}
|
||||||
|
return "memorymap.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string EcosKernelTestCampaign::filename_state(const std::string& variant, const std::string& benchmark)
|
||||||
|
{
|
||||||
|
if (variant.size() && benchmark.size()) {
|
||||||
|
return dir_prerequisites + "/" + variant + "_" + benchmark + "_" + "state";
|
||||||
|
}
|
||||||
|
return "state";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string EcosKernelTestCampaign::filename_trace(const std::string& variant, const std::string& benchmark)
|
||||||
|
{
|
||||||
|
if (variant.size() && benchmark.size()) {
|
||||||
|
return dir_prerequisites + "/" + variant + "_" + benchmark + "_" + "trace.tc";
|
||||||
|
}
|
||||||
|
return "trace.tc";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string EcosKernelTestCampaign::filename_traceinfo(const std::string& variant, const std::string& benchmark)
|
||||||
|
{
|
||||||
|
if (variant.size() && benchmark.size()) {
|
||||||
|
return dir_prerequisites + "/" + variant + "_" + benchmark + "_" + "traceinfo.txt";
|
||||||
|
}
|
||||||
|
return "traceinfo.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string EcosKernelTestCampaign::filename_results(const std::string& variant, const std::string& benchmark)
|
||||||
|
{
|
||||||
|
return dir_results + "/" + variant + "_" + benchmark + "_" + "results.csv";
|
||||||
|
}
|
||||||
|
|
||||||
// equivalence class type: addr, [i1, i2]
|
// equivalence class type: addr, [i1, i2]
|
||||||
// addr: byte to inject a bit-flip into
|
// addr: byte to inject a bit-flip into
|
||||||
// [i1, i2]: interval of instruction numbers, counted from experiment
|
// [i1, i2]: interval of instruction numbers, counted from experiment
|
||||||
@ -107,9 +143,9 @@ bool EcosKernelTestCampaign::run()
|
|||||||
|
|
||||||
// non-destructive: due to the CSV header we can always manually recover
|
// non-destructive: due to the CSV header we can always manually recover
|
||||||
// from an accident (append mode)
|
// from an accident (append mode)
|
||||||
ofstream results(results_filename, ios::out | ios::app);
|
ofstream results(filename_results("", "").c_str(), ios::out | ios::app); // FIXME one CSV for each variant/benchmark combination
|
||||||
if (!results.is_open()) {
|
if (!results.is_open()) {
|
||||||
log << "failed to open " << results_filename << endl;
|
log << "failed to open " << filename_results("", "") << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,9 +154,9 @@ bool EcosKernelTestCampaign::run()
|
|||||||
boost::timer t;
|
boost::timer t;
|
||||||
|
|
||||||
// load trace
|
// load trace
|
||||||
ifstream tracef(trace_filename);
|
ifstream tracef(filename_trace().c_str());
|
||||||
if (tracef.fail()) {
|
if (tracef.fail()) {
|
||||||
log << "couldn't open " << trace_filename << endl;
|
log << "couldn't open " << filename_trace() << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ProtoIStream ps(&tracef);
|
ProtoIStream ps(&tracef);
|
||||||
@ -131,7 +167,7 @@ bool EcosKernelTestCampaign::run()
|
|||||||
|
|
||||||
// a map of addresses of ECC protected objects
|
// a map of addresses of ECC protected objects
|
||||||
MemoryMap mm;
|
MemoryMap mm;
|
||||||
EcosKernelTestCampaign::readMemoryMap(mm, mm_filename);
|
EcosKernelTestCampaign::readMemoryMap(mm, filename_memorymap().c_str());
|
||||||
|
|
||||||
// set of equivalence classes that need one (rather: eight, one for
|
// set of equivalence classes that need one (rather: eight, one for
|
||||||
// each bit in that byte) experiment to determine them all
|
// each bit in that byte) experiment to determine them all
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "cpn/Campaign.hpp"
|
#include "cpn/Campaign.hpp"
|
||||||
#include "comm/ExperimentData.hpp"
|
#include "comm/ExperimentData.hpp"
|
||||||
#include "ecos_kernel_test.pb.h"
|
#include "ecos_kernel_test.pb.h"
|
||||||
@ -12,10 +14,18 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class EcosKernelTestCampaign : public fail::Campaign {
|
class EcosKernelTestCampaign : public fail::Campaign {
|
||||||
|
static const std::string dir_images;
|
||||||
|
static const std::string dir_prerequisites;
|
||||||
|
static const std::string dir_results;
|
||||||
public:
|
public:
|
||||||
virtual bool run();
|
virtual bool run();
|
||||||
static bool readMemoryMap(fail::MemoryMap &mm, char const * const filename);
|
static bool readMemoryMap(fail::MemoryMap &mm, char const * const filename);
|
||||||
static bool writeTraceInfo(unsigned instr_counter, unsigned timeout, unsigned lowest_addr, unsigned highest_addr);
|
static bool writeTraceInfo(unsigned instr_counter, unsigned timeout, unsigned lowest_addr, unsigned highest_addr);
|
||||||
static bool readTraceInfo(unsigned &instr_counter, unsigned &timeout, unsigned &lowest_addr, unsigned &highest_addr);
|
static bool readTraceInfo(unsigned &instr_counter, unsigned &timeout, unsigned &lowest_addr, unsigned &highest_addr);
|
||||||
|
static std::string filename_memorymap(const std::string& variant = "", const std::string& benchmark = "");
|
||||||
|
static std::string filename_state(const std::string& variant = "", const std::string& benchmark = "");
|
||||||
|
static std::string filename_trace(const std::string& variant = "", const std::string& benchmark = "");
|
||||||
|
static std::string filename_traceinfo(const std::string& variant = "", const std::string& benchmark = "");
|
||||||
|
static std::string filename_results(const std::string& variant, const std::string& benchmark);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -35,11 +35,6 @@ using namespace fail;
|
|||||||
#error This experiment needs: breakpoints, traps, save, and restore. Enable these in the configuration.
|
#error This experiment needs: breakpoints, traps, save, and restore. Enable these in the configuration.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char const * const mm_filename = "memory_map.txt";
|
|
||||||
char const * const statename = "ecos_kernel_test.state";
|
|
||||||
char const * const traceinfo_name = "trace_info.txt";
|
|
||||||
|
|
||||||
#if PREREQUISITES
|
#if PREREQUISITES
|
||||||
bool EcosKernelTestExperiment::retrieveGuestAddresses() {
|
bool EcosKernelTestExperiment::retrieveGuestAddresses() {
|
||||||
log << "STEP 0: record memory map with addresses of 'interesting' objects" << endl;
|
log << "STEP 0: record memory map with addresses of 'interesting' objects" << endl;
|
||||||
@ -49,9 +44,9 @@ bool EcosKernelTestExperiment::retrieveGuestAddresses() {
|
|||||||
bp.setWatchInstructionPointer(ECOS_FUNC_FINISH);
|
bp.setWatchInstructionPointer(ECOS_FUNC_FINISH);
|
||||||
|
|
||||||
// memory map serialization
|
// memory map serialization
|
||||||
ofstream mm(mm_filename, ios::out | ios::app);
|
ofstream mm(EcosKernelTestCampaign::filename_memorymap().c_str(), ios::out);
|
||||||
if (!mm.is_open()) {
|
if (!mm.is_open()) {
|
||||||
log << "failed to open " << mm_filename << endl;
|
log << "failed to open " << EcosKernelTestCampaign::filename_memorymap() << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +113,7 @@ bool EcosKernelTestExperiment::establishState() {
|
|||||||
log << "test function entry reached, saving state" << endl;
|
log << "test function entry reached, saving state" << endl;
|
||||||
log << "EIP = " << hex << bp.getTriggerInstructionPointer() << endl;
|
log << "EIP = " << hex << bp.getTriggerInstructionPointer() << endl;
|
||||||
//log << "error_corrected = " << dec << ((int)simulator.getMemoryManager().getByte(ECC_ERROR_CORRECTED)) << endl;
|
//log << "error_corrected = " << dec << ((int)simulator.getMemoryManager().getByte(ECC_ERROR_CORRECTED)) << endl;
|
||||||
simulator.save(statename);
|
simulator.save(EcosKernelTestCampaign::filename_state());
|
||||||
assert(bp.getTriggerInstructionPointer() == ECOS_FUNC_ENTRY);
|
assert(bp.getTriggerInstructionPointer() == ECOS_FUNC_ENTRY);
|
||||||
assert(simulator.getRegisterManager().getInstructionPointer() == ECOS_FUNC_ENTRY);
|
assert(simulator.getRegisterManager().getInstructionPointer() == ECOS_FUNC_ENTRY);
|
||||||
|
|
||||||
@ -131,7 +126,7 @@ bool EcosKernelTestExperiment::performTrace() {
|
|||||||
log << "STEP 2: record trace for fault-space pruning" << endl;
|
log << "STEP 2: record trace for fault-space pruning" << endl;
|
||||||
|
|
||||||
log << "restoring state" << endl;
|
log << "restoring state" << endl;
|
||||||
simulator.restore(statename);
|
simulator.restore(EcosKernelTestCampaign::filename_state());
|
||||||
log << "EIP = " << hex << simulator.getRegisterManager().getInstructionPointer() << endl;
|
log << "EIP = " << hex << simulator.getRegisterManager().getInstructionPointer() << endl;
|
||||||
assert(simulator.getRegisterManager().getInstructionPointer() == ECOS_FUNC_ENTRY);
|
assert(simulator.getRegisterManager().getInstructionPointer() == ECOS_FUNC_ENTRY);
|
||||||
|
|
||||||
@ -140,7 +135,7 @@ bool EcosKernelTestExperiment::performTrace() {
|
|||||||
|
|
||||||
// restrict memory access logging to injection target
|
// restrict memory access logging to injection target
|
||||||
MemoryMap mm;
|
MemoryMap mm;
|
||||||
EcosKernelTestCampaign::readMemoryMap(mm, mm_filename);
|
EcosKernelTestCampaign::readMemoryMap(mm, EcosKernelTestCampaign::filename_memorymap().c_str());
|
||||||
|
|
||||||
tp.restrictMemoryAddresses(&mm);
|
tp.restrictMemoryAddresses(&mm);
|
||||||
|
|
||||||
@ -281,7 +276,7 @@ bool EcosKernelTestExperiment::faultInjection() {
|
|||||||
<< " mem " << mem_addr << "+" << bit_offset << endl;
|
<< " mem " << mem_addr << "+" << bit_offset << endl;
|
||||||
|
|
||||||
log << "restoring state" << endl;
|
log << "restoring state" << endl;
|
||||||
simulator.restore(statename);
|
simulator.restore(EcosKernelTestCampaign::filename_state(m_variant, m_benchmark));
|
||||||
|
|
||||||
// XXX debug
|
// XXX debug
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
class EcosKernelTestExperiment : public fail::ExperimentFlow {
|
class EcosKernelTestExperiment : public fail::ExperimentFlow {
|
||||||
fail::JobClient m_jc;
|
fail::JobClient m_jc;
|
||||||
fail::Logger log;
|
fail::Logger log;
|
||||||
|
std::string m_variant, m_benchmark;
|
||||||
public:
|
public:
|
||||||
EcosKernelTestExperiment() : log("eCos Kernel Test", false) {}
|
EcosKernelTestExperiment() : log("eCos Kernel Test", false) {}
|
||||||
bool run();
|
bool run();
|
||||||
|
|||||||
Reference in New Issue
Block a user