test/tools/jdeps/Basic.java

changeset 2139
defadd528513
parent 1638
fd3fdaff0257
child 2172
aa91bc6e8480
equal deleted inserted replaced
2138:4d8af6fda907 2139:defadd528513
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 /* 24 /*
25 * @test 25 * @test
26 * @bug 8003562 8005428 26 * @bug 8003562 8005428 8015912
27 * @summary Basic tests for jdeps tool 27 * @summary Basic tests for jdeps tool
28 * @build Test p.Foo 28 * @build Test p.Foo
29 * @run main Basic 29 * @run main Basic
30 */ 30 */
31 31
77 test(new File(testDir, "p"), 77 test(new File(testDir, "p"),
78 new String[] {"java.lang", "java.util", "java.lang.management"}, 78 new String[] {"java.lang", "java.util", "java.lang.management"},
79 new String[] {"compact1", "compact1", "compact3"}); 79 new String[] {"compact1", "compact1", "compact3"});
80 // test class-level dependency output 80 // test class-level dependency output
81 test(new File(testDir, "Test.class"), 81 test(new File(testDir, "Test.class"),
82 new String[] {"java.lang.Object", "p.Foo"}, 82 new String[] {"java.lang.Object", "java.lang.String", "p.Foo"},
83 new String[] {"compact1", "not found"}, 83 new String[] {"compact1", "compact1", "not found"},
84 new String[] {"-V", "class"}); 84 new String[] {"-verbose:class"});
85 // test -p option 85 // test -p option
86 test(new File(testDir, "Test.class"), 86 test(new File(testDir, "Test.class"),
87 new String[] {"p.Foo"}, 87 new String[] {"p.Foo"},
88 new String[] {"not found"}, 88 new String[] {"not found"},
89 new String[] {"--verbose-level=class", "-p", "p"}); 89 new String[] {"-verbose:class", "-p", "p"});
90 // test -e option 90 // test -e option
91 test(new File(testDir, "Test.class"), 91 test(new File(testDir, "Test.class"),
92 new String[] {"p.Foo"}, 92 new String[] {"p.Foo"},
93 new String[] {"not found"}, 93 new String[] {"not found"},
94 new String[] {"-V", "class", "-e", "p\\..*"}); 94 new String[] {"-verbose:class", "-e", "p\\..*"});
95 test(new File(testDir, "Test.class"), 95 test(new File(testDir, "Test.class"),
96 new String[] {"java.lang"}, 96 new String[] {"java.lang"},
97 new String[] {"compact1"}, 97 new String[] {"compact1"},
98 new String[] {"-V", "package", "-e", "java\\.lang\\..*"}); 98 new String[] {"-verbose:package", "-e", "java\\.lang\\..*"});
99 // test -classpath and wildcard options 99 // test -classpath and -include options
100 test(null, 100 test(null,
101 new String[] {"com.sun.tools.jdeps", "java.lang", "java.util", 101 new String[] {"java.lang", "java.util",
102 "java.util.regex", "java.io", "java.nio.file",
103 "java.lang.management"}, 102 "java.lang.management"},
104 new String[] {(symbolFileExist? "not found" : "JDK internal API (classes)"), 103 new String[] {"compact1", "compact1", "compact3"},
105 "compact1", "compact1", "compact1", 104 new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"});
106 "compact1", "compact1", "compact3"}, 105 test(new File(testDir, "Test.class"),
107 new String[] {"--classpath", testDir.getPath(), "*"}); 106 new String[] {"java.lang.Object", "java.lang.String", "p.Foo"},
108 /* Temporary disable this test case. Test.class has a dependency 107 new String[] {"compact1", "compact1", testDir.getName()},
109 * on java.lang.String on certain windows machine (8008479). 108 new String[] {"-v", "-classpath", testDir.getPath(), "Test.class"});
110 // -v shows intra-dependency
111 test(new File(testDir, "Test.class"),
112 new String[] {"java.lang.Object", "p.Foo"},
113 new String[] {"compact1", testDir.getName()},
114 new String[] {"-v", "--classpath", testDir.getPath(), "Test.class"});
115 */
116 return errors; 109 return errors;
117 } 110 }
118 111
119 void test(File file, String[] expect, String[] profiles) { 112 void test(File file, String[] expect, String[] profiles) {
120 test(file, expect, profiles, new String[0]); 113 test(file, expect, profiles, new String[0]);

mercurial