pcl icon indicating copy to clipboard operation
pcl copied to clipboard

[pcl/io/timestamp.h] Unit test fails on basic timestamp epoch tests because of my timezone.

Open gbin opened this issue 1 year ago • 0 comments

Describe the bug

Compiling 1.14.1 or master in my environment results in a very basic unit test failure on an epoch test.

 82/134 Test  #82: timestamp ...........................................***Failed    0.00 sec
[==========] Running 4 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 4 tests from PCL
[ RUN      ] PCL.TestTimestampGeneratorZeroFraction
/usr/src/debug/pcl/pcl-pcl-1.14.1/test/io/test_timestamp.cpp:21: Failure
Expected equality of these values:
  timestamp
    Which is: "19691231T180000"
  "19700101T" + getTimeOffset() + "0000"
    Which is: "19700101T180000"

[  FAILED  ] PCL.TestTimestampGeneratorZeroFraction (0 ms)
[ RUN      ] PCL.TestTimestampGeneratorWithFraction
/usr/src/debug/pcl/pcl-pcl-1.14.1/test/io/test_timestamp.cpp:31: Failure
Expected equality of these values:
  timestamp
    Which is: "19691231T180000.123456"
  "19700101T" + getTimeOffset() + "0000.123456"
    Which is: "19700101T180000.123456"

[  FAILED  ] PCL.TestTimestampGeneratorWithFraction (0 ms)
[ RUN      ] PCL.TestTimestampGeneratorWithSmallFraction
/usr/src/debug/pcl/pcl-pcl-1.14.1/test/io/test_timestamp.cpp:41: Failure
Expected equality of these values:
  timestamp
    Which is: "19691231T180000.000123"
  "19700101T" + getTimeOffset() + "0000.000123"
    Which is: "19700101T180000.000123"

[  FAILED  ] PCL.TestTimestampGeneratorWithSmallFraction (0 ms)
[ RUN      ] PCL.TestParseTimestamp
[       OK ] PCL.TestParseTimestamp (0 ms)
[----------] 4 tests from PCL (0 ms total)

[----------] Global test environment tear-down
[==========] 4 tests from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] PCL.TestTimestampGeneratorZeroFraction
[  FAILED  ] PCL.TestTimestampGeneratorWithFraction
[  FAILED  ] PCL.TestTimestampGeneratorWithSmallFraction

Context

Just compiling PCL under Arch Linux. I spotted that from the AUR package but it is reproducible independently, see below.

Expected behavior

It is a release, unit tests should pass.

Current Behavior

Unit tests failure.

To Reproduce My build command is:

 cmake -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_CXX_STANDARD=17 \
    -DCMAKE_CUDA_STANDARD=17 \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -DWITH_QT='QT5' \
    -DBUILD_surface_on_nurbs=ON \
    -DBUILD_outofcore=OFF \
    -DBUILD_simulation=ON \
    -DBUILD_global_tests=ON \
    -Wno-dev
 cmake --build build

then:

  cd build/test
  ctest --output-on-failure

My Environment

  • OS: Arch Linux
  • Compiler: gcc (GCC) 14.1.1 20240522
  • PCL Version: 1.14.1 and master
sal ➜  test (master) ✗ timedatectl
               Local time: Thu 2024-06-27 07:30:38 CDT
           Universal time: Thu 2024-06-27 12:30:38 UTC
                 RTC time: Thu 2024-06-27 12:30:37
                Time zone: America/Chicago (CDT, -0500)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Possible Solution / workaround

TZ=UTC ctest
^^^ with that the test passes but really it should not depend on your system configuration timezone at all.

maybe we should be using std::gmtime instead of std::localtime?

gbin avatar Jun 27 '24 12:06 gbin