You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by br...@apache.org on 2013/10/04 18:51:44 UTC

svn commit: r1529212 - in /hive/trunk/testutils/ptest2/src: main/java/org/apache/hive/ptest/execution/ main/java/org/apache/hive/ptest/execution/conf/ main/resources/ test/java/org/apache/hive/ptest/execution/

Author: brock
Date: Fri Oct  4 16:51:44 2013
New Revision: 1529212

URL: http://svn.apache.org/r1529212
Log:
HIVE-5382 - PTest2 should allow you to specify ant properties which will only be added to the command when a test is executed

Modified:
    hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java
    hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java
    hive/trunk/testutils/ptest2/src/main/resources/batch-exec.vm
    hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java
    hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt
    hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt

Modified: hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java?rev=1529212&r1=1529211&r2=1529212&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java (original)
+++ hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/PTest.java Fri Oct  4 16:51:44 2013
@@ -107,6 +107,7 @@ public class PTest {
     put("clearLibraryCache", String.valueOf(configuration.isClearLibraryCache())).
     put("workingDir", mExecutionContext.getLocalWorkingDirectory()).
     put("antArgs", configuration.getAntArgs()).
+    put("antTestArgs", configuration.getAntTestArgs()).
     put("buildTag", buildTag).
     put("logDir", logDir.getAbsolutePath()).
     put("javaHome", configuration.getJavaHome()).
@@ -228,6 +229,7 @@ public class PTest {
   private static final String PATCH = "patch";
   private static final String JAVA_HOME = TestConfiguration.JAVA_HOME;
   private static final String JAVA_HOME_TEST = TestConfiguration.JAVA_HOME_TEST;
+  private static final String ANT_TEST_ARGS = TestConfiguration.ANT_TEST_ARGS;
   private static final String ANT_ENV_OPTS = TestConfiguration.ANT_ENV_OPTS;
   /**
    * All args override properties file settings except
@@ -246,7 +248,8 @@ public class PTest {
     options.addOption(null, PATCH, true, "URI to patch, either file:/// or http(s)://");
     options.addOption(ANT_ARG, null, true, "Supplemntal ant arguments");
     options.addOption(null, JAVA_HOME, true, "Java Home for compiling and running tests (unless " + JAVA_HOME_TEST + " is specified)");
-    options.addOption(null, JAVA_HOME_TEST, true, "Java Home for running tests (optional)");
+    options.addOption(null, JAVA_HOME_TEST, true, "Java Home for running tests (optional)");    
+    options.addOption(null, ANT_TEST_ARGS, true, "Arguments to ant test on slave nodes only");
     options.addOption(null, ANT_ENV_OPTS, true, "ANT_OPTS environemnt variable setting");
     CommandLine commandLine = parser.parse(options, args);
     if(!commandLine.hasOption(PROPERTIES)) {
@@ -289,6 +292,10 @@ public class PTest {
         if(!javaHomeForTests.isEmpty()) {
           conf.setJavaHomeForTests(javaHomeForTests);
         }
+        String antTestArgs = Strings.nullToEmpty(commandLine.getOptionValue(ANT_TEST_ARGS)).trim();
+        if(!antTestArgs.isEmpty()) {
+          conf.setAntTestArgs(antTestArgs);
+        }
         String antEnvOpts = Strings.nullToEmpty(commandLine.getOptionValue(ANT_ENV_OPTS)).trim();
         if(!antEnvOpts.isEmpty()) {
           conf.setAntEnvOpts(antEnvOpts);

Modified: hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java?rev=1529212&r1=1529211&r2=1529212&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java (original)
+++ hive/trunk/testutils/ptest2/src/main/java/org/apache/hive/ptest/execution/conf/TestConfiguration.java Fri Oct  4 16:51:44 2013
@@ -38,6 +38,7 @@ public class TestConfiguration {
   public static final String JAVA_HOME = "javaHome";
   public static final String JAVA_HOME_TEST = "javaHomeForTests";
   public static final String ANT_ENV_OPTS = "antEnvOpts";
+  public static final String ANT_TEST_ARGS = "antTestArgs";
   
   private static final String REPOSITORY_TYPE = "repositoryType";
   private static final String GIT = "git";
@@ -50,6 +51,7 @@ public class TestConfiguration {
 
   private final Context context;
   private String antArgs;
+  private String antTestArgs;
   private String antEnvOpts;
   private String repositoryType;
   private String repository;
@@ -80,6 +82,7 @@ public class TestConfiguration {
       throw new IllegalArgumentException("Unkown repository type '" + repositoryType + "'");
     }
     antArgs =  Preconditions.checkNotNull(context.getString(ANT_ARGS), ANT_ARGS).trim();
+    antTestArgs =  context.getString(ANT_TEST_ARGS, "").trim();
     antEnvOpts =  context.getString(ANT_ENV_OPTS, "").trim();
     javaHome =  context.getString(JAVA_HOME, "").trim();
     javaHomeForTests = context.getString(JAVA_HOME_TEST, "").trim();
@@ -133,6 +136,12 @@ public class TestConfiguration {
   public String getAntArgs() {
     return antArgs;
   }
+  public String getAntTestArgs() {
+    return antTestArgs;
+  }
+  public String getAntEnvOpts() {
+    return antEnvOpts;
+  }
   public String getJavaHome() {
     return javaHome;
   }
@@ -163,8 +172,8 @@ public class TestConfiguration {
   public void setAntArgs(String antArgs) {
     this.antArgs = Strings.nullToEmpty(antArgs);
   }
-  public String getAntEnvOpts() {
-    return antEnvOpts;
+  public void setAntTestArgs(String antTestArgs) {
+    this.antTestArgs = antTestArgs;
   }
   public void setAntEnvOpts(String antEnvOpts) {
     this.antEnvOpts = Strings.nullToEmpty(antEnvOpts);

Modified: hive/trunk/testutils/ptest2/src/main/resources/batch-exec.vm
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/main/resources/batch-exec.vm?rev=1529212&r1=1529211&r2=1529212&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/main/resources/batch-exec.vm (original)
+++ hive/trunk/testutils/ptest2/src/main/resources/batch-exec.vm Fri Oct  4 16:51:44 2013
@@ -41,7 +41,7 @@ cd $localDir/$instanceName/${repositoryN
    -Divy.default.always.check.exact.revision=false \
    -Divy.cache.ttl.default=eternal -Divy.checkmodified=false \
    -Dmvn.local.repo=$localDir/$instanceName/maven \
-   $antArgs $testArguments 1>$logDir/ant-test.txt 2>&1
+   $antArgs $antTestArgs $testArguments 1>$logDir/ant-test.txt 2>&1
 ret=$?
 if [[ $ret -ne 0 ]]
 then

Modified: hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java?rev=1529212&r1=1529211&r2=1529212&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java (original)
+++ hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.java Fri Oct  4 16:51:44 2013
@@ -73,6 +73,7 @@ public class TestScripts  {
     templateVariables.put("clearLibraryCache", "true");
     templateVariables.put("javaHome", "/usr/java/jdk1.7");
     templateVariables.put("antEnvOpts", "-Dhttp.proxyHost=somehost -Dhttp.proxyPort=3128");
+    templateVariables.put("antTestArgs", "-DgrammarBuild.notRequired=true -Dskip.javadoc=true");
     String template = readResource("batch-exec.vm");
     String actual = getTemplateResult(template, templateVariables);
     Approvals.verify(actual);
@@ -97,6 +98,7 @@ public class TestScripts  {
     templateVariables.put("javaHome", "/usr/java/jdk1.7");
     templateVariables.put("javaHomeForTests", "/usr/java/jdk1.7-other");
     templateVariables.put("antEnvOpts", "-Dhttp.proxyHost=somehost -Dhttp.proxyPort=3128");
+    templateVariables.put("antTestArgs", "");
     String template = readResource("batch-exec.vm");
     String actual = getTemplateResult(template, templateVariables);
     Approvals.verify(actual);

Modified: hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt?rev=1529212&r1=1529211&r2=1529212&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt (original)
+++ hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testAlternativeTestJVM.approved.txt Fri Oct  4 16:51:44 2013
@@ -40,7 +40,7 @@ cd /some/local/dir/instance-1/apache-sou
    -Divy.default.always.check.exact.revision=false \
    -Divy.cache.ttl.default=eternal -Divy.checkmodified=false \
    -Dmvn.local.repo=/some/local/dir/instance-1/maven \
-   -Dant=arg1 -Dtest=arg1 1>/some/log/dir/ant-test.txt 2>&1
+   -Dant=arg1  -Dtest=arg1 1>/some/log/dir/ant-test.txt 2>&1
 ret=$?
 if [[ $ret -ne 0 ]]
 then

Modified: hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt
URL: http://svn.apache.org/viewvc/hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt?rev=1529212&r1=1529211&r2=1529212&view=diff
==============================================================================
--- hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt (original)
+++ hive/trunk/testutils/ptest2/src/test/java/org/apache/hive/ptest/execution/TestScripts.testBatch.approved.txt Fri Oct  4 16:51:44 2013
@@ -40,7 +40,7 @@ cd /some/local/dir/instance-1/apache-sou
    -Divy.default.always.check.exact.revision=false \
    -Divy.cache.ttl.default=eternal -Divy.checkmodified=false \
    -Dmvn.local.repo=/some/local/dir/instance-1/maven \
-   -Dant=arg1 -Dtest=arg1 1>/some/log/dir/ant-test.txt 2>&1
+   -Dant=arg1 -DgrammarBuild.notRequired=true -Dskip.javadoc=true -Dtest=arg1 1>/some/log/dir/ant-test.txt 2>&1
 ret=$?
 if [[ $ret -ne 0 ]]
 then