RFR 8144278 [TESTBUG] hotspot/runtime/StackGuardPages/testme.sh should use native library build support

Erik Joelsson erik.joelsson at oracle.com
Thu Jun 2 16:33:08 UTC 2016


Optimization level for tests in general is a separate issue that I'm 
sure there are more people interested in having opinions on. It's 
currently configured to be LOW as the default. If this particular test 
needs to be compiled without optimizations, it can be configured by 
adding this declaration in JtregNative.gmk:

BUILD_HOTSPOT_JTREG_EXECUTABLES_OPTIMIZATION_exeinvoke := NONE

/Erik

On 2016-06-02 18:25, Gerald Thornbrugh wrote:
> Hi Dmitry,
>
> I will discuss the disabling of optimization with Erik Joelsson and get back to you.
>
> Does this code snippet address your concerns with how “javaclassopt” is created?
>
>    int retval;
>    static char javaclassopt[4096];
>    char *javaclasspath = NULL;
>    char *javaclasspathopt = NULL;
>
>    printf("Test started with pid: %ld\n", (long) getpid());
>
>    /* set the java class path so the DoOverflow class can be found */
>    javaclasspath = getenv("CLASSPATH");
>
>    retval = snprintf(javaclassopt, sizeof(javaclassopt), "-Djava.class.path=%s",
>        javaclasspath);
>
>    if (retval < 0) {
>      fprintf(stderr, "Test ERROR. Problem creating javaclasspath\n");
>      exit(7);
>    }
>    if (retval >= sizeof(javaclassopt)) {
>      fprintf(stderr, "Test ERROR. CLASSPATH is too long\n");
>      exit(7);
>    }
>
> I will make the change you suggested for the usage() function.
>
> Thanks,
>
> Gerald
>> On Jun 2, 2016, at 9:54 AM, Dmitry Samersoff <dmitry.samersoff at oracle.com> wrote:
>>
>> Gerald,
>>
>> exeinvoke.c
>>
>> 127:
>>   I think we should compile entire test (and probably all other tests)
>> with disabled optimization (e.g. -g -O0) to simplify debugging if the
>> test crash.
>>
>>
>> 239:
>>    Please declare a static variable:
>>
>>     static char javaclassopt[4096];
>>
>>   then use
>>
>>    snprintf(javaclassopt, sizeof(javaclassopt),
>>        "-Djava.class.path=%s", javaclasspath);
>>
>>   and check it's return value.
>>
>>
>> 295: Please change usage() to return value 7 rather than call exit and
>>      change this line to
>>
>>       return usage();
>>
>>      to avoid unreachable statements.
>>
>> -Dmitry
>>
>> On 2016-06-02 18:28, Gerald Thornbrugh wrote:
>>> Hi Everyone,
>>>
>>> Please review my changes to address JDK-8144278.
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8144278
>>>
>>> JDK Webrev: http://cr.openjdk.java.net/~gthornbr/8144278/jdk-webrev.00/
>>> <http://cr.openjdk.java.net/%7Egthornbr/8144278/jdk-webrev.00/>
>>>
>>> Hotspot Webrev:
>>> http://cr.openjdk.java.net/~gthornbr/8144278/hotspot-webrev.00/
>>> <http://cr.openjdk.java.net/%7Egthornbr/8144278/hotspot-webrev.00/>
>>>
>>>
>>> The fix makes changes to two areas.
>>>
>>> The JDK changes where needed to add a path to the libjvm.so library when
>>> linking test executables.
>>> These changes where provide by Erik Joelsson.
>>>
>>> The Hotspot changes addressed the following issues:
>>>
>>> The StackGuardPages test directory needed to be added to the list of
>>> native executable tests.
>>>
>>> The libjvm.so and libpthread.so libraries needed to be added to the
>>> LDFLAGS definition for the
>>> "invoke" test executable.
>>>
>>> The StackGuardPages/testme.sh script needed to specify that
>>> DoOverflow.java must be complied,
>>> specify the new location of the "invoke" test executable and remove all
>>> portions of the script that
>>> compiled and linked DoOverflow.java and invoke.c.
>>>
>>> The native test source file "invoke.c" needed to be renamed
>>> "exeinvoke.c" so the build system will
>>> automatically build it.
>>>
>>> The native test source file exeinvoke.c needed to be changed to compile
>>> without warnings, pass the
>>> path of the DoOverflow.class file to the function which starts the JVM
>>> and keep the linux gcc compiler
>>> optimizer from in-lining the do_overflow() function which caused it not
>>> to get called.
>>>
>>> Please let me know if you have any questions or concerns.
>>>
>>> Thanks,
>>>
>>> Gerald
>>>



More information about the hotspot-runtime-dev mailing list