RFR: 8157325: gtest tests are not excluded for minimal builds

Erik Joelsson erik.joelsson at oracle.com
Thu May 19 12:18:46 UTC 2016


Hello,

I will try to explain.

The GTEST_LIBJVM consists of 3 things:

1. All the objects of libjvm.so
2. The gtest framework
3. The actual test objects

This patch changes how the sources for 3 are found. Before this patch, 
the tests were found by searching hotspot/test/native for test*.cpp, 
which is very similar to how jtreg native files are found. There is 
however a very significant difference between native jtreg tests and 
gtest. The native jtreg tests are each linked into a separate lib or 
executable, while the gtest tests are all linked together in one lib. 
For this reason, there really is no point in putting a .cpp file in 
hotspot/test/native if it's not to be included in GTEST_LIBJVM. There is 
also no reason to name the files test*.cpp to signal that they contain 
tests. The test framework does not care about the names of the objects.

My understanding is that the intention with hotspot/test/native is to 
mimic the structure of hotspot/src/share/vm. This also means that the 
same exclude/include patterns should apply. This patch replaces the find 
and instead sets the SRC_DIR to hotspot/test/native and exclude 
parameters to the same as for LIBJVM.

So for the minimal jvm case, we exclude gc/g1 when the jvm feature 
all-gcs isn't enabled, and with this patch that also applies to the unit 
tests.

/Erik

On 2016-05-19 14:03, David Holmes wrote:
> Sorry Erik but I don't follow what this patch is doing - not familiar 
> with how gtest actually works. Where does the minimal build come into 
> what has been changed? This seems to be changing how GTEST_LIBJVM is 
> built, not when it is built ??
>
> Thanks,
> David
>
> On 19/05/2016 8:44 PM, Erik Helin wrote:
>> Hi all,
>>
>> this small patch ensures that the Makefiles correctly excludes gtest
>> unit tests for a minimal build. Right now, if you add a test to e.g.
>> hotspot/native/gc/g1, the test will be included in a minimal build,
>> which will fail.
>>
>> Thanks to Erik Joelsson for helping out with this patch!
>>
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8157325
>>
>> Webrev:
>> http://cr.openjdk.java.net/~ehelin/8157325/webrev.00/
>>
>> Testing:
>> - JPRT (with test in hotspot/native/gc/g1)
>> - Locally on Linux x86-64, both with and without a test in
>>   hotspot/native/gc/g1, both minimal and full build
>>
>> Thanks,
>> Erik
>>



More information about the hotspot-dev mailing list