diff --git testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/HostExecutor.java testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/HostExecutor.java index b05d2c2..3223204 100644 --- testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/HostExecutor.java +++ testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/HostExecutor.java @@ -39,6 +39,7 @@ import org.apache.hive.ptest.execution.ssh.SSHCommandExecutor; import org.apache.hive.ptest.execution.ssh.SSHExecutionException; import org.apache.hive.ptest.execution.ssh.SSHResult; +import org.apache.logging.log4j.util.Strings; import org.slf4j.Logger; import com.google.common.annotations.VisibleForTesting; @@ -210,6 +211,9 @@ private boolean executeTestBatch(Drone drone, TestBatch batch, Set fa templateVariables.put("testArguments", batch.getTestArguments()); templateVariables.put("localDir", drone.getLocalDirectory()); templateVariables.put("logDir", drone.getLocalLogDirectory()); + if (!Strings.isEmpty(batch.getTestModule())) { + templateVariables.put("testModule", batch.getTestModule()); + } String command = Templates.getTemplateResult("bash $localDir/$instanceName/scratch/" + script.getName(), templateVariables); Templates.writeTemplateResult("batch-exec.vm", script, templateVariables); diff --git testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java index 61ecc88..5ba33d1 100644 --- testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java +++ testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/QFileTestBatch.java @@ -29,10 +29,11 @@ private final String driver; private final String queryFilesProperty; private final String name; + private final String moduleName; private final Set tests; private final boolean isParallel; public QFileTestBatch(String testCasePropertyName, String driver, - String queryFilesProperty, Set tests, boolean isParallel) { + String queryFilesProperty, Set tests, boolean isParallel, String moduleName) { this.testCasePropertyName = testCasePropertyName; this.driver = driver; this.queryFilesProperty = queryFilesProperty; @@ -44,6 +45,7 @@ public QFileTestBatch(String testCasePropertyName, String driver, } this.name = name; this.isParallel = isParallel; + this.moduleName = moduleName; } public String getDriver() { return driver; @@ -72,6 +74,12 @@ public String toString() { public boolean isParallel() { return isParallel; } + + @Override + public String getTestModule() { + return moduleName; + } + @Override public int hashCode() { final int prime = 31; diff --git testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestBatch.java testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestBatch.java index fc5a7c5..4ebb670 100644 --- testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestBatch.java +++ testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestBatch.java @@ -28,4 +28,5 @@ public boolean isParallel(); + public String getTestModule(); } diff --git testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestParser.java testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestParser.java index aef6ac1..76d4406 100644 --- testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestParser.java +++ testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestParser.java @@ -50,6 +50,8 @@ private static final Splitter TEST_SPLITTER = Splitter.onPattern("[, ]") .trimResults().omitEmptyStrings(); + private static final String QTEST_MODULE_NAME = "qtest"; + private final Context context; private final String testCasePropertyName; private final File sourceDirectory; @@ -177,17 +179,20 @@ public TestParser(Context context, String testCasePropertyName, logger.info("Exlcuding test " + driver + " " + test); } else if(isolated.contains(test)) { logger.info("Executing isolated test " + driver + " " + test); - testBatches.add(new QFileTestBatch(testCasePropertyName, driver, queryFilesProperty, Sets.newHashSet(test), isParallel)); + testBatches.add(new QFileTestBatch(testCasePropertyName, driver, queryFilesProperty, + Sets.newHashSet(test), isParallel, QTEST_MODULE_NAME)); } else { if(testBatch.size() >= batchSize) { - testBatches.add(new QFileTestBatch(testCasePropertyName, driver, queryFilesProperty, Sets.newHashSet(testBatch), isParallel)); + testBatches.add(new QFileTestBatch(testCasePropertyName, driver, queryFilesProperty, + Sets.newHashSet(testBatch), isParallel, QTEST_MODULE_NAME)); testBatch = Lists.newArrayList(); } testBatch.add(test); } } if(!testBatch.isEmpty()) { - testBatches.add(new QFileTestBatch(testCasePropertyName, driver, queryFilesProperty, Sets.newHashSet(testBatch), isParallel)); + testBatches.add(new QFileTestBatch(testCasePropertyName, driver, queryFilesProperty, + Sets.newHashSet(testBatch), isParallel, QTEST_MODULE_NAME)); } return testBatches; } diff --git testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/UnitTestBatch.java testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/UnitTestBatch.java index ca1adec..51f7f90 100644 --- testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/UnitTestBatch.java +++ testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/UnitTestBatch.java @@ -51,6 +51,12 @@ public String toString() { public boolean isParallel() { return isParallel; } + + @Override + public String getTestModule() { + return null; + } + @Override public int hashCode() { final int prime = 31;