Open cpinter opened 4 years ago
Does anyone have an idea about this?
as it runs the test on a different thread. I'd appreciate any ideas. Thank you!
Since the executable testingTestApp-real.exe
is crashing, I suggest you start visual studio using testingTest.exe --VisualStudioProject
, you should then be able to debug testingTestApp-real
.
Thanks, @jcfr , I have been debugging Slicer for a decade now, the problem is not this.
The question is how do I debug the test in the exact same environment as it is run by ctest. And I think it's not through testingTestApp-real
. Although I can try running the test from within Slicer and see if it crashes.
I figured :)
Does the program crash if you run it directly from the command line ?
If yes, running it in visual studio may help.
Yes it crashes when run from the command line. I tried to run it that way from VS and that's where the different process became a problem. I'll try running the test python command (slicer.testing.runUnitTest(...)
) from a running Slicer through the debugger, maybe it crashes that way.
Considering the following command:
E:\e\tD\Slicer-build\testingTest.exe ^
--no-splash ^
--testing ^
--no-main-window ^
--disable-cli-modules ^
--additional-module-path "E:/e/tD/Slicer-build/lib/testingTest-4.11/qt-scripted-modules" ^
--additional-module-paths ^
"E:/e/tD/Slicer-build/lib/testingTest-4.11/qt-scripted-modules" ^
"E:/e/tD/Slicer-build/lib/testingTest-4.11/cli-modules" ^
"E:/e/tD/Slicer-build/lib/testingTest-4.11/qt-loadable-modules" ^
--python-code ^
"import slicer.testing; slicer.testing.runUnitTest(['E:/e/tD/Slicer-build/Modules/Scripted/DICOMPatcher', 'E:/e/tD/slicersources-src/Modules/Scripted/DICOMPatcher'], 'qSlicerDICOMPatcherModuleGenericTest')"
From within Visual Studio, you should be able to associate all arguments with the testingTestApp-real
project and start the debugger.
Indeed, I don't the execution of the slicer.testing.runUnitTest
(implemented here) is starting any thread or process.
Sorry for the late answer! I tried the command you suggested but it is identical with what I tried last, and the debugger returns with no call stack, but without the debugger there is clearly a crash.
Unless we get a call stack for this crash we can't fix this, meaning slicer custom apps cannot be tested the usual way.
If I run the test python code from within the main window's python interactor (after removing no-main-window and testing and the python-code arguments from the startup command), then the tests pass alright.
@cpinter or @jcfr Were you all able to resolve this? I think I'm running into this now with my slicer custom app.
PS C:\Program Files\MyName 2.0.0-2022-04-25> ./MyName.exe --testing
error: [C:/Program Files/MyName 2.0.0-2022-04-25/bin/MyNameApp-real.exe] exit abnormally - Report the problem.
It does not have an issue with a regular Slicer build
PS C:\Users\JamesButler\AppData\Local\NA-MIC\Slicer 4.13.0-2022-04-23> ./Slicer.exe --testing
PS C:\Users\JamesButler\AppData\Local\NA-MIC\Slicer 4.13.0-2022-04-23>
@jamesobutler I could not find a way to attach a debugger to the process where it crashed, and didn't have any additional ideas since then. I ended up running tests from an app started normally using a button in the settings panel, and this was not critical after that. It would be still great if we could fix this, because without it custom apps can't really have a working dashboard.
Linking the recent discourse topic here as well: https://discourse.slicer.org/t/slicer-custom-app-crashing-with-testing-arg/23209/2
I was trying to debug this on linux with a debug build of my custom app using:
gdb GeoSlicer
set follow-fork-mode child
r --testing
Segfault backtrace:
#0 0x00007ffff3b011a2 in QSettings::value(QString const&, QVariant const&) const ()
from /home/fernando/Downloads/GeoSlicer-1.6.0-2022-05-11-linux-amd64_debug/GeoSlicer-1.6.0-2022-05-11-linux-amd64/bin/../lib/GeoSlicer-4.11/libQt5Core.so.5
#1 0x00007ffff5628b94 in qSlicerCoreApplicationPrivate::init (this=0xbbf4a0)
at /root/volume/geoslicerbase/builddebug/slicersources-src/Base/QTCore/qSlicerCoreApplication.cxx:306
#2 0x00007ffff71b1db7 in qSlicerApplicationPrivate::init (this=0xbbf4a0)
at /root/volume/geoslicerbase/builddebug/slicersources-src/Base/QTGUI/qSlicerApplication.cxx:215
## my comment (the above line is this->Superclass::init();)
#3 0x00007ffff71b2f38 in qSlicerApplication::qSlicerApplication (this=0x7fffffffb410, _argc=@0x7fffffffb3cc: 2, _argv=0x7fffffffb588)
at /root/volume/geoslicerbase/builddebug/slicersources-src/Base/QTGUI/qSlicerApplication.cxx:374
#4 0x0000000000408a6b in (anonymous namespace)::SlicerAppMain (argc=2, argv=0x7fffffffb588)
at /root/volume/geoslicerbase/Applications/GeoSlicerApp/Main.cxx:38
#5 0x0000000000408d87 in main (argc=2, argv=0x7fffffffb588)
at /root/volume/geoslicerbase/builddebug/slicersources-src/Base/QTApp/qSlicerApplicationMainWrapper.cxx:72
Not very informative specially because my custom app may have changed some of those sources but it seems that a command line argument is not being built properly.
Thanks for the additional debugging help @fbordignon! Much appreciated 🙏🏻
My custom app is based on version 4.11.20210226 if you need more info I can share those cxx sources.
It probably has been failing in the same way through various versions of Slicer (master
as of May 4th 2020, version 4.11.20210226, and recent master
at least as of Late-April 2022).
The scripted module tests crash for custom app, also confirmed to be the case with the template without anything additional. This happens using the latest master, on Windows 10 with Qt 5.10.1.
I cannot debug it with setting the launcher as executable, as it runs the test on a different thread. I'd appreciate any ideas. Thank you!