Index: ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java =================================================================== --- ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java (revision 911971) +++ ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java (working copy) @@ -231,6 +231,8 @@ qsb.append(dis.readLine() + "\n"); } qMap.put(qf.getName(), qsb.toString()); + + dis.close(); } public void cleanUp() throws Exception { @@ -432,6 +434,10 @@ ss.out = new PrintStream(fo, true, "UTF-8"); ss.err = ss.out; ss.setIsSilent(true); + SessionState oldSs = SessionState.get(); + if (oldSs != null) { + oldSs.out.close(); + } SessionState.start(ss); cliDriver = new CliDriver(); } Index: ql/src/test/templates/TestCliDriver.vm =================================================================== --- ql/src/test/templates/TestCliDriver.vm (revision 911971) +++ ql/src/test/templates/TestCliDriver.vm (working copy) @@ -38,9 +38,6 @@ qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()", miniMR); -#foreach ($qf in $qfiles) - qt.addFile("$qf.getCanonicalPath()"); -#end } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); @@ -81,6 +78,9 @@ public void testCliDriver_$tname() throws Exception { try { System.out.println("Begin query: " + "$fname"); + + qt.addFile("$qf.getCanonicalPath()"); + qt.cliInit("$fname"); int ecode = qt.executeClient("$fname"); if (ecode != 0) { Index: ql/src/test/templates/TestNegativeCliDriver.vm =================================================================== --- ql/src/test/templates/TestNegativeCliDriver.vm (revision 911971) +++ ql/src/test/templates/TestNegativeCliDriver.vm (working copy) @@ -27,9 +27,6 @@ try { qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()"); -#foreach ($qf in $qfiles) - qt.addFile("$qf.getCanonicalPath()"); -#end } catch (Throwable e) { e.printStackTrace(); @@ -56,6 +53,9 @@ public void testNegativeCliDriver_$tname() throws Exception { try { System.out.println("Begin query: " + "$fname"); + + qt.addFile("$qf.getCanonicalPath()"); + qt.cliInit("$fname"); int ecode = qt.executeClient("$fname"); if (ecode == 0) { Index: ql/src/test/templates/TestParse.vm =================================================================== --- ql/src/test/templates/TestParse.vm (revision 911971) +++ ql/src/test/templates/TestParse.vm (working copy) @@ -23,10 +23,6 @@ protected void setUp() { try { qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()"); - -#foreach ($qf in $qfiles) - qt.addFile("$qf.getCanonicalPath()"); -#end } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); @@ -54,6 +50,9 @@ public void testParse_$tname() throws Exception { try { System.out.println("Begin query: " + "$fname"); + + qt.addFile("$qf.getCanonicalPath()"); + qt.init("$fname"); ASTNode tree = qt.parseQuery("$fname"); int ecode = qt.checkParseResults("$fname", tree); Index: ql/src/test/templates/TestParseNegative.vm =================================================================== --- ql/src/test/templates/TestParseNegative.vm (revision 911971) +++ ql/src/test/templates/TestParseNegative.vm (working copy) @@ -23,10 +23,6 @@ protected void setUp() { try { qt = new QTestUtil("$resultsDir.getCanonicalPath()", "$logDir.getCanonicalPath()"); - -#foreach ($qf in $qfiles) - qt.addFile("$qf.getCanonicalPath()"); -#end } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); @@ -54,6 +50,9 @@ public void testParseNegative_$tname() throws Exception { try { System.out.println("Begin query: " + "$fname"); + + qt.addFile("$qf.getCanonicalPath()"); + qt.init("$fname"); ASTNode tree = qt.parseQuery("$fname"); List> tasks = qt.analyzeAST(tree);