skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.84k stars 209 forks source link

Failures in unit tests on some platforms #252

Closed pemensik closed 1 year ago

pemensik commented 3 years ago

Hi, I have attempted to prepare a RPM Fedora package of this library. I enabled building of tests. My test build failed on few platforms: armv7hl s390x ppc64le. But it passed fine on more common platforms: i686 x86_64 aarch64.

Temporary build link (would be gone in few days): https://koji.fedoraproject.org/koji/taskinfo?taskID=74293472

+ cd uvw-2.9.0_libuv_v1.41
+ cd redhat-linux-build
+ /usr/bin/ctest --output-on-failure --force-new-ctest-process -j5
Test project /builddir/build/BUILD/uvw-2.9.0_libuv_v1.41/redhat-linux-build
      Start  1: uvw_main
      Start  2: uvw_async
      Start  3: uvw_check
      Start  4: uvw_emitter
      Start  5: uvw_file_req
 1/28 Test  #1: uvw_main .........................   Passed    0.01 sec
      Start  6: uvw_fs_event
 2/28 Test  #2: uvw_async ........................   Passed    0.01 sec
      Start  7: uvw_fs_poll
 3/28 Test  #3: uvw_check ........................   Passed    0.01 sec
      Start  8: uvw_fs_req
 4/28 Test  #4: uvw_emitter ......................   Passed    0.01 sec
      Start  9: uvw_handle
 5/28 Test  #6: uvw_fs_event .....................   Passed    0.01 sec
      Start 10: uvw_idle
 6/28 Test  #9: uvw_handle .......................   Passed    0.01 sec
      Start 11: uvw_lib
 7/28 Test #10: uvw_idle .........................   Passed    0.01 sec
      Start 12: uvw_loop
 8/28 Test  #5: uvw_file_req .....................   Passed    0.02 sec
      Start 13: uvw_pipe
 9/28 Test  #8: uvw_fs_req .......................   Passed    0.02 sec
      Start 14: uvw_prepare
10/28 Test #11: uvw_lib ..........................   Passed    0.01 sec
      Start 15: uvw_process
11/28 Test #12: uvw_loop .........................   Passed    0.01 sec
      Start 16: uvw_request
12/28 Test #13: uvw_pipe .........................   Passed    0.01 sec
      Start 17: uvw_resource
13/28 Test #14: uvw_prepare ......................   Passed    0.01 sec
      Start 18: uvw_signal
14/28 Test #15: uvw_process ......................   Passed    0.01 sec
      Start 19: uvw_stream
15/28 Test #16: uvw_request ......................   Passed    0.01 sec
      Start 20: uvw_tcp
16/28 Test #17: uvw_resource .....................   Passed    0.01 sec
      Start 21: uvw_thread
17/28 Test #18: uvw_signal .......................   Passed    0.01 sec
      Start 22: uvw_timer
18/28 Test #19: uvw_stream .......................   Passed    0.01 sec
      Start 23: uvw_tty
19/28 Test #20: uvw_tcp ..........................   Passed    0.01 sec
      Start 24: uvw_udp
20/28 Test #21: uvw_thread .......................   Passed    0.01 sec
      Start 25: uvw_underlying_type
21/28 Test #23: uvw_tty ..........................   Passed    0.01 sec
      Start 26: uvw_util
22/28 Test #24: uvw_udp ..........................   Passed    0.01 sec
      Start 27: uvw_work
23/28 Test #25: uvw_underlying_type ..............   Passed    0.01 sec
      Start 28: uvw_file_req_sendfile
24/28 Test #26: uvw_util .........................***Failed    0.01 sec
Running main() from /builddir/build/BUILD/googletest-release-1.10.0/googletest/src/gtest_main.cc
24/28 Test #26: uvw_util .........................***Failed    0.01 sec
Running main() from /builddir/build/BUILD/googletest-release-1.10.0/googletest/src/gtest_main.cc
[==========] Running 3 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 3 tests from Util
[ RUN      ] Util.UnscopedFlags
[       OK ] Util.UnscopedFlags (0 ms)
[ RUN      ] Util.ScopedFlags
[       OK ] Util.ScopedFlags (0 ms)
[ RUN      ] Util.Utilities
/builddir/build/BUILD/uvw-2.9.0_libuv_v1.41/test/uvw/util.cpp:128: Failure
Expected: (cpuInfo[0].speed) != (decltype(cpuInfo[0].speed){0}), actual: 0 vs 0
[  FAILED  ] Util.Utilities (1 ms)
[----------] 3 tests from Util (2 ms total)
[----------] Global test environment tear-down
[==========] 3 tests from 1 test suite ran. (2 ms total)
[  PASSED  ] 2 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Util.Utilities

 1 FAILED TEST

Would you know if it needs fixing? Should be speed always non-zero?

pemensik commented 3 years ago

Commenting line with speed passes tests on all platforms.

skypjack commented 3 years ago

Sorry for the late reply, I was on vacation. Yeah, tests are known to fail on some platforms. That's due to libuv that only supports some functionalities on some platforms. Since uvw is literally a wrapper around libuv, the goal has never been to test the underlying library. Therefore, we kindly ignored these failures and run a sort of functional tests only on some platforms.

pemensik commented 3 years ago

Could be checking of non-zero test of cpu speed removed, when it is known to be zero on some platforms? Could be just sufficient test speed >= 0? I could not find even what units it uses in documentation, I doubt that number means anything significant.

skypjack commented 3 years ago

Mmm actually it could make sense. We don't really want to test the result but only the fact that it works. That is, we want to check that it correctly forwards the request to the underlying library.

skypjack commented 1 year ago

I'm closing this issue as starving. Feel free to open a new one if the problem persists with the upstream version of uvw. Thanks.