Commit f3f003e3 authored by Martin Marinov's avatar Martin Marinov
Browse files

Synchronize thread output to the test checksum report stream.

parent d5b0d484
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "Base/Debug/DebCallStack.hh" #include "Base/Debug/DebCallStack.hh"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <mutex>
namespace Test { namespace Test {
namespace Checksum { namespace Checksum {
...@@ -137,20 +138,24 @@ Difference Object::compare( ...@@ -137,20 +138,24 @@ Difference Object::compare(
void Object::add(const Result& _rslt, const String& _data) void Object::add(const Result& _rslt, const String& _data)
{ {
static std::mutex mtx; //synchronize access to the checksum report stream
std::lock_guard<std::mutex> lock(mtx);
static Base::OutputStreamAdaptT<std::ofstream> test_str(REPORT_FILENAME); static Base::OutputStreamAdaptT<std::ofstream> test_str(REPORT_FILENAME);
static bool tag_out = false; static bool tag_out = false;
#ifdef DEB_ON #ifdef DEB_ON
static String prev_call_stck; static String prev_call_stck;
String call_stck("/"); String call_stck("/");
Debug::CallStack::query().append(call_stck); Debug::CallStack::query().append(call_stck);
if (prev_call_stck != call_stck) if (prev_call_stck != call_stck)
{ {
test_str << call_stck << Base::LF; test_str << call_stck << Base::LF;
prev_call_stck = call_stck; prev_call_stck = call_stck;
} }
#endif//DEB_ON #endif//DEB_ON
if (!tag_out) if (!tag_out)
{ {
tag_out = true; tag_out = true;
......
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