blob: e3aaf1adfcc893e92b49dacd0341a1123cfc1fb8 [file] [log] [blame]
<?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.
-->
<project>
<!-- By default all tests are run. To run one test define -Dtestcase=X on the command line -->
<macrodef name="_junit">
<attribute name="srcDir"/>
<sequential>
<!-- If anyone knows how to set umask inside ant please do so -->
<exec executable="${path.to.basedir}/build-support/scripts/umaskcheck.sh"
failonerror="true"/>
<delete dir="${test.logs}"/>
<delete dir="${test.warehouse.dir}"/>
<mkdir dir="${test.logs}"/>
<mkdir dir="${test.warehouse.dir}"/>
<junit showoutput="${test.output}"
printsummary="yes"
haltonfailure="no"
fork="yes"
maxmemory="512m"
dir="${test.dir}"
timeout="${test.timeout}"
errorProperty="tests.failed"
failureProperty="tests.failed">
<sysproperty key="hadoop.log.dir" value="${test.logs}"/>
<sysproperty key="hive.metastore.warehouse.dir" value="${test.warehouse.dir}"/>
<sysproperty key="java.security.krb5.realm" value=""/> <!-- HADOOP-7489 -->
<sysproperty key="java.security.krb5.kdc" value=""/> <!-- HADOOP-7489 -->
<classpath>
<path refid="test.class.path"/>
<pathelement location="${clover.jar}"/>
</classpath>
<formatter type="${test.junit.output.format}"/>
<batchtest fork="yes" todir="${test.logs}" unless="testcase">
<fileset dir="@{srcDir}" includes="**/Test*.java"/>
</batchtest>
<batchtest fork="yes" todir="${test.logs}" if="testcase">
<fileset dir="@{srcDir}" includes="**/${testcase}.java"/>
</batchtest>
<assertions>
<enable/>
</assertions>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</sequential>
</macrodef>
<target name="clover-init">
<echo message="${ant.project.name}"/>
<available property="clover.present" file="${clover.jar}"/>
<fail message="'clover.home' is not defined. Please pass -Dclover.home=/path/to/clover to ant on the command-line." unless="clover.present"/>
<taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
<mkdir dir="${clover.db.dir}"/>
<clover-setup initString="${clover.db.dir}/hcat_coverage.db">
<fileset dir="src" includes="${src.dir}" excludes="**/NoExitSecurityManager.java"/>
</clover-setup>
</target>
<target name="_test-with-clover" depends="clover-init, test"
description="run unit tests and generate code coverage reports">
<echo message="${ant.project.name}"/>
<mkdir dir="${clover.report.dir}"/>
<clover-report>
<current outfile="${clover.report.dir}" title="${final.name}">
<format type="html"/>
</current>
</clover-report>
<clover-report>
<current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
<format type="xml"/>
</current>
</clover-report>
<mkdir dir="${clover.pdf.report.dir}"/>
<clover-pdf-report outfile="${clover.pdf.report.dir}/clover_coverage.pdf" />
</target>
</project>