X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FUtils%2FTest%2FUtilsTest.cxx;h=8a3d1dab2eb1ec78b1223fd1b0d6d493efa982ae;hb=d2cad0f565b5c83ce4d823b757f57d1c78f13e9d;hp=aa6f9e302d706389c8ab3c19b4b8e28010707132;hpb=0fac7040be417aab7228a4e23904b4cf22a8dda4;p=modules%2Fkernel.git diff --git a/src/Utils/Test/UtilsTest.cxx b/src/Utils/Test/UtilsTest.cxx index aa6f9e302..8a3d1dab2 100644 --- a/src/Utils/Test/UtilsTest.cxx +++ b/src/Utils/Test/UtilsTest.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -28,38 +28,46 @@ #include #include "Utils_SALOME_Exception.hxx" #include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" #include "utilities.h" +#include "KernelBasis.hxx" #ifdef WIN32 #define setenv Kernel_Utils::setenv -#endif - -#define TRACEFILE "/tmp/traceUnitTest.log" +#endif // ============================================================================ /*! - * Set Trace mecanism + * Set Trace mechanism * - delete preexisting trace classes if any * - set trace on file */ // ============================================================================ -void +std::string +UtilsTest::_getTraceFileName() +{ + std::string dir = Kernel_Utils::GetTmpDir(); + return dir + "traceUnitTest-UtilsTest.log"; +} + +void UtilsTest::setUp() { + setSSLMode(false); LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); CPPUNIT_ASSERT(bp1); bp1->deleteInstance(bp1); // --- trace on file - const char *theFileName = TRACEFILE; + std::string theFileName = _getTraceFileName(); std::string s = "file:"; s += theFileName; CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite std::ofstream traceFile; - traceFile.open(theFileName, std::ios::out | std::ios::app); + traceFile.open(theFileName.c_str(), std::ios::out | std::ios::app); CPPUNIT_ASSERT(traceFile); // file created empty, then closed traceFile.close(); @@ -73,7 +81,7 @@ UtilsTest::setUp() */ // ============================================================================ -void +void UtilsTest::tearDown() { LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); @@ -84,11 +92,11 @@ UtilsTest::tearDown() int genExcept() { throw SALOME_Exception("a message"); -}; +} // ============================================================================ /*! - * Check basic SALOME_exception mecanism + * Check basic SALOME_exception mechanism */ // ============================================================================