Closed doronbehar closed 10 months ago
Test executables are intentionally not built as part of the default target. Invoke the tests
target to build tests. Invoke the check
target to build and execute tests. You can also invoke ctest
to run tests but you need to be sure to have invoked the tests
target before.
If you don't like this behavior you can pass -DEXCLUDE_TESTS_FROM_ALL:BOOL=OFF
to the CMake arguments. Then tests will be built as part of the default target.
Thanks @Martchus , indeed the EXCLUDE_TESTS_FROM_ALL flag helped. I see now that most tests don't work for us on NixOS because of our sandbox doesn't allow network connections, even between programs spawned within it, and it also doesn't allow a launch a gui. I will not enable the testsuite for our package. Thanks for your help anyway! Appreciated.
You could still enable tests for c++utilities and the other dependencies. To get rid of the GUI you can simply export the env variable QT_QPA_PLATFORM=offscreen
before invoking the test. If it is of any help, you can control the port used by integration tests via the env variable SYNCTHING_PORT
.
Thanks for trying to help. The c++ and qt utilities already have their tests enabled.
QT_QPA_PLATFORM=offscreen
That worked! In combination with a proper value for QT_PLUGIN_PATH
. Also apparently the connection issues between the syncthing instance also got fixed. Thanks again!
Trying to enable testing while building the NixOS package of syncthingtray, I encountered this issue:
I added
syncthing
andcppunit
to the package's inputs.. Any idea why is that?EDIT: Here's the full build log:
https://gist.github.com/doronbehar/f518071c48bab446cdd68dfcf7f166db