diff --git a/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java b/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java index 588e4bf..ca959c0 100644 --- a/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java +++ b/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java @@ -452,15 +452,17 @@ public void execute() throws BuildException { if (hadoopVersion == null) { hadoopVersion = ""; } - if (hiveConfDir == null) { - hiveConfDir = ""; - } // For each of the qFiles generate the test + System.out.println("hiveRootDir = " + hiveRootDir); VelocityContext ctx = new VelocityContext(); ctx.put("className", className); ctx.put("hiveRootDir", escapePath(hiveRootDir.getCanonicalPath())); - ctx.put("queryDir", relativePath(hiveRootDir, queryDir)); + System.out.println("hiveRootDir = " + hiveRootDir); + System.out.println("queryDir = " + queryDir); + String strQueryDir = relativePath(hiveRootDir, queryDir); + System.out.println("queryDir = " + strQueryDir); + ctx.put("queryDir", strQueryDir); ctx.put("qfiles", qFiles); ctx.put("qfilesMap", qFilesMap); if (resultsDir != null) { @@ -468,7 +470,17 @@ public void execute() throws BuildException { } ctx.put("logDir", relativePath(hiveRootDir, logDir)); ctx.put("clusterMode", clusterMode); - ctx.put("hiveConfDir", escapePath(hiveConfDir)); + if (hiveConfDir == null || hiveConfDir.isEmpty()) { + ctx.put("hiveConfDir", ""); + } else { + System.out.println("hiveConfDir = " + hiveConfDir); + hiveConfDir = relativePath(hiveRootDir, new File(hiveConfDir)); + System.out.println("hiveConfDir = " + hiveConfDir); + if (!(new File(hiveRootDir, hiveConfDir)).isDirectory()) { + throw new BuildException("hiveConfDir is not dir " + new File(hiveRootDir, hiveConfDir)); + } + ctx.put("hiveConfDir", hiveConfDir); + } ctx.put("hadoopVersion", hadoopVersion); ctx.put("initScript", initScript); ctx.put("cleanupScript", cleanupScript); diff --git a/ql/src/test/templates/TestCliDriver.vm b/ql/src/test/templates/TestCliDriver.vm index 87eaf3d..8827f12 100644 --- a/ql/src/test/templates/TestCliDriver.vm +++ b/ql/src/test/templates/TestCliDriver.vm @@ -41,6 +41,9 @@ public class $className extends TestCase { String cleanupScript = "$cleanupScript"; try { String hadoopVer = "$hadoopVersion"; + if (!hiveConfDir.isEmpty()) { + hiveConfDir = HIVE_ROOT + hiveConfDir; + } qt = new QTestUtil((HIVE_ROOT + "$resultsDir"), (HIVE_ROOT + "$logDir"), miniMR, hiveConfDir, hadoopVer, initScript, cleanupScript); diff --git a/ql/src/test/templates/TestCompareCliDriver.vm b/ql/src/test/templates/TestCompareCliDriver.vm index fdc9565..6b367d6 100644 --- a/ql/src/test/templates/TestCompareCliDriver.vm +++ b/ql/src/test/templates/TestCompareCliDriver.vm @@ -42,6 +42,9 @@ public class $className extends TestCase { String cleanupScript = "$cleanupScript"; try { String hadoopVer = "$hadoopVersion"; + if (!hiveConfDir.isEmpty()) { + hiveConfDir = HIVE_ROOT + hiveConfDir; + } qt = new QTestUtil((HIVE_ROOT + "$resultsDir"), (HIVE_ROOT + "$logDir"), miniMR, hiveConfDir, hadoopVer, initScript, cleanupScript);