Files
fail/src/experiments/dosek/experiment.cc
Christian Dietrich 1e572faa04 dosek: merge trace and test experiment
With the instantiate-indirect.ah method, we can choose between different
experiment flows at runtime. By this, we can combine tracing and actual
injection into one fail-client binary. A -Wf,--mode={tester,tracer}
switch does hand the control to different experiment flows.

Change-Id: Ia268489ff6bc74dffea745b7aedcb36e262e8079
2015-09-18 12:51:57 +02:00

41 lines
1.1 KiB
C++

#include "tester.hpp"
#include "sal/SALInst.hpp"
#include "util/Logger.hpp"
#include "util/CommandLine.hpp"
#include "tester.hpp"
#include "tracer.hpp"
using namespace fail;
using namespace std;
static fail::Logger m_log("dOSEK FAIL* Client");
void instantiatedOSEK()
{
CommandLine &cmd = CommandLine::Inst();
cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>\n\n");
CommandLine::option_handle MODE = cmd.addOption("", "mode", Arg::Required,
"--mode \t Mode: tracer, tester (default: tester)");
if (!cmd.parse()) {
std::cerr << "Error parsing arguments." << endl;
simulator.terminate(-1);
}
std::string mode = "tester";
if (cmd[MODE].count() > 0)
mode = std::string(cmd[MODE].first()->arg);
m_log << "Handing over to " << mode << " mode" << std::endl;
if (mode == "tester") {
fail::simulator.addFlow(new dOSEKTester);
} else if (mode == "tracer") {
fail::simulator.addFlow(new dOSEKTracer);
} else {
std::cerr << "Invalid mode: " << mode << " (available: tracer, tester)" << std::endl;
simulator.terminate(-1);
}
}