Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.54k stars 43 forks source link

cppunit tests fail due to unfound executables #208

Closed doronbehar closed 10 months ago

doronbehar commented 10 months ago

Trying to enable testing while building the NixOS package of syncthingtray, I encountered this issue:

syncthingtray> Test project /build/source/build
syncthingtray>     Start 1: syncthingconnector_run_tests
syncthingtray> Could not find executable /build/source/build/syncthingconnector/syncthingconnector_tests
syncthingtray> Looked in the following places:
syncthingtray> /build/source/build/syncthingconnector/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Release/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Release/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Debug/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Debug/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/MinSizeRel/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/MinSizeRel/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/RelWithDebInfo/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/RelWithDebInfo/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Deployment/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Deployment/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Development/syncthingconnector_tests
syncthingtray> /build/source/build/syncthingconnector/Development/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Release/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Release/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Debug/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Debug/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/MinSizeRel/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/MinSizeRel/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/RelWithDebInfo/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/RelWithDebInfo/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Deployment/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Deployment/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Development/syncthingconnector_tests
syncthingtray> build/source/build/syncthingconnector/Development/syncthingconnector_tests
syncthingtray> Unable to find executable: /build/source/build/syncthingconnector/syncthingconnector_test
s
syncthingtray> 1/3 Test #1: syncthingconnector_run_tests ........***Not Run   0.00 sec
syncthingtray>     Start 2: syncthingctl_run_tests
syncthingtray> Could not find executable /build/source/build/cli/syncthingctl_tests
syncthingtray> Looked in the following places:
syncthingtray> /build/source/build/cli/syncthingctl_tests
syncthingtray> /build/source/build/cli/syncthingctl_tests
syncthingtray> /build/source/build/cli/Release/syncthingctl_tests
syncthingtray> /build/source/build/cli/Release/syncthingctl_tests
syncthingtray> /build/source/build/cli/Debug/syncthingctl_tests
syncthingtray> /build/source/build/cli/Debug/syncthingctl_tests
syncthingtray> /build/source/build/cli/MinSizeRel/syncthingctl_tests
syncthingtray> /build/source/build/cli/MinSizeRel/syncthingctl_tests
syncthingtray> /build/source/build/cli/RelWithDebInfo/syncthingctl_tests
syncthingtray> /build/source/build/cli/RelWithDebInfo/syncthingctl_tests
syncthingtray> /build/source/build/cli/Deployment/syncthingctl_tests
syncthingtray> /build/source/build/cli/Deployment/syncthingctl_tests
syncthingtray> /build/source/build/cli/Development/syncthingctl_tests
syncthingtray> /build/source/build/cli/Development/syncthingctl_tests
syncthingtray> build/source/build/cli/syncthingctl_tests
syncthingtray> build/source/build/cli/syncthingctl_tests
syncthingtray> build/source/build/cli/Release/syncthingctl_tests
syncthingtray> build/source/build/cli/Release/syncthingctl_tests
syncthingtray> build/source/build/cli/Debug/syncthingctl_tests
syncthingtray> build/source/build/cli/Debug/syncthingctl_tests
syncthingtray> build/source/build/cli/MinSizeRel/syncthingctl_tests
syncthingtray> build/source/build/cli/MinSizeRel/syncthingctl_tests
syncthingtray> build/source/build/cli/RelWithDebInfo/syncthingctl_tests
syncthingtray> build/source/build/cli/RelWithDebInfo/syncthingctl_tests
syncthingtray> build/source/build/cli/Deployment/syncthingctl_tests
syncthingtray> build/source/build/cli/Deployment/syncthingctl_tests
syncthingtray> build/source/build/cli/Development/syncthingctl_tests
syncthingtray> build/source/build/cli/Development/syncthingctl_tests
syncthingtray> Unable to find executable: /build/source/build/cli/syncthingctl_tests
syncthingtray> 2/3 Test #2: syncthingctl_run_tests ..............***Not Run   0.00 sec
syncthingtray>     Start 3: syncthingwidgets_run_wizard_tests
syncthingtray> Could not find executable /build/source/build/syncthingwidgets/syncthingwidgets_wizard_te
sts
syncthingtray> Looked in the following places:
syncthingtray> /build/source/build/syncthingwidgets/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Release/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Release/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Debug/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Debug/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/MinSizeRel/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/MinSizeRel/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/RelWithDebInfo/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/RelWithDebInfo/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Deployment/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Deployment/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Development/syncthingwidgets_wizard_tests
syncthingtray> /build/source/build/syncthingwidgets/Development/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Release/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Release/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Debug/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Debug/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/MinSizeRel/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/MinSizeRel/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/RelWithDebInfo/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/RelWithDebInfo/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Deployment/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Deployment/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Development/syncthingwidgets_wizard_tests
syncthingtray> build/source/build/syncthingwidgets/Development/syncthingwidgets_wizard_tests
syncthingtray> Unable to find executable: /build/source/build/syncthingwidgets/syncthingwidgets_wizard_t
ests
syncthingtray> 3/3 Test #3: syncthingwidgets_run_wizard_tests ...***Not Run   0.00 sec
syncthingtray> 0% tests passed, 3 tests failed out of 3
syncthingtray> Total Test time (real) =   0.00 sec
syncthingtray> The following tests FAILED:
syncthingtray>    1 - syncthingconnector_run_tests (Not Run)
syncthingtray>    2 - syncthingctl_run_tests (Not Run)
syncthingtray>    3 - syncthingwidgets_run_wizard_tests (Not Run)
syncthingtray> Errors while running CTest
syncthingtray> make: *** [Makefile:71: test] Error 8

I added syncthing and cppunit to the package's inputs.. Any idea why is that?

EDIT: Here's the full build log:

https://gist.github.com/doronbehar/f518071c48bab446cdd68dfcf7f166db

Martchus commented 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.

doronbehar commented 10 months ago

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.

Martchus commented 10 months ago

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.

doronbehar commented 10 months ago

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!