Modules params in shell tests on modular JDK

Zdeněk Žamberský zzambers at redhat.com
Wed Feb 14 15:11:36 UTC 2018


On 02/13/2018 10:34 PM, Jonathan Gibbons wrote:
> I would again encourage you to be moving away from shell tests in 
> favor of tests written in Java.
>
> That is the general direction for all OpenJDK tests. Tests can be 
> faster, and it is certainly easier
> to write and use library code in Java to handle the sort of task you 
> are doing here.
>

I would agree, that for most "normal" tests creating java jtregs
is better solution, but there are sometimes "special" cases,
where tests are doing things like:

- building something and adding it to boot classpath etc.
- calling many extenal programs ( e.g. generating openssl certificats,
   running debuging toos etc.)
- running javah, gcc
- using rmic
- test involving java's shared archive

... where shell may be justified

> -- Jon
>
> On 02/13/2018 07:21 AM, Zdeněk Žamberský wrote:
>> Hi,
>>
>> I am currently trying to make some jtreg shell tests work on modular 
>> jdk.
>> And while TESTMODULES env. variable gives me list of required modules,
>> there is still need for additional code to transform it to parameters
>> for java, javac (these --add-modules, --add-exports params ).
>>
>> I ended up with something like this:
>>
>> ADD_MODULES_PARAMS=""
>> ADD_EXPORTS_PARAMS=""
>> if [ -n "${TESTMODULES}" ] ; then
>>     ADD_MODULES_PARAMS="--add-modules $( printf "%s" "${TESTMODULES}" \
>>         | sed 
>> 's/\([^/[:space:]]\+\)\(\/[^[:space:]]*\)*[[:space:]]*/\1,/g' )"
>>     ADD_MODULES_PARAMS="${ADD_MODULES_PARAMS%,}"
>>
>>     ADD_EXPORTS_PARAMS="$( printf "%s" "${TESTMODULES}" \
>>         | sed 's/[^[:space:]]\+/--add-exports &=ALL-UNNAMED/g' )"
>> fi
>>
>> I wonder if env. variable with generated parameters
>> could be passed toshell tests by environment to simplify
>> shell jtreg tests for modular JDK?
>>
>> best regards,
>>
>

-- 
Zdeněk Žamberský
OpenJDK QE
Red Hat



More information about the jtreg-dev mailing list