Commit 4dfef687 authored by Marco Amagliani's avatar Marco Amagliani
Browse files

unified method to log checksum. Removed file line in main report.txt....

unified method to log checksum. Removed file line in main report.txt. Increased test time limit to 20 minutes.
Checksum format chages for ERROR and WARNING. Rebased all test accordingly.

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 14051]
parent 9b7e2694
......@@ -7,7 +7,6 @@ set(my_headers
${CMAKE_CURRENT_SOURCE_DIR}/TestResult.hh
${CMAKE_CURRENT_SOURCE_DIR}/ReadValuesT.hh
${CMAKE_CURRENT_SOURCE_DIR}/StreamContainerT.hh
${CMAKE_CURRENT_SOURCE_DIR}/TestStream.hh
PARENT_SCOPE
)
......@@ -21,6 +20,5 @@ set(my_sources
${CMAKE_CURRENT_SOURCE_DIR}/ChecksumFile.cc
${CMAKE_CURRENT_SOURCE_DIR}/ChecksumLogValue.cc
${CMAKE_CURRENT_SOURCE_DIR}/IChecksum.cc
${CMAKE_CURRENT_SOURCE_DIR}/TestStream.cc
PARENT_SCOPE
)
......@@ -12,7 +12,6 @@
#include "ChecksumDebugEvent.hh"
#include "TestResult.hh"
#include "TestStream.hh"
#include "Base/Code/CodeLink.hh"
#include "Base/Debug/DebOut.hh"
......@@ -25,15 +24,14 @@ namespace Debug {
void Event::record(const std::string& _evnt, const Base::CodeLink& _lnk)
{
Result res(name() == ::Debug::ERROR ? Result::ERROR : Result::WARNING);
stream_out() << res << " " << name() << "#" << nmbr_++ << ": " << _evnt
<< _lnk << std::endl;
IChecksum::record(res) << "#" << nmbr_++ << ": " << _evnt << _lnk << std::endl;
}
void Event::record_number() const
{
Result res(nmbr_ == 0 ? Result::OK : // the checksum will appear in all cases
(name() == ::Debug::ERROR ? Result::ERROR : Result::WARNING));
stream_out() << res << " " << name() << " total#: " << nmbr_ << std::endl;
IChecksum::record(res) << " total#: " << nmbr_ << std::endl;
}
Severity Event::compare(
......
......@@ -13,7 +13,6 @@
#include "ChecksumLogValueT.hh"
#include "ReadValuesT.hh"
#include "StreamContainerT.hh"
#include "TestStream.hh"
#include "Base/Debug/DebOut.hh"
......@@ -86,7 +85,7 @@ Severity LogValueT<ValueT, CompareT>::compare(IStream& _str0, IStream& _str1,
template <typename ValueT, class CompareT>
void LogValueT<ValueT, CompareT>::record(const Result& _rep_res, const ValueT& _val)
{
stream_out() << _rep_res << " " << name() << ": " << _val << std::endl;
IChecksum::record(_rep_res) << _val << std::endl;
}
}//namespace Checksum
......
......@@ -3,6 +3,7 @@
#include "IChecksum.hh"
#include <fstream>
#include <iostream>
namespace Test {
......@@ -36,6 +37,13 @@ IChecksum::IChecksum(const char * _name) : name_(_name)
}
}
std::ofstream& IChecksum::record(const Result& _rep_res) const
{
static std::ofstream test_str(REPORT_FILENAME);
test_str << _rep_res << " " << name() << ": ";
return test_str;
}
}//Checksum
}//namespace Test
......
......@@ -20,6 +20,7 @@
#include <Base/Test/TestResult.hh>
#include <map>
#include <fstream>
#include <sstream>
namespace Test {
......@@ -58,6 +59,8 @@ protected:
*/
IChecksum(const char* _name);
std::ofstream& record(const Result& _rep_res) const;
private:
const char* name_;
};
......
// (C) Copyright 2016 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary
// to Autodesk, Inc., and considered a trade secret as defined
// in section 499C of the penal code of the State of California.
// Use of this information by anyone other than authorized
// employees of Autodesk, Inc. is granted only under a written
// non-disclosure agreement, expressly prescribing the scope
// and manner of such use.
#ifdef TEST_ON
#include "TestStream.hh"
#include "types.hh"
#include <boost/filesystem.hpp>
namespace Test {
// stream_out a stream of a file opened at first call of tis function.
// In future it will have to return a different stream for every thread.
// It is important that no one calls this function after that the stream has been
// destroyed. Static objects are destroyed in inverse order of creation, so it
// is not safe to call this function from the destructor of a static object,
// unless you ensure that this function has already be called. For example:
// int f() {
// stream();
// static ClassThatUseStreamInDestructor obj;
// ...
// }
std::ofstream& stream_out()
{
static std::ofstream test_str(REPORT_FILENAME);
return test_str;
}
}//namespace Test
#endif//TEST_ON
// (C) Copyright 2016 by Autodesk, Inc.
//
// The information contained herein is confidential, proprietary
// to Autodesk, Inc., and considered a trade secret as defined
// in section 499C of the penal code of the State of California.
// Use of this information by anyone other than authorized
// employees of Autodesk, Inc. is granted only under a written
// non-disclosure agreement, expressly prescribing the scope
// and manner of such use.
#ifndef BASE_TESTSTTREAM_HH_INCLUDED
#define BASE_TESTSTTREAM_HH_INCLUDED
#ifdef TEST_ON
#include "types.hh"
#include <fstream>
namespace Test {
// Test stream for writing.
std::ofstream& stream_out();
}//namespace Test
#endif//TEST_ON
#endif//BASE_TESTSTTREAM_HH_INCLUDED
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