[Solved] When running unit tests from command line FreeCAD does not shutdown anymore

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

[Solved] When running unit tests from command line FreeCAD does not shutdown anymore

Post by apeltauer »

Hi all,

while running the unit tests from command line like "FreeCAD.exe" --run-test 0", FreeCAD does not close anymore. I get this output in FreeCAD:

----------------------------------------------------------------------
Ran 349 tests in 288.675s

OK
Exception (Fri Aug 31 13:23:49 2018): System exit
Debug: DraftGui.todo.doTasks: queue contains a deleted object, skipping


I cant see any errors in the tests.

Any idea why FreeCAD does not close anymore?
It is strange that the execution works with appveyor.

After some debuging i found that PyRun_String in (src\Base\Interpreter.cpp line 235) returns a Null Ptr when running the unit test. (While other calls returning a valid pointer) This throws a SystemExitException with (System exit 0).
The exeption is catched in (src\Gui\MainWindow.cpp line 1040), after this the methode "MainWindow::delayedStartup" will then return. While this is a signal triggered function, the main app still runs.
Some while ago the try catch block was inserted to handle exit codes from the unit tests, but now it does not close the app anymore.

Has anyone a proposel how to solve this?
I know it is strange that the build on appveyor works.

Thanks in advance.

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14500 (Git)
Build type: Debug
Branch: master
Hash: 022653331fa6c14de235f5aebd48785b774c0ed6
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
Locale: English/Germany (en_DE)
Last edited by apeltauer on Tue Sep 04, 2018 1:59 pm, edited 1 time in total.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: When running unit tests from command line FreeCAD does not shutdown anymore

Post by wmayer »

while running the unit tests from command line like "FreeCAD.exe" --run-test 0", FreeCAD does not close anymore. I get this output in FreeCAD:
The behaviour to run unit tests from the command line in GUI mode is relatively new so I can't say if the application has exited for system exceptions. Anyway: git commit fb1a0be84
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: When running unit tests from command line FreeCAD does not shutdown anymore

Post by apeltauer »

Thanks Werner for the fast code change.
I will test your commit on monday morning and will give you quick feedback...

Thanks a lot...
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: When running unit tests from command line FreeCAD does not shutdown anymore

Post by apeltauer »

Just tested our code change and it works like expected.
If the test returns with no error the exit code of FreeCAD is 0. If a test fails it returns with 1.
Thanks a lot again!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: When running unit tests from command line FreeCAD does not shutdown anymore

Post by Kunda1 »

please mark topic as [Solved]. Thank you
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply