Commit 982ab8f4 authored by Joseph Mirabel's avatar Joseph Mirabel

[TracerRealTime] Fix addSignalToTrace for exception handling

parent 57f773ff
......@@ -88,11 +88,12 @@ Tracer::Tracer(const std::string n)
void Tracer::addSignalToTrace(const SignalBase<int> &sig,
const string &filename) {
dgDEBUGIN(15);
// openFile may throw so it should be called first.
if (namesSet)
openFile(sig, filename);
toTraceSignals.push_back(&sig);
dgDEBUGF(15, "%p", &sig);
names.push_back(filename);
if (namesSet)
openFile(sig, filename);
triger.addDependency(sig);
dgDEBUGOUT(15);
}
......
......@@ -65,11 +65,16 @@ BOOST_AUTO_TEST_CASE(test_tracer) {
std::string basename("my-tracer");
std::string suffix(".dat");
/// Test openfiles
atracer.setBufferSize(1<<14);
atracer.openFiles(rootdir, basename, suffix);
/// Add trace by name
// Check that an exception is thrown if the filename is invalid.
atracer.openFiles(rootdir, "invalid/filename", suffix);
BOOST_CHECK_THROW(atracer.addSignalToTraceByName("my-entity.out_double", "output"),
ExceptionTraces);
// Test openfiles
atracer.openFiles(rootdir, basename, suffix);
// Add trace by name
atracer.addSignalToTraceByName("my-entity.out_double", "output");
/// Add trace by name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment