Support for running specific unit tests without breaking existing tests with argument '0'

This commit is contained in:
ml 2016-11-06 16:05:20 -08:00 committed by wmayer
parent 6347d48449
commit 02b3883f7e
2 changed files with 17 additions and 22 deletions

View File

@ -1024,7 +1024,7 @@ void my_trans_func( unsigned int code, EXCEPTION_POINTERS* pExp )
//switch (code) //switch (code)
//{ //{
// case FLT_DIVIDE_BY_ZERO : // case FLT_DIVIDE_BY_ZERO :
// //throw CMyFunkyDivideByZeroException(code, pExp); // //throw CMyFunkyDivideByZeroException(code, pExp);
// throw Base::Exception("Devision by zero!"); // throw Base::Exception("Devision by zero!");
// break; // break;
@ -1145,7 +1145,7 @@ void Application::initTypes(void)
App ::GeoFeatureGroupExtensionPython::init(); App ::GeoFeatureGroupExtensionPython::init();
App ::OriginGroupExtension ::init(); App ::OriginGroupExtension ::init();
App ::OriginGroupExtensionPython ::init(); App ::OriginGroupExtensionPython ::init();
// Document classes // Document classes
App ::TransactionalObject ::init(); App ::TransactionalObject ::init();
App ::DocumentObject ::init(); App ::DocumentObject ::init();
@ -1675,7 +1675,7 @@ void Application::ParseOptions(int ac, char ** av)
("log-file", value<string>(), "Unlike to --write-log this allows to log to an arbitrary file") ("log-file", value<string>(), "Unlike to --write-log this allows to log to an arbitrary file")
("user-cfg,u", value<string>(),"User config file to load/save user settings") ("user-cfg,u", value<string>(),"User config file to load/save user settings")
("system-cfg,s", value<string>(),"Systen config file to load/save system settings") ("system-cfg,s", value<string>(),"Systen config file to load/save system settings")
("run-test,t", value<int>() ,"Test level") ("run-test,t", value<string>() ,"Test case - or 0 for all")
("module-path,M", value< vector<string> >()->composing(),"Additional module paths") ("module-path,M", value< vector<string> >()->composing(),"Additional module paths")
("python-path,P", value< vector<string> >()->composing(),"Additional python paths") ("python-path,P", value< vector<string> >()->composing(),"Additional python paths")
("single-instance", "Allow to run a single instance of the application") ("single-instance", "Allow to run a single instance of the application")
@ -1884,21 +1884,14 @@ void Application::ParseOptions(int ac, char ** av)
} }
if (vm.count("run-test")) { if (vm.count("run-test")) {
int level = vm["run-test"].as<int>(); string testCase = vm["run-test"].as<string>();
switch (level) { if ( "0" == testCase) {
case '0': testCase = "TestApp.All";
// test script level 0 }
mConfig["RunMode"] = "Internal"; mConfig["TestCase"] = testCase;
mConfig["ScriptFileName"] = "FreeCADTest"; mConfig["RunMode"] = "Internal";
//sScriptName = FreeCADTest; mConfig["ScriptFileName"] = "FreeCADTest";
break; //sScriptName = FreeCADTest;
default:
//default testing level 0
mConfig["RunMode"] = "Internal";
mConfig["ScriptFileName"] = "FreeCADTest";
//sScriptName = FreeCADTest;
break;
};
} }
if (vm.count("single-instance")) { if (vm.count("single-instance")) {
@ -2161,7 +2154,7 @@ std::string Application::FindHomePath(const char* sCall)
// path. In the worst case we simply get q wrong path and FreeCAD is not // path. In the worst case we simply get q wrong path and FreeCAD is not
// able to load its modules. // able to load its modules.
char resolved[PATH_MAX]; char resolved[PATH_MAX];
#if defined(FC_OS_BSD) #if defined(FC_OS_BSD)
int mib[4]; int mib[4];
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_PROC; mib[1] = KERN_PROC;

View File

@ -1,7 +1,7 @@
# FreeCAD test module # FreeCAD test module
# (c) 2002 Juergen Riegel # (c) 2002 Juergen Riegel
# #
# Testing the function of the base system and run # Testing the function of the base system and run
# (if existing) the test function of the modules # (if existing) the test function of the modules
# #
@ -34,7 +34,9 @@ Log ("FreeCAD test running...\n\n")
import TestApp, sys import TestApp, sys
testResult = TestApp.TestText("TestApp.All") testCase = FreeCAD.ConfigGet("TestCase")
testResult = TestApp.TestText(testCase)
Log ("FreeCAD test done\n") Log ("FreeCAD test done\n")