--- a/test/jdk/tools/jlink/JLinkReproducibleTest.java Tue Oct 29 08:26:55 2019 -0700
+++ b/test/jdk/tools/jlink/JLinkReproducibleTest.java Tue Oct 29 10:13:27 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -43,7 +43,7 @@
res.shouldHaveExitValue(0);
}
- private static void jlink(Path image) throws Exception {
+ private static void jlink(Path image, boolean with_default_trace_file) throws Exception {
var cmd = new ArrayList<String>();
cmd.add(JDKToolFinder.getJDKTool("jlink"));
cmd.addAll(List.of(
@@ -52,6 +52,9 @@
"--compress=2",
"--output", image.toString()
));
+ if (!with_default_trace_file) {
+ cmd.add("--generate-jli-classes=@file-not-exists");
+ }
run(cmd);
}
@@ -98,17 +101,31 @@
// Link the first image
var firstImage = Path.of("image-first");
- jlink(firstImage);
+ jlink(firstImage, true);
var firstModulesFile = firstImage.resolve("lib")
.resolve("modules");
// Link the second image
var secondImage = Path.of("image-second");
- jlink(secondImage);
+ jlink(secondImage, true);
var secondModulesFile = secondImage.resolve("lib")
.resolve("modules");
// Ensure module files are identical
assertEquals(-1L, Files.mismatch(firstModulesFile, secondModulesFile));
+
+ // Link the third image
+ var thirdImage = Path.of("image-third");
+ jlink(thirdImage, false);
+ var thirdModulesFile = thirdImage.resolve("lib")
+ .resolve("modules");
+ // Link the fourth image
+ var fourthImage = Path.of("image-fourth");
+ jlink(fourthImage, false);
+ var fourthModulesFile = fourthImage.resolve("lib")
+ .resolve("modules");
+
+ // Ensure module files are identical
+ assertEquals(-1L, Files.mismatch(thirdModulesFile, fourthModulesFile));
}
}