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

@ -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")) {

View File

@ -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")