JDK-8081770 : [TESTBUG] regression Test7107135 needs to remove dependence on locally installed gcc
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: linux
  • Submitted: 2015-06-03
  • Updated: 2017-06-29
  • Resolved: 2017-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 9
10Resolved 9Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Regression Test7107135 compiles and links a simple JNI library, once with the execstack attribute and one with noexecstack. It has a shell scripts that expects to be able to do this on the test device. The issue is that not all test devices will have gcc installed. When they don't, the tests silently passes. The test should be rewritten so the libraries are cross compiled.

The following is from Stefan Sarne and suggests how to resolve the device compilation issue, and also some other improvements for the test: 

------- 
As stated by Mikael and Leonid, the idea is to let the build step handle the build of test libs as well.

Support for building native libraries was recently added to jdk9 by Magnus in the build-dev. It is currently not possible to pass in flags to the linker. But he agrees it make sense to be able to do and he already has a patch out for adding it. See JDK-8081471 and mail to build-dev.

It will be possible to add flags per file/lib name.
So in this case there will have to be two versions of test.c, say test-rw.c and test-rwx.c.
On the other hand - hopefully you can get rid of the bash script.

Some other suggestions regarding the test:
 - A new and better alternative to "silently pass on non-Linux", is to use the @requires tag.
   The test will then be run on Linux, but skipped on other platforms where it isn't applicable.
   The benefit is that the risk for thinking that the test is run and passes is reduced.
   See hotspot/test/closed/runtime/4475963/Test4475963.sh:8:## @requires os.family=="linux"

 - Bug ID as name is awkward to work with. The bug id is available as key in the test so a more descriptive name is preferred.

 - Favor java and @run driver over tests written in bash
   For example see ./runtime/CommandLine/TestNullTerminatedFlags.java 
Comments
This issue has already been fixed in jdk 9. Closing as NAI.
29-06-2017

The Test7107135.sh shell script will be replaced by a java program that ProcessBuilder to start the subtest. The java program will include "@compile" directives to compile the separate Test.java and TestMT.java test programs. The test.c file will be renamed to two different files (libtest-rw.c and libtest-rwx.c) so the build process will recognize the files and create two test libraries (one with "-z noexecstack" and one with "-z execstack"). I could not find a way to have the build system build the two binaries from one source file. The make/test/JtregNative.gmk file will also be modified to test library is only build for the linux test bundle and to define the correct library build flags (i.e. "-z noexecstack" and one with "-z execstack").
03-05-2016

The test needs to be modified to remove the compiling of the test library and allow the build system to create the test library only for Linux. The test library will then be included in the test bundle so it will not have to be built when the test is run.
03-05-2016