Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jdk vendor in TKG #142

Merged
merged 1 commit into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions envSettings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,30 @@ ifneq ($(AUTO_DETECT), false)
endif

ifndef JDK_VERSION
export JDK_VERSION:=$(DETECTED_JDK_VERSION)
export JDK_VERSION:=$(DETECTED_JDK_VERSION)
else
ifneq ($(JDK_VERSION), $(DETECTED_JDK_VERSION))
$(error DETECTED_JDK_VERSION value is $(DETECTED_JDK_VERSION), settled JDK_VERSION value is $(JDK_VERSION). JDK_VERSION value does not match. Please reset or unset JDK_VERSION)
endif
endif

ifndef JDK_IMPL
export JDK_IMPL:=$(DETECTED_JDK_IMPL)
export JDK_IMPL:=$(DETECTED_JDK_IMPL)
else
ifneq ($(JDK_IMPL), $(DETECTED_JDK_IMPL))
ifneq ($(JDK_IMPL), sap)
$(error DETECTED_JDK_IMPL value is $(DETECTED_JDK_IMPL), settled JDK_IMPL value is $(JDK_IMPL). JDK_IMPL value does not match. Please reset or unset JDK_IMPL)
endif
endif
endif
endif
endif
endif

ifndef JDK_VENDOR
export JDK_VENDOR:=$(DETECTED_JDK_VENDOR)
else
ifneq ($(JDK_VENDOR), $(DETECTED_JDK_VENDOR))
$(error DETECTED_JDK_VENDOR value is $(DETECTED_JDK_VENDOR), settled JDK_VENDOR value is $(JDK_VENDOR). JDK_VENDOR value does not match. Please reset or unset JDK_VENDOR)
endif
endif
else
ifndef SPEC
$(error Please export AUTO_DETECT=true or export SPEC value manually (i.e., export SPEC=linux_x86-64_cmprssptrs))
Expand All @@ -66,5 +74,8 @@ else
ifndef JDK_IMPL
$(error Please export AUTO_DETECT=true or export JDK_IMPL value manually (i.e., export JDK_IMPL=openj9))
endif
ifndef JDK_VENDOR
$(error Please export AUTO_DETECT=true or export JDK_VENDOR value manually (i.e., export JDK_VENDOR=adoptopenjdk))
endif
endif

2 changes: 1 addition & 1 deletion makeGen.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ autoconfig:
perl scripts$(D)configure.pl

autogen: autoconfig
${TEST_JDK_HOME}/bin/java -cp $(Q)$(TKG_JAR)$(P)$(JSON_SIMPLE)$(Q) org.testKitGen.MainRunner --mode=$(MODE) --spec=$(SPEC) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --buildList=${BUILD_LIST} --iterations=$(TEST_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) --testList=$(TESTLIST) --numOfMachines=$(NUM_MACHINES) --testTime=$(TEST_TIME) --TRSSURL=$(TRSS_URL) $(OPTS)
${TEST_JDK_HOME}/bin/java -cp $(Q)$(TKG_JAR)$(P)$(JSON_SIMPLE)$(Q) org.testKitGen.MainRunner --mode=$(MODE) --spec=$(SPEC) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --vendor=$(Q)$(JDK_VENDOR)$(Q) --buildList=${BUILD_LIST} --iterations=$(TEST_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) --testList=$(TESTLIST) --numOfMachines=$(NUM_MACHINES) --testTime=$(TEST_TIME) --TRSSURL=$(TRSS_URL) $(OPTS)

AUTOGEN_FILES = $(wildcard $(CURRENT_DIR)$(D)jvmTest.mk)
AUTOGEN_FILES += $(wildcard $(CURRENT_DIR)$(D)machineConfigure.mk)
Expand Down
9 changes: 8 additions & 1 deletion scripts/resultsSum.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
my $diagnostic = 'failure';
my $jdkVersion = "";
my $jdkImpl = "";
my $jdkVendor = "";
my $buildList = "";
my $spec = "";
my $customTarget = "";
Expand All @@ -47,6 +48,8 @@
($jdkVersion) = $arg =~ /^\-\-jdkVersion=(.*)/;
} elsif ($arg =~ /^\-\-jdkImpl=/) {
($jdkImpl) = $arg =~ /^\-\-jdkImpl=(.*)/;
} elsif ($arg =~ /^\-\-jdkVendor=/) {
($jdkVendor) = $arg =~ /^\-\-jdkVendor=(.*)/;
} elsif ($arg =~ /^\-\-buildList=/) {
($buildList) = $arg =~ /^\-\-buildList=(.*)/;
} elsif ($arg =~ /^\-\-spec=/) {
Expand Down Expand Up @@ -237,8 +240,12 @@ sub resultReporter {
if ((!defined $hudsonUrl) || ($hudsonUrl eq '')) {
$hudsonUrl = "https://ci.adoptopenjdk.net/";
}
my $vendorParam = "";
if ($jdkVendor ne '') {
$vendorParam = "&JDK_VENDOR=" . $jdkVendor;
}

my $rebuildLinkBase = "parambuild/?JDK_VERSION=$jdkVersion&JDK_IMPL=$jdkImpl$buildParam$platformParam$customTargetParam";
my $rebuildLinkBase = "parambuild/?JDK_VERSION=$jdkVersion&JDK_IMPL=$jdkImpl$vendorParam$buildParam$platformParam$customTargetParam";
print "To rebuild the failed test in a jenkins job, copy the following link and fill out the <Jenkins URL> and <FAILED test target>:\n";
print "<Jenkins URL>/$rebuildLinkBase&TARGET=<FAILED test target>\n\n";
print "For example, to rebuild the failed tests in <Jenkins URL>=${hudsonUrl}job/Grinder, use the following links:\n";
Expand Down
3 changes: 2 additions & 1 deletion settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ else
export JDK_IMPL:=$(JDK_IMPL)
endif

export JDK_VENDOR:=$(JDK_VENDOR)

ifndef JVM_VERSION
OPENJDK_VERSION = openjdk$(JDK_VERSION)
Expand Down Expand Up @@ -317,4 +318,4 @@ rmResultFile:

resultsSummary:
$(CD) $(Q)$(TEST_ROOT)$(D)TKG$(D)scripts$(Q); \
perl $(Q)resultsSum.pl$(Q) --failuremk=$(Q)$(FAILEDTARGETS)$(Q) --resultFile=$(Q)$(TEMPRESULTFILE)$(Q) --tapFile=$(Q)$(TAPRESULTFILE)$(Q) --platFile=$(Q)$(PLATFROMFILE)$(Q) --diagnostic=$(DIAGNOSTICLEVEL) --jdkVersion=$(JDK_VERSION) --jdkImpl=$(JDK_IMPL) --spec=$(SPEC) --buildList=$(BUILD_LIST) --customTarget=$(CUSTOM_TARGET)
perl $(Q)resultsSum.pl$(Q) --failuremk=$(Q)$(FAILEDTARGETS)$(Q) --resultFile=$(Q)$(TEMPRESULTFILE)$(Q) --tapFile=$(Q)$(TAPRESULTFILE)$(Q) --platFile=$(Q)$(PLATFROMFILE)$(Q) --diagnostic=$(DIAGNOSTICLEVEL) --jdkVersion=$(JDK_VERSION) --jdkImpl=$(JDK_IMPL) --jdkVendor=$(Q)$(JDK_VENDOR)$(Q) --spec=$(SPEC) --buildList=$(BUILD_LIST) --customTarget=$(CUSTOM_TARGET)
3 changes: 3 additions & 0 deletions src/org/openj9/envInfo/EnvDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private static void parseArgs(String[] args) {
private static void getJavaInfo() {
JavaInfo envDetection = new JavaInfo();
String javaImplInfo = envDetection.getJDKImpl();
String vendorInfo = envDetection.getJDKVendor();
String SPECInfo = envDetection.getSPEC(javaImplInfo);
int javaVersionInfo = envDetection.getJDKVersion();
if (SPECInfo == null || javaVersionInfo == -1 || javaImplInfo == null) {
Expand All @@ -56,6 +57,7 @@ private static void getJavaInfo() {
String SPECvalue = "DETECTED_SPEC=" + SPECInfo + "\n";
String JDKVERSIONvalue = "DETECTED_JDK_VERSION=" + javaVersionInfo + "\n";
String JDKIMPLvalue = "DETECTED_JDK_IMPL=" + javaImplInfo + "\n";
String JDKVENDORvalue = "DETECTED_JDK_VENDOR=" + vendorInfo + "\n";

/**
* autoGenEnv.mk file will be created to store auto detected java info.
Expand All @@ -69,6 +71,7 @@ private static void getJavaInfo() {
output.write(SPECvalue);
output.write(JDKVERSIONvalue);
output.write(JDKIMPLvalue);
output.write(JDKVENDORvalue);
output.close();
} catch (IOException e) {
e.printStackTrace();
Expand Down
29 changes: 29 additions & 0 deletions src/org/openj9/envInfo/JavaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,33 @@ public String getJDKImpl() {
return null;
}
}

public String getJDKVendor() {
String vendor = System.getProperty("java.vendor");
System.out.println("System.getProperty('java.vendor')=" + vendor + "\n");
String vendorLC = vendor.toLowerCase();
if (vendorLC.contains("adoptopenjdk")) {
return "adoptopenjdk";
} else if (vendorLC.contains("eclipse")) {
return "eclipse";
} else if (vendorLC.contains("ibm")) {
return "ibm";
} else if (vendorLC.contains("alibaba")) {
return "alibaba";
} else if (vendorLC.contains("amazon")) {
return "amazon";
} else if (vendorLC.contains("azul")) {
return "azul";
} else if (vendorLC.contains("sap")) {
return "sap";
} else if (vendorLC.contains("bellsoft")) {
return "bellsoft";
} else if (vendorLC.contains("oracle")) {
return "oracle";
} else {
System.out.println("Warning: cannot determine vendor, use System.getProperty('java.vendor')=" + vendor + " directly.\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like in particular how you handled this (versus my hard fail version), it means ones we may have missed can still proceed to use this.

return vendor;
}
}

}
8 changes: 8 additions & 0 deletions src/org/testKitGen/Arguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum Mode {
private String jdkVersion = "";
private String impl = "";
private String buildImpl = "";
private String vendor = "";
private String projectRootDir = System.getProperty("user.dir") + "/..";
private String buildList = "";
private String iterations = "";
Expand All @@ -48,6 +49,7 @@ enum Mode {
+ " Defaults to tests\n"
+ " --jdkVersion=<version> JDK version that the build will run on, e.g. 8, 9, 10, etc.\n"
+ " --impl=<implementation> Java implementation, e.g. openj9, ibm, hotspot, sap\n"
+ " --vendor=<jdk vendor> Java vendor information, e.g. adoptopenjdk, ibm\n"
+ " --projectRootDir=<path> Root path for searching playlist.xml\n"
+ " Defaults to the parent folder of TKG \n"
+ " --buildList=<paths> Comma separated project paths (relative to projectRootDir) to search for playlist.xml\n"
Expand Down Expand Up @@ -100,6 +102,10 @@ public String getBuildImpl() {
return buildImpl;
}

public String getVendor() {
return vendor;
}

public String getProjectRootDir() {
return projectRootDir;
}
Expand Down Expand Up @@ -176,6 +182,8 @@ public void parse(String[] args) {
} else if (impl.equals("hotspot")) {
buildImpl = "hs";
}
} else if (arglc.startsWith("--vendor=")) {
vendor = arglc.substring(arg.indexOf("=") + 1);
} else if (arglc.startsWith("--projectrootdir=")) {
// projectRootDir is case sensitive
projectRootDir = arg.substring(arg.indexOf("=") + 1);
Expand Down
8 changes: 7 additions & 1 deletion src/org/testKitGen/TestInfoParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public TestInfo parse() {
}
if (!isValidImpl) return null;

// Do not generate make target if vendor doesn't match the exported jdk_vendor
List<String> vendors = new ArrayList<String>();
getElements(vendors, "vendors", "vendor", null, ti.getTestCaseName());
boolean isValidVendor = (vendors.size() == 0) || vendors.contains(arg.getVendor());
if (!isValidVendor) return null;

// Do not generate make target if subset doesn't match the exported jdk_version
NodeList subsets = testEle.getElementsByTagName("subset");

Expand Down Expand Up @@ -200,7 +206,7 @@ private void parseDisableInfo(TestInfo ti) {
&& ((variation == null) || var.getVariation().equals(variation))) {
var.addDisabledReasons(comment);
}
}
}
}
}

Expand Down