Skip to content

Commit

Permalink
Merge pull request #7616 from renfeiw/tkg8
Browse files Browse the repository at this point in the history
Update testKitGen
  • Loading branch information
llxia authored Oct 30, 2019
2 parents 53b57d9 + 23c2791 commit 7503e41
Showing 1 changed file with 39 additions and 55 deletions.
94 changes: 39 additions & 55 deletions test/TestConfig/src/org/testKitGen/MkGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ private void writeSingleTest(TestInfo testInfo, FileWriter f) throws IOException
// Generate make target
String name = var.getSubTestName();

// TODO: skip test if it is not valid
String condition_platform = null;
if (!var.isValid()) {
condition_platform = name + "_INVALID_PLATFORM_CHECK";
f.write(condition_platform + "=$(filter " + Options.getSpec() + ", $(SPEC))\n");
}

if (!testInfo.getCapabilities().isEmpty()) {
List<String> capabilityReqs_HashKeys = new ArrayList<>(testInfo.getCapabilities().keySet());
Collections.sort(capabilityReqs_HashKeys);
Expand All @@ -149,12 +142,6 @@ private void writeSingleTest(TestInfo testInfo, FileWriter f) throws IOException

String jvmtestroot = "$(JVM_TEST_ROOT)$(D)" + String.join("$(D)", currentdirs);
f.write(name + ": TEST_RESROOT=" + jvmtestroot + "\n");

// TODO: keep for now to match result with perl testkitgen, remove after test
if (testInfo.getIterations() != Integer.parseInt(Options.getIterations())) {
f.write(name + ": TEST_ITERATIONS=" + testInfo.getIterations() + "\n");
}

f.write(name + ": JVM_OPTIONS?=" + testInfo.getAotOptions() + "$(RESERVED_OPTIONS) "
+ (var.getJvmOptions().isEmpty() ? "" : (var.getJvmOptions() + " ")) + "$(EXTRA_OPTIONS)\n");

Expand All @@ -179,50 +166,47 @@ private void writeSingleTest(TestInfo testInfo, FileWriter f) throws IOException
}
}

if (condition_platform != null) {
f.write("ifeq ($(" + condition_platform + "),)\n");
}
List<String> capKeys = new ArrayList<String>(testInfo.getCapabilities().keySet());
if (!capKeys.isEmpty()) {
Collections.sort(capKeys);
for (String cKey : capKeys) {
String condition_capsReqs = name + "_" + cKey + "_CHECK";
f.write("ifeq ($(" + condition_capsReqs + "), " + testInfo.getCapabilities().get(cKey) + ")\n");
if (var.isValid()) {
List<String> capKeys = new ArrayList<String>(testInfo.getCapabilities().keySet());
if (!capKeys.isEmpty()) {
Collections.sort(capKeys);
for (String cKey : capKeys) {
String condition_capsReqs = name + "_" + cKey + "_CHECK";
f.write("ifeq ($(" + condition_capsReqs + "), " + testInfo.getCapabilities().get(cKey) + ")\n");
}
}
}

f.write(indent + "$(TEST_SETUP);\n");

f.write(indent + "@echo \"variation: " + var.getVariation()
+ "\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");
f.write(indent
+ "@echo \"JVM_OPTIONS: $(JVM_OPTIONS)\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");

f.write(indent + "{ ");
for (int k = 1; k <= testInfo.getIterations(); k++) {
f.write("itercnt=" + k + "; \\\n" + indent + "$(MKTREE) $(REPORTDIR); \\\n" + indent
+ "$(CD) $(REPORTDIR); \\\n");
f.write(indent + testInfo.getCommand() + ";");
if (k != testInfo.getIterations()) {
f.write(" \\\n" + indent);

f.write(indent + "$(TEST_SETUP);\n");

f.write(indent + "@echo \"variation: " + var.getVariation()
+ "\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");
f.write(indent
+ "@echo \"JVM_OPTIONS: $(JVM_OPTIONS)\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");

f.write(indent + "{ ");
for (int k = 1; k <= testInfo.getIterations(); k++) {
f.write("itercnt=" + k + "; \\\n" + indent + "$(MKTREE) $(REPORTDIR); \\\n" + indent
+ "$(CD) $(REPORTDIR); \\\n");
f.write(indent + testInfo.getCommand() + ";");
if (k != testInfo.getIterations()) {
f.write(" \\\n" + indent);
}
}
}
f.write(" } 2>&1 | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");

f.write(indent + "$(TEST_TEARDOWN);\n");

if (!capKeys.isEmpty()) {
Collections.sort(capKeys, Collections.reverseOrder());
for (String cKey : capKeys) {
f.write("else\n");
f.write(indent + "@echo \"Skipped due to capabilities (" + cKey + ":"
+ testInfo.getCapabilities().get(cKey)
+ ") => $(TEST_SKIP_STATUS)\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");
f.write("endif\n");
f.write(" } 2>&1 | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");

f.write(indent + "$(TEST_TEARDOWN);\n");

if (!capKeys.isEmpty()) {
Collections.sort(capKeys, Collections.reverseOrder());
for (String cKey : capKeys) {
f.write("else\n");
f.write(indent + "@echo \"Skipped due to capabilities (" + cKey + ":"
+ testInfo.getCapabilities().get(cKey)
+ ") => $(TEST_SKIP_STATUS)\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");
f.write("endif\n");
}
}
}
if (condition_platform != null) {
f.write("else\n");
} else {
if (testInfo.getPlatformRequirements() != null) {
f.write(indent
+ "@echo \"Skipped due to jvm options ($(JVM_OPTIONS)) and/or platform requirements ("
Expand All @@ -232,8 +216,8 @@ private void writeSingleTest(TestInfo testInfo, FileWriter f) throws IOException
f.write(indent
+ "@echo \"Skipped due to jvm options ($(JVM_OPTIONS)) => $(TEST_SKIP_STATUS)\" | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q);\n");
}
f.write("endif\n");
}

f.write(indent + "@perl '-MTime::HiRes=gettimeofday' -e 'print \"" + name
+ " Finish Time: \" . localtime() . \" Epoch Time (ms): \" . int (gettimeofday * 1000) . \"\\n\"' | tee -a $(Q)$(TESTOUTPUT)$(D)TestTargetResult$(Q)\n");

Expand Down

0 comments on commit 7503e41

Please sign in to comment.