Skip to content

Commit

Permalink
Merge pull request #659 from annaibm/zoscheck
Browse files Browse the repository at this point in the history
Revert "Merge pull request #608 from psoujany/revert-options"
  • Loading branch information
JasonFengJ9 authored Jan 15, 2025
2 parents 5d1a3a6 + 047275b commit 0f4f2e6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 53 deletions.
8 changes: 8 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,16 @@ endif

UNAME := uname
UNAME_OS := $(shell $(UNAME) -s | cut -f1 -d_)
$(info UNAME_OS is $(UNAME_OS))
ifeq ($(findstring CYGWIN,$(UNAME_OS)), CYGWIN)
LIB_DIR:=$(shell cygpath -w $(LIB_DIR))
else ifeq ($(UNAME_OS),OS/390)
# The issue is still being investigated. See backlog/issues/1424
# set -Dfile.encoding=IBM-1047 for JDK21+ zOS for now
ifeq ($(shell test $(JDK_VERSION) -ge 21; echo $$?),0)
export IBM_JAVA_OPTIONS="-Dfile.encoding=IBM-1047"
$(info export IBM_JAVA_OPTIONS="-Dfile.encoding=IBM-1047")
endif
endif

export LIB_DIR:=$(subst \,/,$(LIB_DIR))
Expand Down
10 changes: 6 additions & 4 deletions src/org/openj9/envInfo/EnvDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

package org.openj9.envInfo;

import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.io.Writer;
import java.io.BufferedWriter;

public class EnvDetector {
static boolean isMachineInfo = false;
Expand Down Expand Up @@ -78,9 +80,9 @@ private static void getJavaInfo() {
/**
* autoGenEnv.mk file will be created to store auto detected java info.
*/
Writer output = null;
BufferedWriter output = null;
try {
output = Utility.getWriterObject(javaVersionInfo, SPECInfo, "autoGenEnv.mk");
output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("autoGenEnv.mk")));
output.write("########################################################\n");
output.write("# This is an auto generated file. Please do NOT modify!\n");
output.write("########################################################\n");
Expand All @@ -92,7 +94,7 @@ private static void getJavaInfo() {
output.write(JDK_VENDOR);
output.write(TEST_FLAG);
output.close();
output = Utility.getWriterObject(javaVersionInfo, SPECInfo, "AQACert.log");
output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("AQACert.log")));
output.write(JAVA_VERSION);
output.write(RELEASE_INFO);
output.close();
Expand Down
27 changes: 0 additions & 27 deletions src/org/openj9/envInfo/Utility.java

This file was deleted.

13 changes: 4 additions & 9 deletions src/org/testKitGen/MkGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@

package org.testKitGen;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.openj9.envInfo.JavaInfo;
import org.openj9.envInfo.Utility;

public class MkGen {
private Arguments arg;
private JavaInfo jInfo;
private TestTarget tt;
private List<String> dirList;
private List<String> subdirs;
Expand All @@ -34,7 +30,6 @@ public class MkGen {

public MkGen(Arguments arg, TestTarget tt, PlaylistInfo pli, String makeFile, List<String> dirList, List<String> subdirs) {
this.arg = arg;
this.jInfo = new JavaInfo();
this.tt = tt;
this.dirList = dirList;
this.subdirs = subdirs;
Expand All @@ -51,7 +46,7 @@ public void start() {
}

private void writeVars() {
try (Writer f = Utility.getWriterObject(jInfo.getJDKVersion(), arg.getSpec(), makeFile)) {
try (FileWriter f = new FileWriter(makeFile)) {
String realtiveRoot = "";
int subdirlevel = dirList.size();
if (subdirlevel == 0) {
Expand All @@ -77,7 +72,7 @@ private void writeVars() {
}
}

private void writeSingleTest(List<String> testsInPlaylist, TestInfo testInfo, Writer f) throws IOException {
private void writeSingleTest(List<String> testsInPlaylist, TestInfo testInfo, FileWriter f) throws IOException {
for (Variation var : testInfo.getVars()) {
// Generate make target
String testTargetName = var.getSubTestName();
Expand Down Expand Up @@ -249,7 +244,7 @@ private void writeSingleTest(List<String> testsInPlaylist, TestInfo testInfo, Wr
}

private void writeTargets() {
try (Writer f = Utility.getWriterObject(jInfo.getJDKVersion(), arg.getSpec(), makeFile)) {
try (FileWriter f = new FileWriter(makeFile, true)) {
if (!pli.getIncludeList().isEmpty()) {
for (String include : pli.getIncludeList()) {
f.write("-include " + include + "\n\n");
Expand Down
5 changes: 1 addition & 4 deletions src/org/testKitGen/ModesDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.openj9.envInfo.JavaInfo;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class ModesDictionary {
private Arguments arg;
private JavaInfo jInfo;
private String modesXml;
private String ottawaCsv;
private Map<String, String> spec2platMap;
Expand All @@ -46,7 +44,6 @@ public class ModesDictionary {

public ModesDictionary(Arguments arg) {
this.arg = arg;
jInfo = new JavaInfo();
modesXml= arg.getProjectRootDir() + "/TKG/" + Constants.MODESXML;
ottawaCsv = arg.getProjectRootDir() + "/TKG/" + Constants.OTTAWACSV;
spec2platMap = new HashMap<String, String>();
Expand Down Expand Up @@ -101,7 +98,7 @@ private void parseInvalidSpec(Element modes) throws IOException {
ArrayList<String> specs = new ArrayList<String>();
int lineNum = 0;
BufferedReader reader = null;
if (arg.getSpec().toLowerCase().contains("zos") && !(jInfo.getJDKVersion() >= 21)) {
if (arg.getSpec().toLowerCase().contains("zos")) {
reader = Files.newBufferedReader(Paths.get(ottawaCsv), Charset.forName("IBM-1047"));
} else {
reader = Files.newBufferedReader(Paths.get(ottawaCsv));
Expand Down
12 changes: 3 additions & 9 deletions src/org/testKitGen/UtilsGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,20 @@
package org.testKitGen;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.List;

import org.openj9.envInfo.JavaInfo;
import org.openj9.envInfo.Utility;


public class UtilsGen {
private Arguments arg;
private ModesDictionary md;
private JavaInfo jInfo;
private String utilsMk;
private String rerunMk;
private List<String> ignoreOnRerunList;

public UtilsGen(Arguments arg, ModesDictionary md, List<String> ignoreOnRerunList) {
this.arg = arg;
this.md = md;
this.jInfo = new JavaInfo();
this.utilsMk = arg.getProjectRootDir() + "/TKG/" + Constants.UTILSMK;
this.rerunMk = arg.getProjectRootDir() + "/TKG/" + Constants.RERUNMK;
this.ignoreOnRerunList = ignoreOnRerunList;
Expand All @@ -46,7 +40,7 @@ public void generateFiles() {
}

private void generateUtil() {
try (Writer f = Utility.getWriterObject(jInfo.getJDKVersion(), arg.getSpec(), utilsMk)) {
try (FileWriter f = new FileWriter(utilsMk)) {
f.write(Constants.HEADERCOMMENTS);
f.write("TOTALCOUNT := " + TestInfo.numOfTests() + "\n");
f.write("PLATFORM=\n");
Expand All @@ -62,7 +56,7 @@ private void generateUtil() {
}

private void generateRerun() {
try (Writer f = Utility.getWriterObject(jInfo.getJDKVersion(), arg.getSpec(), rerunMk)) {
try (FileWriter f = new FileWriter(rerunMk)) {
f.write(Constants.HEADERCOMMENTS);
String ignoreOnRerunStr = String.join(",", ignoreOnRerunList);
f.write("IGNORE_ON_RERUN=");
Expand Down

0 comments on commit 0f4f2e6

Please sign in to comment.