| <?xml version="1.0"?> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <!-- |
| Before you can run these subtargets directly, you need |
| to call at top-level: ant deploy-contrib compile-core-test |
| --> |
| <project name="sqoop" default="jar"> |
| |
| <import file="../build-contrib.xml"/> |
| <property environment="env"/> |
| <property name="sqoop.thirdparty.lib.dir" value="" /> |
| <property name="mrunit.class.dir" value="${build.dir}/../mrunit/classes" /> |
| |
| <!-- ================================================================== --> |
| <!-- Compile test code --> |
| <!-- Override with our own version so we can enforce build dependencies --> |
| <!-- on compile-mapred-test for MiniMRCluster, and MRUnit. --> |
| <!-- ================================================================== --> |
| <target name="compile-test" depends="compile-examples" if="test.available"> |
| <echo message="Compiling ${name} dependencies" /> |
| <!-- need top-level compile-mapred-test for MiniMRCluster --> |
| <subant target="compile-mapred-test"> |
| <fileset dir="../../.." includes="build.xml" /> |
| </subant> |
| |
| <!-- Need MRUnit compiled for some tests --> |
| <subant target="compile"> |
| <fileset dir="../mrunit" includes="build.xml" /> |
| </subant> |
| |
| <echo message="contrib: ${name}"/> |
| <javac |
| encoding="${build.encoding}" |
| srcdir="${src.test}" |
| includes="**/*.java" |
| destdir="${build.test}" |
| debug="${javac.debug}"> |
| <classpath> |
| <path refid="test.classpath"/> |
| <pathelement path="${mrunit.class.dir}" /> |
| </classpath> |
| </javac> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Run unit tests --> |
| <!-- Override with our own version so we can set hadoop.alt.classpath --> |
| <!-- and Hadoop logger properties --> |
| <!-- ================================================================== --> |
| <target name="test" depends="compile-test, compile" if="test.available"> |
| <echo message="contrib: ${name}"/> |
| <delete dir="${hadoop.log.dir}"/> |
| <mkdir dir="${hadoop.log.dir}"/> |
| <delete dir="${build.test}/data"/> |
| <mkdir dir="${build.test}/data" /> |
| <junit |
| printsummary="yes" showoutput="${test.output}" |
| haltonfailure="no" fork="yes" maxmemory="256m" |
| errorProperty="tests.failed" failureProperty="tests.failed" |
| timeout="${test.timeout}" |
| dir="${build.test}/data"> |
| |
| <!-- uncomment this if you want to attach a debugger --> |
| <!-- |
| <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=2601" /> |
| --> |
| |
| <sysproperty key="test.build.data" value="${build.test}/data"/> |
| <sysproperty key="build.test" value="${build.test}"/> |
| <sysproperty key="contrib.name" value="${name}"/> |
| |
| |
| <!-- define this property to force Sqoop to throw better exceptions on errors |
| during testing, instead of printing a short message and exiting with status 1. --> |
| <sysproperty key="sqoop.throwOnError" value="" /> |
| |
| <!-- |
| Added property needed to use the .class files for compilation |
| instead of depending on hadoop-*-core.jar |
| --> |
| <sysproperty key="hadoop.alt.classpath" |
| value="${hadoop.root}/build/classes" /> |
| |
| <!-- we want more log4j output when running unit tests --> |
| <sysproperty key="hadoop.root.logger" |
| value="DEBUG,console" /> |
| |
| <!-- requires fork=yes for: |
| relative File paths to use the specified user.dir |
| classpath to use build/contrib/*.jar |
| --> |
| <sysproperty key="user.dir" value="${build.test}/data"/> |
| |
| <!-- Setting the user.dir property is actually meaningless as it |
| is read-only in the Linux Sun JDK. Provide an alternate sysprop |
| to specify where generated code should go. |
| --> |
| <sysproperty key="sqoop.src.dir" value="${build.test}/data"/> |
| |
| <!-- Override standalone Hadoop's working dirs to allow parallel |
| execution of multiple Hudson builders |
| --> |
| <sysproperty key="hadoop.tmp.dir" value="${build.test}/hadoop"/> |
| |
| <sysproperty key="fs.default.name" value="${fs.default.name}"/> |
| <sysproperty key="hadoop.test.localoutputfile" value="${hadoop.test.localoutputfile}"/> |
| <sysproperty key="hadoop.log.dir" value="${hadoop.log.dir}"/> |
| |
| <!-- we have a mock "hive" shell instance in our testdata directory |
| for testing hive integration. Set this property here to ensure |
| that the unit tests pick it up. |
| --> |
| <sysproperty key="hive.home" value="${basedir}/testdata/hive" /> |
| |
| <classpath> |
| <path refid="test.classpath"/> |
| <path refid="contrib-classpath"/> |
| <!-- tools.jar from Sun JDK also required to invoke javac. --> |
| <pathelement path="${env.JAVA_HOME}/lib/tools.jar" /> |
| <!-- need thirdparty JDBC drivers for thirdparty tests --> |
| <fileset dir="${sqoop.thirdparty.lib.dir}" |
| includes="*.jar" /> |
| <!-- need MRUnit for some tests --> |
| <pathelement path="${mrunit.class.dir}" /> |
| </classpath> |
| <formatter type="${test.junit.output.format}" /> |
| <batchtest todir="${build.test}" unless="testcase"> |
| <fileset dir="${src.test}" |
| includes="**/Test*.java" excludes="**/${test.exclude}.java" /> |
| </batchtest> |
| <batchtest todir="${build.test}" if="testcase"> |
| <fileset dir="${src.test}" includes="**/${testcase}.java"/> |
| </batchtest> |
| </junit> |
| <antcall target="checkfailure"/> |
| </target> |
| |
| <target name="doc"> |
| <exec executable="make" failonerror="true"> |
| <arg value="-C" /> |
| <arg value="${basedir}/doc" /> |
| <arg value="BUILDROOT=${build.dir}" /> |
| </exec> |
| </target> |
| |
| </project> |