< prev index next >

test/jdk/tools/launcher/VersionCheck.java

Print this page

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

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

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

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




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

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

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