QT + Cmake + GTest = Test end up to be fatal
-
@KH-219Design alright.. I will try to compile it from the Repo by myself today..
wish me luck 🙈 -
@KH-219Design ok.. i´ve no clue how to build an integrate gtest into my project.. all that cmd stuff and that google manual is more cryptic to me than helpful...
I really need help here..
I cloned the Repo,
in powershell:$ cd googletest $ mkdir gtest_build $ cd gtest_build $ cmake ..
And now?
-
So... I cannot possibly blame you for the approach that you took (which is essentially to follow the Googletest manual for how to do their equivalent of "
make; make install
"). That was a sane assumption on your part.However, that was not what I actually intended to recommend. (Nor what I have done to make googletest work for me in my C++ projects).
What I was saying is to get all the source code for googletest, then create your own Makefile from scratch (be it a qmake pro file, or a CMakeLists.txt, or a vcxproj). Just take the C++ source files from googletest and write a library buildfile in your own preferred Makefile system to build those C++ source files.
In other words, you imagine that you have just personally created all these sources (
gtest-all.cc
,gtest-death-test.cc
,gtest-filepath.cc
, etc), and you do "whatever you normally do after writing a C++ class" in terms of adding that C++ class/file to your build.Do you know how: (a) to use CMake to compile a shared library (either a DLL or an
*.so
)?And then after that, do you know how to (b) use CMake to compile an
exe
that links against the shared library from step (a)?Knowing about (a) and (b) and prerequisites to the path forward that I am suggesting. So perhaps I got ahead of myself by not making sure you are confident in how to do (a) and (b).
-
@KH-219Design
(a) no
(b) not yetBut i think i found a way, to fetch the latest repo of googletest and include it. That worked well..
Still got a FATAL Problem at the Test Result Window, which seems to be a QT Creator Problem, since it isn´t able to run Tests.exe, but gives out (correct) Test Results. More, the Tests.exe can be started (via a batch that adds the QT dll location to PATH) and gives a perfect Powershell output of all Test.
-
Is it still the same error ?
-
@BDC_Patrick said in QT + Cmake + GTest = Test end up to be fatal:
it isn´t able to run Tests.exe, but gives out (correct) Test Results
what the h...??
how could anything output correct test results without running
Tests.exe
??It seems like you are making progress little by little, so I am happy for you! I'll take slow and tiny progress over no progress any day :)
-
@SGaist The Error says:
But as i said, The Test run though completely and there is no such FATAL Error in Powershell, cmd or the Console-View of QT Creator Test Result.
See:
No FATAL Error here...
Test runn ThroughBtw.. The Batch i run the Tests.exe from:
@ set PATH=C:\Qt\5.15.2\mingw81_64\bin;%PATH% start PowerShell -NoExit -Command "[Path\To\Build\Folder]\Tests.exe" @
-
I think you have an interpretation error here. Your tests executable ran successfully so to say. The fatal here means that one or more of your tests failed.
If it had crashed you would not see it in the report panel but you would have a dialog stating that there was a crash.
-
Well, there's nothing to fix, the output matches what your test does.