google / google/googletest

WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD

Open
#2,172 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

`WhenDynamicCastToTest.AmbiguousCast` fails on FreeBSD 13.0-CURRENT with clang 7.0.1, clang 8.0.0, and gcc 8.2.0 with the following message:
```
$ script WhenDynamicCastToTest.AmbiguousCast.typescript ./googlemock/gmock-matchers_test --gtest_filter=WhenDynamicCastToTest.AmbiguousCast --gtest_color=no
Script started on Sat Mar 9 10:33:53 2019
Command: ./googlemock/gmock-matchers_test --gtest_filter=WhenDynamicCastToTest.AmbiguousCast --gtest_color=no
Running main() from gmock_main.cc
Note: Google Test filter = WhenDynamicCastToTest.AmbiguousCast
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from WhenDynamicCastToTest
[ RUN ] WhenDynamicCastToTest.AmbiguousCast
/home/ngie/nfs/git/googletest/googlemock/test/gmock-matchers_test.cc:3732: Failure
Value of: as_base_ptr
Expected: when dynamic_cast to testing::gmock_matchers_test::(anonymous namespace)::AmbiguousCastTypes::VirtualDerived*, is NULL
Actual: 0x7fffffffe280, 0x7fffffffe280
[ FAILED ] WhenDynamicCastToTest.AmbiguousCast (1 ms)
[----------] 1 test from WhenDynamicCastToTest (1 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] WhenDynamicCastToTest.AmbiguousCast

1 FAILED TEST

Command exit status: 1
Script done on Sat Mar 9 10:33:53 2019
$ uname -a
FreeBSD pinklady-fbsd-current.local 13.0-CURRENT FreeBSD 13.0-CURRENT r344424+96f6a9dbf063(projects/import-googletest-1.8.1) GENERIC-NODEBUG amd64
```

The test seems correct in the RTTI case, but I'm unsure about the other cases. That being said, RTTI is enabled with clang/g++ with the cmake build and the FreeBSD project tree build.

(This is part of the impetus behind my proposed change in #2148 BTW).

* [Code being tested](https://github.com/google/googletest/blob/master/googlemock/include/gmock/gmock-matchers.h#L1641)
* [Test](https://github.com/google/googletest/blob/master/googlemock/test/gmock-matchers_test.cc#L3725)

For now this is a tracking bug. I will dig into this further and add more details at a later point.

CC: @asomers, @emaste

Contributor guide

Open the contributing guide

Research direction

Start with googlemock/test/gmock-matchers_test.cc around WhenDynamicCastToTest.AmbiguousCast and the implementation linked in googlemock/include/gmock/gmock-matchers.h. Reproduce the filtered test on FreeBSD with the reported compilers, then determine the expected RTTI and non-RTTI behavior and make the test pass consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.