Problems buidling a new gtest on MacOS and Windows

Jaroslav Bachorík jaroslav.bachorik at datadoghq.com
Fri Sep 25 15:05:46 UTC 2020


Never mind, found it.

The problem is that the original set of includes transitively pulls in
the header I need for the testing. So the declarations are done
‘outside of namespaces’, apparently. Then I try re-including the
header in the anonymous namespace but that will skip the include
because the header has already been included  …
When I do #undef SHARE_JFR_SUPPORT_JFRADAPTIVESAMPLER_HPP right after
the initial set of includes the things work

Cheers,

-JB-

On Fri, Sep 25, 2020 at 3:41 PM Jaroslav Bachorík
<jaroslav.bachorik at datadoghq.com> wrote:
>
> Hello,
>
> I hope this is the right mailing list. If not, please, redirect me to
> the more appropriate one.
>
> I am working on an early prototype (or rather a PoC) for the
> rate-limited allocation sample event. In order to test the rate
> limiting sampler implementation I have added
> https://github.com/jbachorik/jdk/blob/submit/allocation_sampling/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp
> gtest. I based this test on
> https://github.com/jbachorik/jdk/blob/submit/allocation_sampling/test/hotspot/gtest/jfr/test_networkUtilization.cpp
> to have the overall structure and mocking support.
>
> However, I am not able to build my changes with this test in place for
> MacOS and Windows (Linux/gcc builds just fine). The failure is about a
> symbol being defined in an anonymous namespace
> (https://github.com/jbachorik/jdk/runs/1165666520?check_suite_focus=true).
> While it is true that the *.cpp file under test is included within an
> anonymous namespace it is very strange that the
> test_networkUtilization.cpp does not have the same problem, nor this
> same test but when built for Linux.
>
> I have spent a non-trivial amount of time trying to figure out
> whatever minimal difference there might be but I can't spot any :(
>
> Thanks in advance for any advice here!
>
> -JB-


More information about the hotspot-jfr-dev mailing list