8338550: Do libubsan1 installation in test container only if requested

Reviewed-by: sgehwolf
This commit is contained in:
Matthias Baesken 2024-08-20 10:43:16 +00:00
parent 89ca5b6fbd
commit 7933e45cda
2 changed files with 10 additions and 4 deletions

View File

@ -321,10 +321,11 @@ public class DockerTestUtils {
private static void generateDockerFile(Path dockerfile, String baseImage,
String baseImageVersion) throws Exception {
String template =
"FROM %s:%s\n" +
"RUN apt-get install libubsan1\n" +
"COPY /jdk /jdk\n" +
String template = "FROM %s:%s\n";
if (baseImage.contains("ubuntu") && DockerfileConfig.isUbsan()) {
template += "RUN apt-get update && apt-get install -y libubsan1\n";
}
template = template + "COPY /jdk /jdk\n" +
"ENV JAVA_HOME=/jdk\n" +
"CMD [\"/bin/bash\"]\n";
String dockerFileStr = String.format(template, baseImage, baseImageVersion);

View File

@ -37,6 +37,11 @@ import jdk.test.lib.Platform;
// Note: base image version should not be an empty string. Use "latest" to get the latest version.
public class DockerfileConfig {
public static boolean isUbsan() {
return Boolean.getBoolean("jdk.test.docker.image.isUbsan");
}
public static String getBaseImageName() {
String name = System.getProperty("jdk.test.docker.image.name");
if (name != null) {