32 import java.util.ArrayList;
33 import java.util.Arrays;
34 import java.util.Deque;
35 import java.util.List;
36 import java.util.Set;
37 import java.util.concurrent.ConcurrentLinkedDeque;
38 import java.util.concurrent.ExecutorService;
39 import java.util.concurrent.Executors;
40 import java.util.concurrent.TimeUnit;
41 import java.util.concurrent.atomic.AtomicInteger;
42 import java.util.stream.Collectors;
43 import java.util.stream.Stream;
44
45 import jdk.internal.jimage.BasicImageReader;
46 import jdk.internal.jimage.ImageLocation;
47
48 /*
49 * @test
50 * @summary Verify jimage
51 * @modules java.base/jdk.internal.jimage
52 * @run main/othervm -Djdk.launcher.addmods=ALL-SYSTEM VerifyJimage
53 */
54
55 /**
56 * This test runs in two modes:
57 * (1) No argument: it verifies the jimage by loading all classes in the runtime
58 * (2) path of exploded modules: it compares bytes of each file in the exploded
59 * module with the entry in jimage
60 *
61 * FIXME: exception thrown when findLocation from jimage by multiple threads
62 * -Djdk.test.threads=<n> to specify the number of threads.
63 */
64 public class VerifyJimage {
65 private static final String MODULE_INFO = "module-info.class";
66 private static final Deque<String> failed = new ConcurrentLinkedDeque<>();
67
68 public static void main(String... args) throws Exception {
69
70 String home = System.getProperty("java.home");
71 Path bootimagePath = Paths.get(home, "lib", "modules");
72 if (Files.notExists(bootimagePath)) {
|
32 import java.util.ArrayList;
33 import java.util.Arrays;
34 import java.util.Deque;
35 import java.util.List;
36 import java.util.Set;
37 import java.util.concurrent.ConcurrentLinkedDeque;
38 import java.util.concurrent.ExecutorService;
39 import java.util.concurrent.Executors;
40 import java.util.concurrent.TimeUnit;
41 import java.util.concurrent.atomic.AtomicInteger;
42 import java.util.stream.Collectors;
43 import java.util.stream.Stream;
44
45 import jdk.internal.jimage.BasicImageReader;
46 import jdk.internal.jimage.ImageLocation;
47
48 /*
49 * @test
50 * @summary Verify jimage
51 * @modules java.base/jdk.internal.jimage
52 * @run main/othervm --add-modules=ALL-SYSTEM VerifyJimage
53 */
54
55 /**
56 * This test runs in two modes:
57 * (1) No argument: it verifies the jimage by loading all classes in the runtime
58 * (2) path of exploded modules: it compares bytes of each file in the exploded
59 * module with the entry in jimage
60 *
61 * FIXME: exception thrown when findLocation from jimage by multiple threads
62 * -Djdk.test.threads=<n> to specify the number of threads.
63 */
64 public class VerifyJimage {
65 private static final String MODULE_INFO = "module-info.class";
66 private static final Deque<String> failed = new ConcurrentLinkedDeque<>();
67
68 public static void main(String... args) throws Exception {
69
70 String home = System.getProperty("java.home");
71 Path bootimagePath = Paths.get(home, "lib", "modules");
72 if (Files.notExists(bootimagePath)) {
|