diff --git a/jdk/test/tools/launcher/TestHelper.java b/jdk/test/tools/launcher/TestHelper.java index 40737320d52..06dab9d322f 100644 --- a/jdk/test/tools/launcher/TestHelper.java +++ b/jdk/test/tools/launcher/TestHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2020, 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 @@ -103,10 +103,12 @@ public class TestHelper { // make a note of the golden default locale static final Locale DefaultLocale = Locale.getDefault(); - static final String JAVA_FILE_EXT = ".java"; - static final String CLASS_FILE_EXT = ".class"; - static final String JAR_FILE_EXT = ".jar"; - static final String EXE_FILE_EXT = ".exe"; + static final String JAVA_FILE_EXT = ".java"; + static final String CLASS_FILE_EXT = ".class"; + static final String JAR_FILE_EXT = ".jar"; + static final String EXE_FILE_EXT = ".exe"; + static final String MAC_DSYM_EXT = ".dsym"; + static final String NIX_DBGINFO_EXT = ".debuginfo"; static final String JLDEBUG_KEY = "_JAVA_LAUNCHER_DEBUG"; static final String EXPECTED_MARKER = "TRACER_MARKER:About to EXEC"; static final String TEST_PREFIX = "###TestError###: "; @@ -506,6 +508,43 @@ static boolean isEnglishLocale() { return Locale.getDefault().getLanguage().equals("en"); } + static class ToolFilter implements FileFilter { + final List exclude = new ArrayList<>(); + protected ToolFilter(String... exclude) { + for (String x : exclude) { + String str = x + ((isWindows) ? EXE_FILE_EXT : ""); + this.exclude.add(str.toLowerCase()); + } + } + + @Override + public boolean accept(File pathname) { + if (!pathname.isFile() || !pathname.canExecute()) { + return false; + } + String name = pathname.getName().toLowerCase(); + if (isWindows) { + if (!name.endsWith(EXE_FILE_EXT)) { + return false; + } + } else if (isMacOSX) { + if (name.endsWith(MAC_DSYM_EXT)) { + return false; + } + } else { + if (name.endsWith(NIX_DBGINFO_EXT)) { + return false; + } + } + for (String x : exclude) { + if (name.endsWith(x)) { + return false; + } + } + return true; + } + } + /* * A class to encapsulate the test results and stuff, with some ease * of use methods to check the test results. diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java index c175e8dede7..8d8c1d4f0ad 100644 --- a/jdk/test/tools/launcher/VersionCheck.java +++ b/jdk/test/tools/launcher/VersionCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -31,11 +31,12 @@ */ import java.io.File; -import java.io.FileFilter; -import java.util.Map; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; public class VersionCheck extends TestHelper { @@ -227,32 +228,4 @@ public static void main(String[] args) { throw new AssertionError("Some tests failed"); } } - - static class ToolFilter implements FileFilter { - final Iterable exclude ; - protected ToolFilter(String... exclude) { - List tlist = new ArrayList<>(); - this.exclude = tlist; - for (String x : exclude) { - String str = x + ((isWindows) ? EXE_FILE_EXT : ""); - tlist.add(str.toLowerCase()); - } - } - @Override - public boolean accept(File pathname) { - if (!pathname.isFile() || !pathname.canExecute()) { - return false; - } - String name = pathname.getName().toLowerCase(); - if (isWindows && !name.endsWith(EXE_FILE_EXT)) { - return false; - } - for (String x : exclude) { - if (name.endsWith(x)) { - return false; - } - } - return true; - } - } }