Skip to content

Commit

Permalink
Merge pull request #6784 from LongyuZhang/exclude2
Browse files Browse the repository at this point in the history
Added reading base exclude file as backup
  • Loading branch information
llxia committed Aug 29, 2019
2 parents 0906251 + 4349176 commit 6032e38
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 34 deletions.
25 changes: 25 additions & 0 deletions test/TestConfig/resources/excludes/latest_exclude_base.txt
@@ -0,0 +1,25 @@
##############################################################################
# Copyright (c) 2019, 2019 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
# distribution and is available at https://www.eclipse.org/legal/epl-2.0/
# or the Apache License, Version 2.0 which accompanies this distribution and
# is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# This Source Code may also be made available under the following
# Secondary Licenses when the conditions for such availability set
# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
# General Public License, version 2 with the GNU Classpath
# Exception [1] and GNU General Public License, version 2 with the
# OpenJDK Assembly Exception [2].
#
# [1] https://www.gnu.org/software/classpath/license.html
# [2] http://openjdk.java.net/legal/assembly-exception.html
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
##############################################################################

# Exclude tests temporarily

org.openj9.test.vmArguments.VmArgumentTests:testCrNocr 244 generic-all
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2018 IBM Corp. and others
* Copyright (c) 2001, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -43,43 +43,48 @@ public class IncludeExcludeTestAnnotationTransformer implements IAnnotationTrans
String excludeFile = System.getenv("EXCLUDE_FILE");
logger.info("exclude file is " + excludeFile);
if (excludeFile != null) {
try {
FileReader fileReader = new FileReader(excludeFile);
BufferedReader bufferedReader = new BufferedReader(fileReader);
while ((line = bufferedReader.readLine()) != null) {
if (line.startsWith("#") || line.matches("\\s") || line.isEmpty()) {
// comment to ignore - as the problems list from OpenJDK
} else {
// parse the line and populate the array lists
String[] lineParts = line.split("\\s+");
// expect to exclude all methods with the name that follows : at the start of a line
if (-1 != line.indexOf("*")) {
// TODO exclude all Test classes under the package?
String currentReadingFile = excludeFile;
File fileCheck = new File(currentReadingFile);
if(!fileCheck.exists()) {
int indexBeforeJDKVersion = excludeFile.lastIndexOf("_");
currentReadingFile = excludeFile.substring(0, indexBeforeJDKVersion) + "_base.txt";
logger.info("Unable to open file " + excludeFile + ", changed to read " + currentReadingFile);
}
try {
FileReader fileReader = new FileReader(currentReadingFile);
BufferedReader bufferedReader = new BufferedReader(fileReader);
while ((line = bufferedReader.readLine()) != null) {
if (line.startsWith("#") || line.matches("\\s") || line.isEmpty()) {
// comment to ignore - as the problems list from OpenJDK
} else {
String[] tests = lineParts[0].split(":");
String fileName = tests[0];
String methodsToExclude = "";
if (tests.length > 1) {
methodsToExclude = tests[1];
} else { //exclude class level
methodsToExclude = "ALL";
}
String defectNumber = lineParts[1];
String[] excludeGroups = lineParts[2].split(";");
for (int i = 0; i < excludeGroups.length; i++) {
excludeGroups[i] = "disabled." + excludeGroups[i];
// parse the line and populate the array lists
String[] lineParts = line.split("\\s+");
// expect to exclude all methods with the name that follows : at the start of a line
if (-1 != line.indexOf("*")) {
// TODO exclude all Test classes under the package?
} else {
String[] tests = lineParts[0].split(":");
String fileName = tests[0];
String methodsToExclude = "";
if (tests.length > 1) {
methodsToExclude = tests[1];
} else { //exclude class level
methodsToExclude = "ALL";
}
String defectNumber = lineParts[1];
String[] excludeGroups = lineParts[2].split(";");
for (int i = 0; i < excludeGroups.length; i++) {
excludeGroups[i] = "disabled." + excludeGroups[i];
}
ArrayList<String> excludeGroupNames = new ArrayList<String> (Arrays.asList(excludeGroups));
excludeDatas.add(new ExcludeData(methodsToExclude, fileName, defectNumber, excludeGroupNames));
}
ArrayList<String> excludeGroupNames = new ArrayList<String> (Arrays.asList(excludeGroups));
excludeDatas.add(new ExcludeData(methodsToExclude, fileName, defectNumber, excludeGroupNames));
}
}
}
bufferedReader.close();
} catch(IOException ex) {
logger.info("Error reading file " + currentReadingFile, ex);
}
bufferedReader.close();
} catch(FileNotFoundException ex) {
logger.info("Unable to open file " + excludeFile, ex);
} catch(IOException ex) {
logger.info("Error reading file " + excludeFile, ex);
}
}
}

Expand Down

0 comments on commit 6032e38

Please sign in to comment.