< prev index next >

test/jdk/tools/launcher/VersionCheck.java

Print this page

 63         "jpackage",
 64         "ssvagent",
 65         "jwebserver"
 66     };
 67 
 68     // tools that do not accept -version
 69     static final String[] BLACKLIST_VERSION = {
 70         "appletviewer",
 71         "controlpanel",
 72         "jaccessinspector",
 73         "jaccessinspector-32",
 74         "jaccesswalker",
 75         "jaccesswalker-32",
 76         "jar",
 77         "jarsigner",
 78         "java-rmi",
 79         "java-rmi.cgi",
 80         "javadoc",
 81         "javacpl",
 82         "javaws",

 83         "jcmd",
 84         "jconsole",
 85         "jcontrol",
 86         "jdeprscan",
 87         "jdeps",
 88         "jfr",

 89         "jimage",
 90         "jinfo",
 91         "jlink",
 92         "jmap",
 93         "jmod",
 94         "jmc",
 95         "jmc.ini",
 96         "jps",
 97         "jrunscript",
 98         "jjs",
 99         "jstack",
100         "jstat",
101         "jstatd",
102         "jweblauncher",
103         "keytool",
104         "kinit",
105         "klist",
106         "ktab",
107         "jpackage",
108         "rmiregistry",

158                 failed.add(f.getName());
159             }
160         }
161         if (failed.isEmpty()) {
162             System.out.println("testToolVersion passed");
163             return "";
164         } else {
165             System.out.println("testToolVersion failed");
166             return "testToolVersion: " + failed + "; ";
167         }
168 
169     }
170 
171     static String testJVersionStrings() {
172         System.out.println("=== testJVersionStrings === ");
173         Set<String> failed = new HashSet<>();
174         for (File f : new File(JAVA_BIN).listFiles(new ToolFilter(BLACKLIST_JOPTION))) {
175             System.out.println("Testing " + f.getName());
176             String x = f.getAbsolutePath();
177             String testStr = getVersion(x, "-J-version");




178             if (refVersion.compareTo(testStr) != 0) {
179                 failed.add(f.getName());
180                 System.out.println("Error: " + x +
181                                    " fails -J-version comparison");
182                 System.out.println("Expected:");
183                 System.out.print(refVersion);
184                 System.out.println("Actual:");
185                 System.out.print(testStr);
186             }
187 
188             testStr = getVersion(x, "-J-fullversion");
189             if (refFullVersion.compareTo(testStr) != 0) {
190                 failed.add(f.getName());
191                 System.out.println("Error: " + x +
192                                    " fails -J-fullversion comparison");
193                 System.out.println("Expected:");
194                 System.out.print(refFullVersion);
195                 System.out.println("Actual:");
196                 System.out.print(testStr);
197             }

 63         "jpackage",
 64         "ssvagent",
 65         "jwebserver"
 66     };
 67 
 68     // tools that do not accept -version
 69     static final String[] BLACKLIST_VERSION = {
 70         "appletviewer",
 71         "controlpanel",
 72         "jaccessinspector",
 73         "jaccessinspector-32",
 74         "jaccesswalker",
 75         "jaccesswalker-32",
 76         "jar",
 77         "jarsigner",
 78         "java-rmi",
 79         "java-rmi.cgi",
 80         "javadoc",
 81         "javacpl",
 82         "javaws",
 83         "jextract",
 84         "jcmd",
 85         "jconsole",
 86         "jcontrol",
 87         "jdeprscan",
 88         "jdeps",
 89         "jfr",
 90         "jextract",
 91         "jimage",
 92         "jinfo",
 93         "jlink",
 94         "jmap",
 95         "jmod",
 96         "jmc",
 97         "jmc.ini",
 98         "jps",
 99         "jrunscript",
100         "jjs",
101         "jstack",
102         "jstat",
103         "jstatd",
104         "jweblauncher",
105         "keytool",
106         "kinit",
107         "klist",
108         "ktab",
109         "jpackage",
110         "rmiregistry",

160                 failed.add(f.getName());
161             }
162         }
163         if (failed.isEmpty()) {
164             System.out.println("testToolVersion passed");
165             return "";
166         } else {
167             System.out.println("testToolVersion failed");
168             return "testToolVersion: " + failed + "; ";
169         }
170 
171     }
172 
173     static String testJVersionStrings() {
174         System.out.println("=== testJVersionStrings === ");
175         Set<String> failed = new HashSet<>();
176         for (File f : new File(JAVA_BIN).listFiles(new ToolFilter(BLACKLIST_JOPTION))) {
177             System.out.println("Testing " + f.getName());
178             String x = f.getAbsolutePath();
179             String testStr = getVersion(x, "-J-version");
180             if (f.getName().startsWith("jextract")) {
181                 // skip the WARNING: Unknown module: jdk.incubator.jextract specified to --enable-native-access line
182                 testStr = testStr.substring(testStr.indexOf('\n') + 1);
183             }
184             if (refVersion.compareTo(testStr) != 0) {
185                 failed.add(f.getName());
186                 System.out.println("Error: " + x +
187                                    " fails -J-version comparison");
188                 System.out.println("Expected:");
189                 System.out.print(refVersion);
190                 System.out.println("Actual:");
191                 System.out.print(testStr);
192             }
193 
194             testStr = getVersion(x, "-J-fullversion");
195             if (refFullVersion.compareTo(testStr) != 0) {
196                 failed.add(f.getName());
197                 System.out.println("Error: " + x +
198                                    " fails -J-fullversion comparison");
199                 System.out.println("Expected:");
200                 System.out.print(refFullVersion);
201                 System.out.println("Actual:");
202                 System.out.print(testStr);
203             }
< prev index next >