Martchus / syncthingtray

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

Tests fail when compiling from AUR #116

Closed xeruf closed 3 years ago

xeruf commented 3 years ago

I have seen #35,#63,#105 but none seem to contain info for how to resolve this properly...

Relevant components

Environment and versions Arch via AUR

Logs

Executing test cases ...
.
 - Setup configuration for Syncthing tests ...
 - Using timeout factor 3

 - Launching Syncthing: syncthing -gui-address=http://127.0.0.1:49878 -gui-apikey=syncthingtestinstance -home=/home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11/connector/testfiles/workingdir/testconfig -no-browser -verbose
Info: Launched process, PID: 44762

 - Preparing connection ...

 - Error handling in case of insufficient configuration ...
 - Connection error: Connection configuration is insufficient.

 - Error handling in case of inavailability ...
 - Connection error: Unable to request Syncthing config: Connection refused
 - Connection error: Unable to request Syncthing status: Connection refused
[start] 20:21:18 INFO: syncthing v1.18.2 "Fermium Flea" (go1.17.1 linux-amd64) syncthing@archlinux 2021-09-12 11:16:11 UTC [noupgrade]
[start] 20:21:18 INFO: Generating ECDSA key and certificate for syncthing...
[start] 20:21:18 INFO: Archiving a copy of old config file format at: /home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11/connector/testfiles/workingdir/testconfig/config.xml.v28
[JUKSI] 20:21:18 INFO: My ID: JUKSIU4-DFRIOMU-VGFZT4V-QRDB5PD-VOQKCE6-UR476DR-7UVDFK7-XG6RDA4
 - Connection error: Unable to request Syncthing config: Connection refused
 - Connection error: Unable to request Syncthing status: Connection refused
[JUKSI] 20:21:19 INFO: Single thread SHA256 performance is 430 MB/s using crypto/sha256 (427 MB/s using minio/sha256-simd).
[JUKSI] 20:21:19 VERBOSE: Starting up (/home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11/connector/testfiles/workingdir/testconfig)
 - Connection error: Unable to request Syncthing config: Connection refused
 - Connection error: Unable to request Syncthing status: Connection refused
[JUKSI] 20:21:19 INFO: Hashing performance is 363.83 MB/s
[JUKSI] 20:21:19 INFO: Running database migration 1...
[JUKSI] 20:21:19 INFO: Running database migration 2...
[JUKSI] 20:21:19 INFO: Running database migration 3...
[JUKSI] 20:21:19 INFO: Running database migration 5...
[JUKSI] 20:21:19 INFO: Running database migration 6...
[JUKSI] 20:21:19 INFO: Running database migration 7...
[JUKSI] 20:21:19 INFO: Running database migration 9...
[JUKSI] 20:21:19 INFO: Running database migration 10...
[JUKSI] 20:21:19 INFO: Running database migration 11...
[JUKSI] 20:21:19 INFO: Running database migration 13...
[JUKSI] 20:21:19 INFO: Running database migration 14...
[JUKSI] 20:21:19 INFO: Running database migration 16...
[JUKSI] 20:21:19 INFO: Running database migration 17...
[JUKSI] 20:21:19 INFO: Running database migration 19...
[JUKSI] 20:21:19 INFO: Compacting database after migration...
[JUKSI] 20:21:19 INFO: Overall send rate is unlimited, receive rate is unlimited
[JUKSI] 20:21:19 INFO: TCP listener (127.0.0.1:32452) starting
[JUKSI] 20:21:19 VERBOSE: Listen address tcp://127.0.0.1:32452 resolution has changed: lan addresses: [tcp://127.0.0.1:32452] wan addresses: [tcp://0.0.0.0:0 tcp://127.0.0.1:32452]
[JUKSI] 20:21:19 INFO: Using discovery mechanism: global discovery server https://discovery.syncthing.net/v2/?noannounce&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[JUKSI] 20:21:19 INFO: Using discovery mechanism: global discovery server https://discovery-v4.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[JUKSI] 20:21:19 INFO: Using discovery mechanism: global discovery server https://discovery-v6.syncthing.net/v2/?nolookup&id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[JUKSI] 20:21:19 INFO: Using discovery mechanism: IPv4 local broadcast discovery on port 21027
[JUKSI] 20:21:19 INFO: Using discovery mechanism: IPv6 local multicast discovery on address [ff12::8384]:21027
[JUKSI] 20:21:19 INFO: No stored folder metadata for "test1"; recalculating
[JUKSI] 20:21:19 INFO: Ready to synchronize test1 (sendreceive)
[JUKSI] 20:21:19 VERBOSE: Folder "test1" is now scan-waiting
[JUKSI] 20:21:19 VERBOSE: Folder "test1" is now scanning
[JUKSI] 20:21:19 INFO: Completed initial scan of sendreceive folder test1
[JUKSI] 20:21:19 VERBOSE: Folder "test1" is now idle
[JUKSI] 20:21:19 INFO: Loading HTTPS certificate: open /home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11/connector/testfiles/workingdir/testconfig/https-cert.pem: no such file or directory
[JUKSI] 20:21:19 INFO: Creating new HTTPS certificate
[JUKSI] 20:21:19 VERBOSE: Discovered device 5HJMFOJ-B64MS5D-EQC6JKV-L23T532-VBUEW2I-UDVIU6U-MZAJQMW-534GNQS at [tcp://[fe80::da72:7cb:ba99:9a1b%25enp0s31f6]:22000 tcp://192.168.178.90:22000 tcp://[fe80::da72:7cb:ba99:9a1b%25enp0s31f6]:0 relay://82.76.8.108:22067/?id=GYU24LE-TQLFMTN-WQH3WQK-CP36YIJ-VP5JCD7-GXK6PBD-F4ZR3VA-AHIOYAK&pingInterval=1m15s&networkTimeout=3m30s&sessionLimitBps=10000000&globalLimitBps=100000000&statusAddr=:22070&providedBy=Tux quic://[fe80::da72:7cb:ba99:9a1b%25enp0s31f6]:22000 quic://192.168.178.90:22000 quic://185.17.207.169:54120]
[JUKSI] 20:21:19 VERBOSE: Discovered device 55KIOHI-ORAMHNW-VLCT3LH-LDLUL3A-O2CAC7T-M4B6QZZ-A36A5VS-P4LX5AP at [tcp://127.0.0.1:32452 tcp://[fe80::da72:7cb:ba99:9a1b%25enp0s31f6]:0]
[JUKSI] 20:21:19 WARNING: Failed starting API: listen tcp 127.0.0.1:49878: bind: address already in use
[JUKSI] 20:21:19 INFO: Detected 1 NAT service
[JUKSI] 20:21:19 WARNING: Starting API/GUI: listen tcp 127.0.0.1:49878: bind: address already in use
[JUKSI] 20:21:19 INFO: UPnP parse: dial tcp 192.168.178.1:49000: operation was canceled
[JUKSI] 20:21:19 INFO: UPnP parse: dial tcp 192.168.178.1:49000: operation was canceled
 - Connection error: Unable to request Syncthing status: Host requires authentication

 - Error handling in case of wrong credentials ...
 - Connection error: Unable to request Syncthing status: Host requires authentication

 - Error handling in case of wrong API key  ...
[JUKSI] 20:21:20 INFO: TCP listener (127.0.0.1:32452) shutting down
[JUKSI] 20:21:20 INFO: Exiting
[monitor] 20:21:20 INFO: Syncthing exited: exit status 1
 - Connection error: Unable to request Syncthing config: Error transferring http://nobody:supersecret@127.0.0.1:49878/rest/system/config - server replied: Forbidden

 - Connecting initially ...
 - Connection error: Unable to request Syncthing config: Connection refused
QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.
F
 - Waiting for Syncthing to terminate ...
[monitor] 20:21:21 INFO: Signal 15 received; exiting
Info: Launched process 44762 exited with error: No child processes

 - Syncthing terminated with exit code -1.
......

!!!FAILURES!!!
Test Results:
Run:  7   Failures: 1   Errors: 0

1) test: ConnectionTests::testConnection (F) line: 391 /home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11/connector/tests/../../testhelper/helper.h
forced failure
- Signal(s) statusChanged, dirStatusChanged, newDirs, devStatusChanged, newDevices has/have not emitted before error.

Tests failed

50% tests passed, 1 tests failed out of 2

Total Test time (real) =   3.57 sec

The following tests FAILED:
          1 - syncthingconnector_run_tests (Failed)
Errors while running CTest
FAILED: connector/CMakeFiles/check /home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11/connector/CMakeFiles/check 
cd /home/janek/.cache/yay/syncthingtray/src/syncthingtray-1.1.11 && /usr/bin/ctest -V
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in check().
    Aborting...
error making: syncthingtray
Martchus commented 3 years ago

It looks like the test instance of Syncthing which is launched here terminates itself because the GUI listening port is already in use:

[JUKSI] 20:21:19 WARNING: Failed starting API: listen tcp 127.0.0.1:49878: bind: address already in use
[JUKSI] 20:21:19 INFO: Detected 1 NAT service
[JUKSI] 20:21:19 WARNING: Starting API/GUI: listen tcp 127.0.0.1:49878: bind: address already in use
[JUKSI] 20:21:19 INFO: UPnP parse: dial tcp 192.168.178.1:49000: operation was canceled
[JUKSI] 20:21:19 INFO: UPnP parse: dial tcp 192.168.178.1:49000: operation was canceled
[JUKSI] 20:21:20 INFO: TCP listener (127.0.0.1:32452) shutting down
[JUKSI] 20:21:20 INFO: Exiting
[monitor] 20:21:20 INFO: Syncthing exited: exit status 1

I'm wondering why that happens. A unique port is generated via the ephemeral_port() function in the PKGBUILD so the likeliness for a collision should be small.

Could it be that ctest invokes the two tests (one for the library and one for the CLI) in parallel so they interfere with each other? I've never had this problem, though.

xeruf commented 3 years ago

Ha, for another project I have globally set CTEST_PARALLEL_LEVEL to 3, that might indeed be related. So that variable either needs to be reset before testing or the tests should be patched to be parallelisable. Thanks for the application and packaging anyways :)

Martchus commented 3 years ago

Should be fixed on master using https://cmake.org/cmake/help/latest/prop_test/RESOURCE_LOCK.html#prop_test:RESOURCE_LOCK.