PIG-5105: Tez unit tests failing with Argument list too long (rohini)

git-svn-id: https://svn.apache.org/repos/asf/pig/trunk@1778681 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 98b5379..2231723 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -32,6 +32,8 @@
  
 IMPROVEMENTS
 
+PIG-5105: Tez unit tests failing with "Argument list too long" (rohini)
+
 PIG-4901: To use Multistorage for each Group (szita via daijy)
 
 PIG-5025: Fix flaky test failures in TestLoad.java (szita via rohini)
diff --git a/build.xml b/build.xml
index 1786b26..695a327 100644
--- a/build.xml
+++ b/build.xml
@@ -881,6 +881,9 @@
             <sysproperty key="test.exec.type" value="${test.exec.type}" />
             <sysproperty key="ssh.gateway" value="${ssh.gateway}" />
             <sysproperty key="hod.server" value="${hod.server}" />
+            <sysproperty key="build.classes" value="${build.classes}" />
+            <sysproperty key="test.build.classes" value="${test.build.classes}" />
+            <sysproperty key="ivy.lib.dir" value="${ivy.lib.dir}" />
             <sysproperty key="java.io.tmpdir" value="${junit.tmp.dir}" />
             <sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
             <jvmarg line="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=128M ${debugArgs} -Djava.library.path=${hadoop.root}\bin"/>
diff --git a/test/org/apache/pig/test/TezMiniCluster.java b/test/org/apache/pig/test/TezMiniCluster.java
index 792a1bd..0bf7c5a 100644
--- a/test/org/apache/pig/test/TezMiniCluster.java
+++ b/test/org/apache/pig/test/TezMiniCluster.java
@@ -96,8 +96,13 @@
             m_mr.init(m_dfs_conf);
             m_mr.start();
             m_mr_conf = m_mr.getConfig();
-            m_mr_conf.set(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
-                    System.getProperty("java.class.path"));
+            File libDir = new File(System.getProperty("ivy.lib.dir", "build/ivy/lib/Pig"));
+            File classesDir = new File(System.getProperty("build.classes", "build/classes"));
+            File testClassesDir = new File(System.getProperty("test.build.classes", "test/build/classes"));
+            String classpath = libDir.getAbsolutePath() + "/*"
+                    + File.pathSeparator + classesDir.getAbsolutePath()
+                    + File.pathSeparator + testClassesDir.getAbsolutePath();
+            m_mr_conf.set(YarnConfiguration.YARN_APPLICATION_CLASSPATH, classpath);
             m_mr_conf.set(MRJobConfig.MAP_JAVA_OPTS, "-Xmx512m");
             m_mr_conf.set(MRJobConfig.REDUCE_JAVA_OPTS, "-Xmx512m");