Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yaojingguo opened this issue Jun 15, 2019 · 9 comments
Open

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

yaojingguo opened this issue Jun 15, 2019 · 9 comments
Assignees

Comments

@yaojingguo
Copy link

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
@ptrmtrx
Copy link

ptrmtrx commented Aug 15, 2019

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.

@kgopal6

This comment has been minimized.

@benstadin
Copy link

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

@derekmauro
Copy link
Member

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.

@benstadin
Copy link

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

const char* tzdir = "/usr/share/zoneinfo";

@derekmauro
Copy link
Member

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

const char* tzdir = "/usr/share/zoneinfo";

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.

@benstadin
Copy link

benstadin commented Aug 27, 2020

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.

@derekmauro
Copy link
Member

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

@mialuyao
Copy link

mialuyao commented Aug 9, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@yaojingguo @derekmauro @asoffer @benstadin @ptrmtrx @kgopal6 @mialuyao and others