RFR: 8310355: Move the stub test from initialize_final_stubs() to test/hotspot/gtest

Hao Sun haosun at openjdk.org
Tue Jul 4 04:53:12 UTC 2023


On Tue, 4 Jul 2023 04:45:31 GMT, Hao Sun <haosun at openjdk.org> wrote:

> Three groups of runtime routines, i.e. arraycopy, copy and fill, are tested inside function `initialize_final_stubs()`. The test runs every time the debug VM is started.
> 
> I think it's a usual convention that it's better not to run functional tests on startup. Hence, this patch proposes to move the stub test under `test/hotspot/gtest`.
> 
> It's one copy-paste patch, except the following two minor changes:
> 
> 1) Remove `ASSERT` condition check, and the gtest case will be run for release build as well.
> 
> 2) Use the gtest helper `ASSERT_TRUE()` to replace the `assert()`.
> 
> Note that the downside is that we won't catch stub implementation errors immediately on startup.
> 
> Test:
> 
> 1) Cross compilations on arm32/s390/ppc/riscv passed.
> 
> 2) tier1 test passed on Linux/AArch64, Linux/x86_64 and macOS/Apple silicon. Note that hotspot/gtest is run in tier1.
> 
> 3) VM builds with several different options (e.g., zero build, release build, fastdebug build, client variant, no C1/c2) passed on Linux/AArch64 and Linux/x86_64.
> 
> 4) I manually injected errors in arraycopy/copy/fill stubs and verified `make test TEST="gtest:StubRoutines"` fails or not. But this check only worked for array fill stub. For the remaining two stubs, VM build (`make images`) failed firstly before running the gtest, because the built VM with these "erroneous" stubs were executed to do something such as loading Java core library code.

test/hotspot/gtest/runtime/test_stubRoutines.cpp line 2:

> 1: /*
> 2:  * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.

Most of this file is copied from `stubRoutines.cpp`, hence I continue to use the copyright year from `stubRoutines.cpp`. 

But I'm not 100% sure if it is correct. Please let me know if it is not. Thanks.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14765#discussion_r1251476506


More information about the hotspot-dev mailing list