abseil-cpp icon indicating copy to clipboard operation
abseil-cpp copied to clipboard

ctest failed when doing "C++ Quickstart With CMake"

Open yaojingguo opened this issue 5 years ago • 9 comments

I performed the steps as specified https://abseil.io/docs/cpp/quickstart-cmake. But when I executed ctest, there was the following error:

99% tests passed, 1 tests failed out of 113

Total Test time (real) = 154.81 sec

The following tests FAILED:
	102 - absl_time_test (Child aborted)
Errors while running CTest

Here is my environment:

$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ cmake --version
cmake version 3.14.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ cd abseil-cpp
$ git rev-parse HEAD
8f11724067248acc330b4d1f12f0c76d03f2cfb1

yaojingguo avatar Jun 15 '19 07:06 yaojingguo

I have the same problem. Something with timezones is broken on mac. If I run the test directly (absl_time_test) I get following: [ RUN ] TimeZone.LocalTimeZone [test_util.cc : 113] RAW: Unexpected time zone "Europe/Prague" in test Abort trap: 6

Note: I am in Prague timezone.

ptrmtrx avatar Aug 15 '19 15:08 ptrmtrx

Could you like appropriat.

kgopal6 avatar Jan 26 '20 12:01 kgopal6

Same here (OS X 10.15) with current master branch (as of August 23).

benstadin avatar Aug 23 '20 14:08 benstadin

The environment variable TZDIR needs to be set to the location of https://github.com/abseil/abseil-cpp/tree/master/absl/time/internal/cctz/testdata/zoneinfo.

Can someone look into automatically setting this in our CMake configuration? https://stackoverflow.com/questions/59690736/how-to-get-a-relative-path-for-cmake-unit-tests may be useful.

derekmauro avatar Aug 24 '20 14:08 derekmauro

Thanks, I'll give it a try. Though why is that directory hardcoded here:

https://github.com/abseil/abseil-cpp/blob/dea76486cb76c7e1032a5efc15b43538b7c5ce50/absl/time/internal/cctz/src/time_zone_info.cc#L630

benstadin avatar Aug 26 '20 18:08 benstadin

Thanks, I'll give it a try. Though why is that directory hardcoded here:

https://github.com/abseil/abseil-cpp/blob/dea76486cb76c7e1032a5efc15b43538b7c5ce50/absl/time/internal/cctz/src/time_zone_info.cc#L630

If the TZDIR environment variable isn't set, it falls back to that hardcoded value. That is where the system data is commonly located in many Linux distributions.

You should prefer to use the system data in your application, which is usually kept up to date by the package manager/update process of your OS.

On the other hand, for our tests, they should use the provided test data. This is for the same reason mock objects are common in testing. The tests are testing the behavior of the library given a fixed version of the timezone data, not the current accuracy of the test data. You don't need your tests to start failing just because the data changed. You only need to know that the library is capable of using the timezone database that it has been given.

I'm not sure if that is the question you were asking, but hopefully I've answered it.

derekmauro avatar Aug 27 '20 00:08 derekmauro

Thank you for the explanation, that makes sense.

I've tried compiling with setting cmake option -DTZDIR=absolute/path/to/absl/time/internal/cctz/testdata/zoneinfo. But the absl_time_test still gets aborted.

benstadin avatar Aug 27 '20 01:08 benstadin

TZDIR is an environment variable, not something that can be set at compile time.

derekmauro avatar Aug 27 '20 03:08 derekmauro

I have the similar problem as the following tests FAILED:

148 - absl_string_view_test (Child killed)

151 - absl_str_split_test (Child killed)

I want to know how to deal with it. Thank you!

mialuyao avatar Aug 09 '23 10:08 mialuyao