Skip to content

Commit

Permalink
Support for running specific unit tests without breaking existing tes…
Browse files Browse the repository at this point in the history
…ts with argument '0'
  • Loading branch information
mlampert authored and wwmayer committed Nov 7, 2016
1 parent 6347d48 commit 02b3883
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
31 changes: 12 additions & 19 deletions src/App/Application.cpp
Expand Up @@ -1024,7 +1024,7 @@ void my_trans_func( unsigned int code, EXCEPTION_POINTERS* pExp )

//switch (code)
//{
// case FLT_DIVIDE_BY_ZERO :
// case FLT_DIVIDE_BY_ZERO :
// //throw CMyFunkyDivideByZeroException(code, pExp);
// throw Base::Exception("Devision by zero!");
// break;
Expand Down Expand Up @@ -1145,7 +1145,7 @@ void Application::initTypes(void)
App ::GeoFeatureGroupExtensionPython::init();
App ::OriginGroupExtension ::init();
App ::OriginGroupExtensionPython ::init();

// Document classes
App ::TransactionalObject ::init();
App ::DocumentObject ::init();
Expand Down Expand Up @@ -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")
("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")
("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")
("python-path,P", value< vector<string> >()->composing(),"Additional python paths")
("single-instance", "Allow to run a single instance of the application")
Expand Down Expand Up @@ -1884,21 +1884,14 @@ void Application::ParseOptions(int ac, char ** av)
}

if (vm.count("run-test")) {
int level = vm["run-test"].as<int>();
switch (level) {
case '0':
// test script level 0
mConfig["RunMode"] = "Internal";
mConfig["ScriptFileName"] = "FreeCADTest";
//sScriptName = FreeCADTest;
break;
default:
//default testing level 0
mConfig["RunMode"] = "Internal";
mConfig["ScriptFileName"] = "FreeCADTest";
//sScriptName = FreeCADTest;
break;
};
string testCase = vm["run-test"].as<string>();
if ( "0" == testCase) {
testCase = "TestApp.All";
}
mConfig["TestCase"] = testCase;
mConfig["RunMode"] = "Internal";
mConfig["ScriptFileName"] = "FreeCADTest";
//sScriptName = FreeCADTest;
}

if (vm.count("single-instance")) {
Expand Down Expand Up @@ -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
// able to load its modules.
char resolved[PATH_MAX];
#if defined(FC_OS_BSD)
#if defined(FC_OS_BSD)
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
Expand Down
8 changes: 5 additions & 3 deletions src/App/FreeCADTest.py
@@ -1,7 +1,7 @@
# FreeCAD test module
# FreeCAD test module
# (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
#

Expand Down Expand Up @@ -34,7 +34,9 @@

import TestApp, sys

testResult = TestApp.TestText("TestApp.All")
testCase = FreeCAD.ConfigGet("TestCase")

testResult = TestApp.TestText(testCase)

Log ("FreeCAD test done\n")

Expand Down

0 comments on commit 02b3883

Please sign in to comment.