mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add separate target for unit tests for easier test access. Remove unit tests from ResInsight application. (#11184)
Clean up cmake configuration a bit, and pull down gtest when needed, no longer use a thirdparty subfolder Add a ResInsight-tests target to run the unit tests
This commit is contained in:
@@ -125,10 +125,6 @@
|
||||
#include <unistd.h> // for usleep
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef USE_UNIT_TESTS
|
||||
#include "gtest/gtest.h"
|
||||
#endif // USE_UNIT_TESTS
|
||||
|
||||
// Required to ignore warning of usused variable when defining caf::PdmMarkdownGenerator
|
||||
#if defined( __clang__ )
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
@@ -1395,56 +1391,6 @@ void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
|
||||
m_commandQueueLock.unlock();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaApplication::launchUnitTests()
|
||||
{
|
||||
#ifdef USE_UNIT_TESTS
|
||||
|
||||
caf::ProgressInfoBlocker progressBlocker;
|
||||
cvf::Assert::setReportMode( cvf::Assert::CONSOLE );
|
||||
|
||||
int argc = QCoreApplication::arguments().size();
|
||||
QStringList arguments = QCoreApplication::arguments();
|
||||
std::vector<std::string> argumentsStd;
|
||||
for ( QString qstring : arguments )
|
||||
{
|
||||
argumentsStd.push_back( qstring.toStdString() );
|
||||
}
|
||||
std::vector<char*> argVector;
|
||||
for ( std::string& string : argumentsStd )
|
||||
{
|
||||
argVector.push_back( &string.front() );
|
||||
}
|
||||
char** argv = argVector.data();
|
||||
|
||||
testing::InitGoogleTest( &argc, argv );
|
||||
|
||||
//
|
||||
// Use the gtest filter to execute a subset of tests
|
||||
QString filterText = RiaPreferencesSystem::current()->gtestFilter();
|
||||
if ( !filterText.isEmpty() )
|
||||
{
|
||||
::testing::GTEST_FLAG( filter ) = filterText.toStdString();
|
||||
|
||||
// Example on filter syntax
|
||||
//::testing::GTEST_FLAG( filter ) = "*RifCaseRealizationParametersReaderTest*";
|
||||
}
|
||||
|
||||
// Use this macro in main() to run all tests. It returns 0 if all
|
||||
// tests are successful, or 1 otherwise.
|
||||
//
|
||||
// RUN_ALL_TESTS() should be invoked after the command line has been
|
||||
// parsed by InitGoogleTest().
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1562,14 +1508,6 @@ void RiaApplication::initialize()
|
||||
caf::SelectionManager::instance()->setPdmRootObject( project() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaApplication::launchUnitTestsWithConsole()
|
||||
{
|
||||
return launchUnitTests();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user