Ticket #2488: cxxtest_fix2.patch
File cxxtest_fix2.patch, 11.2 KB (added by , 10 years ago) |
---|
-
build/premake/premake4.lua
diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index 1f5951f..c8b9488 100644
a b function configure_cxxtestgen() 1304 1304 local lcxxtestrootoptions = "--have-std" 1305 1305 1306 1306 if _OPTIONS["jenkins-tests"] then 1307 lcxxtestrootoptions = lcxxtestrootoptions .. " -- gui=PsTestWrapper --runner=XmlPrinter"1307 lcxxtestrootoptions = lcxxtestrootoptions .. " --runner=XmlPrinter" 1308 1308 else 1309 1309 if os.is("windows") then 1310 lcxxtestrootoptions = lcxxtestrootoptions .. " -- gui=PsTestWrapper --runner=Win32ODSPrinter"1310 lcxxtestrootoptions = lcxxtestrootoptions .. " --runner=Win32ODSPrinter" 1311 1311 else 1312 lcxxtestrootoptions = lcxxtestrootoptions .. " -- gui=PsTestWrapper --runner=ErrorPrinter"1312 lcxxtestrootoptions = lcxxtestrootoptions .. " --runner=ErrorPrinter" 1313 1313 end 1314 1314 end 1315 1315 -
new file libraries/source/cxxtest-4.4/cxxtest/PsExtensions.cpp
diff --git a/libraries/source/cxxtest-4.4/cxxtest/PsExtensions.cpp b/libraries/source/cxxtest-4.4/cxxtest/PsExtensions.cpp new file mode 100644 index 0000000..e633195
- + 1 namespace CxxTest 2 { 3 bool g_RunDisabled = false; 4 } -
deleted file libraries/source/cxxtest-4.4/cxxtest/PsTestWrapper.cpp
diff --git a/libraries/source/cxxtest-4.4/cxxtest/PsTestWrapper.cpp b/libraries/source/cxxtest-4.4/cxxtest/PsTestWrapper.cpp deleted file mode 100644 index 981b475..0000000
+ - 1 #include <cxxtest/PsTestWrapper.h>2 3 namespace CxxTest4 {5 const char *g_PsArgv0 = NULL;6 const char *g_PsOnlySuite = NULL;7 const char *g_PsOnlyTest = NULL;8 bool g_PsListSuites = false;9 } -
deleted file libraries/source/cxxtest-4.4/cxxtest/PsTestWrapper.h
diff --git a/libraries/source/cxxtest-4.4/cxxtest/PsTestWrapper.h b/libraries/source/cxxtest-4.4/cxxtest/PsTestWrapper.h deleted file mode 100644 index 59be0c4..0000000
+ - 1 #ifndef __cxxtest__PsTestWrapper_h__2 #define __cxxtest__PsTestWrapper_h__3 4 #include <cstdio>5 6 #include <cxxtest/Gui.h>7 // (This is not actually a GUI, but we use the CxxTest GUI mechanism8 // to capture argv and do some special processing)9 10 // We want this to act like Win32Gui on Windows, but like the default11 // empty undisplayed GUI elsewhere12 #ifdef _WIN3213 # define PS_TEST_WRAPPER_BASE Win32Gui14 # include <cxxtest/Win32Gui.h>15 #else16 # define PS_TEST_WRAPPER_BASE GuiListener17 #endif18 19 #include "ps/DllLoader.h"20 21 namespace CxxTest22 {23 extern const char *g_PsArgv0;24 extern const char *g_PsOnlySuite;25 extern const char *g_PsOnlyTest;26 extern bool g_PsListSuites;27 28 class PsTestRunner : public TestRunner29 {30 public:31 static void runAllTests( TestListener &listener )32 {33 // Code copied from TestRunner:34 tracker().setListener( &listener );35 _TS_TRY { PsTestRunner().runWorld(); }36 _TS_LAST_CATCH( { tracker().failedTest( __FILE__, __LINE__, "Exception thrown from world" ); } );37 tracker().setListener( 0 );38 }39 40 void runWorld()41 {42 RealWorldDescription wd;43 WorldGuard sg;44 45 // Print all the (initially active) test suites, as an46 // occasionally handy test-runner-debugging feature47 if ( g_PsListSuites )48 for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() )49 if ( sd->active() )50 printf( "%s\n", sd->suiteName() );51 52 // Allow all but one suite/test to be disabled53 if ( g_PsOnlySuite ) {54 for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() ) {55 if ( stringsEqual( sd->suiteName(), g_PsOnlySuite ) ) {56 for ( TestDescription *td = sd->firstTest(); td; td = td->next() )57 if ( g_PsOnlyTest && !stringsEqual( td->testName(), g_PsOnlyTest ) )58 td->setActive( false );59 } else {60 sd->setActive( false );61 }62 }63 }64 else65 {66 // By default, disable all tests with names containing "DISABLED"67 // (they can only be run by explicitly naming the suite/test)68 for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() ) {69 for ( TestDescription *td = sd->firstTest(); td; td = td->next() )70 if ( strstr( td->testName(), "DISABLED" ) )71 td->setActive( false );72 }73 }74 75 // Code copied from TestRunner:76 tracker().enterWorld( wd );77 if ( wd.setUp() ) {78 for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() )79 if ( sd->active() ) {80 runSuite( *sd );81 }82 wd.tearDown();83 }84 tracker().leaveWorld( wd );85 }86 };87 88 class PsTestWrapper : public PS_TEST_WRAPPER_BASE89 {90 public:91 virtual void runGui( int &argc, char **argv, TestListener &listener )92 {93 parseCommandLine( argc, argv );94 enterGui( argc, argv );95 PsTestRunner::runAllTests( listener );96 leaveGui();97 }98 private:99 void parseCommandLine( int argc, char **argv )100 {101 g_PsArgv0 = argv[0];102 103 for ( int i = 1; i < argc; ++i ) {104 if ( !strcmp( argv[i], "-test" ) && (i + 1 < argc) ) {105 char *test = argv[++i];106 // Try splitting as "suite::test", else use the whole string as the suite name107 char *colons = strstr( test, "::" );108 if ( colons ) {109 colons[0] = '\0'; // (modifying argv is safe enough)110 g_PsOnlySuite = test;111 g_PsOnlyTest = colons + 2;112 } else {113 g_PsOnlySuite = test;114 }115 } else if ( !strcmp( argv[i], "-list" ) ) {116 g_PsListSuites = true;117 } else if ( !strcmp( argv[i], "-libdir" ) ) {118 DllLoader::OverrideLibdir( argv[++i] );119 } else {120 fprintf( stderr, "Unrecognized command line option '%s'\n", argv[i] );121 fprintf( stderr, "Permitted options:\n" );122 fprintf( stderr, " %s -list\n", argv[0] );123 fprintf( stderr, " %s -test TestSuiteName\n", argv[0] );124 fprintf( stderr, " %s -test TestSuiteName::test_case_name\n", argv[0] );125 fprintf( stderr, " %s -libdir .\n", argv[0] );126 fprintf( stderr, "\n" );127 }128 }129 }130 };131 }132 133 #endif // __cxxtest__PsTestWrapper_h__ -
libraries/source/cxxtest-4.4/cxxtest/RealDescriptions.cpp
diff --git a/libraries/source/cxxtest-4.4/cxxtest/RealDescriptions.cpp b/libraries/source/cxxtest-4.4/cxxtest/RealDescriptions.cpp index 60b4f20..16adad0 100644
a b unsigned RealWorldDescription::numTotalTests(void) const 248 248 unsigned count = 0; 249 249 for (const SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next()) 250 250 { 251 count += sd->numTests(); 251 if (g_RunDisabled) 252 count += sd->numTests(); 253 else 254 { 255 for (const TestDescription *td = sd->firstTest(); td != 0; td = td->next()) 256 { 257 if (!strstr(td->testName(), "DISABLED")) 258 count++; 259 } 260 } 252 261 } 253 262 return count; 254 263 } -
libraries/source/cxxtest-4.4/cxxtest/Root.cpp
diff --git a/libraries/source/cxxtest-4.4/cxxtest/Root.cpp b/libraries/source/cxxtest-4.4/cxxtest/Root.cpp index dd6f1eb..809d1fc 100644
a b 25 25 #include <cxxtest/RealDescriptions.cpp> 26 26 #include <cxxtest/TestSuite.cpp> 27 27 #include <cxxtest/TestTracker.cpp> 28 #include <cxxtest/Ps TestWrapper.cpp>28 #include <cxxtest/PsExtensions.cpp> 29 29 30 30 #endif // __cxxtest__Root_cpp__ -
libraries/source/cxxtest-4.4/cxxtest/TestMain.h
diff --git a/libraries/source/cxxtest-4.4/cxxtest/TestMain.h b/libraries/source/cxxtest-4.4/cxxtest/TestMain.h index c4d14bb..0666505 100644
a b 30 30 # include <cstring> 31 31 #endif // _CXXTEST_OLD_STD 32 32 33 #include "ps/DllLoader.h" 34 33 35 namespace CxxTest 34 36 { 35 37 … … int Main(TesterT& tmp, int argc, char* argv[]) 84 86 // 85 87 while ((argc > 1) && (argv[1][0] == '-')) 86 88 { 89 int args = 1; 87 90 if (CXXTEST_STD(strcmp)(argv[1], "-v") == 0) 88 91 { 89 92 tracker().print_tracing = true; 90 93 } 94 else if (CXXTEST_STD(strcmp)(argv[1], "-libdir") == 0) 95 { 96 if (argc < 2) 97 { 98 CXXTEST_STD(cerr) << "ERROR: not enough arguments" << CXXTEST_STD(endl); 99 return -1; 100 } 101 DllLoader::OverrideLibdir(argv[2]); 102 args = 2; 103 } 104 else if (CXXTEST_STD(strcmp)(argv[1], "-disabled") == 0) 105 { 106 g_RunDisabled = true; 107 } 91 108 else 92 109 { 93 110 CXXTEST_STD(cerr) << "ERROR: unknown option '" << argv[1] << "'" << CXXTEST_STD(endl); 94 111 return -1; 95 112 } 96 for (int i = 1; i < (argc - 1); i++)113 for (int i = 1; i < (argc - args); i++) 97 114 { 98 argv[i] = argv[i + 1];115 argv[i] = argv[i + args]; 99 116 } 100 argc --;117 argc -= args; 101 118 } 102 119 103 120 // -
libraries/source/cxxtest-4.4/cxxtest/TestRunner.h
diff --git a/libraries/source/cxxtest-4.4/cxxtest/TestRunner.h b/libraries/source/cxxtest-4.4/cxxtest/TestRunner.h index ef914fa..9c10fac 100644
a b 25 25 26 26 namespace CxxTest 27 27 { 28 extern bool g_RunDisabled; 29 28 30 class TestRunner 29 31 { 30 friend class PsTestRunner;31 32 32 public: 33 33 34 34 static void setListener(TestListener* listener) … … private: 84 84 { 85 85 for (TestDescription *td = sd.firstTest(); td; td = td->next()) 86 86 { 87 if ( td->active())87 if ((g_RunDisabled || !strstr(td->testName(), "DISABLED")) && td->active()) 88 88 { 89 89 runTest(*td); 90 90 } -
libraries/source/cxxtest-4.4/cxxtest/TestTracker.h
diff --git a/libraries/source/cxxtest-4.4/cxxtest/TestTracker.h b/libraries/source/cxxtest-4.4/cxxtest/TestTracker.h index b1a1f4f..50e59bc 100644
a b private: 122 122 void countSkipped(); 123 123 124 124 friend class TestRunner; 125 friend class PsTestRunner;126 125 127 126 TestTracker(); 128 127 void setListener(TestListener *l); -
source/lib/sysdep/tests/test_sysdep.h
diff --git a/source/lib/sysdep/tests/test_sysdep.h b/source/lib/sysdep/tests/test_sysdep.h index faad5d0..0ebf6bb 100644
a b 33 33 # include "mocks/unistd.h" 34 34 #endif 35 35 36 #include <cxxtest/PsTestWrapper.h>37 38 36 class TestSysdep : public CxxTest::TestSuite 39 37 { 40 38 public: