--- old/test/jtreg-ext/requires/VMProps.java 2019-01-23 10:47:53.000000000 -0800 +++ new/test/jtreg-ext/requires/VMProps.java 2019-01-23 10:47:53.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -86,6 +87,7 @@ map.put("vm.rtm.cpu", vmRTMCPU()); map.put("vm.rtm.compiler", vmRTMCompiler()); map.put("vm.aot", vmAOT()); + map.put("vm.aot.modules", vmAotModules()); // vm.cds is true if the VM is compiled with cds support. map.put("vm.cds", vmCDS()); map.put("vm.cds.custom.loaders", vmCDSForCustomLoaders()); @@ -334,6 +336,33 @@ return "" + Files.exists(jaotc); } + /* + * @return a space-separeted list of AOT'ed modules with a space character + * at the beginning and end, or an empty string if there are none. + */ + protected String vmAotModules() { + String modules = System.getenv().get("TEST_OPTS_AOT_MODULES"); + if (modules == null || modules.equals("")) { + // there is nothing in 'TEST_OPTS_AOT_MODULES', let's try 'JTREG' + String e = System.getenv().get("JTREG"); + if (e == null) { + return ""; + } + + // 'JTREG' is a semicolon-separated list of '=' pairs + modules = Arrays.stream(e.split(";")) + .filter(s -> "AOT_MODULES".equals(s.substring(0, s.indexOf("=")))) + .map(s -> s.substring(s.indexOf("=") + 1)) + .findAny() + .orElse(null); + } + + if (modules != null && !"".equals(modules)) { + return " " + modules.trim() + " "; + } + return ""; + } + /** * Check for CDS support. *