Permalink
Fetching contributors…
Cannot retrieve contributors at this time
252 lines (221 sloc) 9.52 KB
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="benchmark">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="javac.target" value="1.7"/>
<property name="javac.source" value="1.7"/>
<!-- *************************************** CONFIGURATION *************************************** -->
<property name="src.dir" location="src" />
<property name="tests.dir" location="tests" />
<property name="lib.dir" location="lib" />
<property name="build.dir" location="build" />
<property name="build.tests.dir" location="${build.dir}/tests" />
<property name='build.testoutput.dir' location='${build.dir}/testoutput' />
<path id='project.classpath'>
<pathelement location='${build.dir}' />
<pathelement location='${build.tests.dir}' />
<fileset dir='${lib.dir}'>
<include name='*.jar' />
<include name='hibernate/*.jar' />
<exclude name='ant.jar' />
</fileset>
<pathelement path="${java.class.path}"/>
</path>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${lib.dir}/ant-contrib.jar"/>
</classpath>
</taskdef>
<!-- EXEC ASSERTS -->
<condition property="assertions" value="false">
<not><isset property="assertions"/></not>
</condition>
<if>
<equals arg1="${assertions}" arg2="true" />
<then>
<assertions id="assertions"><enable /></assertions>
</then>
<else>
<assertions id="assertions"><disable /></assertions>
</else>
</if>
<!-- *************************************** BUILDING *************************************** -->
<target name="build"
description="Build the entire framework">
<fileset dir="${src.dir}" excludes="**/*.launch, **/*.java"/>
<!-- <echo message="${ant.project.name}: ${ant.file}"/> -->
<mkdir dir="${build.dir}/META-INF"/>
<copy file="${src.dir}/META-INF/persistence.xml" todir="${build.dir}/META-INF"/>
<javac debug="true" debuglevel="${debuglevel}" includeantruntime="false"
destdir="${build.dir}"
source="${javac.source}"
target="${javac.target}">
<src path="${src.dir}"/>
<classpath refid="project.classpath" />
</javac>
<!-- Copy Files -->
<copy todir="${build.dir}">
<fileset dir="${src.dir}">
<include name="**/*-ddl.sql"/>
<include name="**/*-dialects.xml"/>
<include name="**/*.xsd"/>
<include name="**/histogram.*.gz"/>
<include name="**/table.*.gz"/>
</fileset>
</copy>
<mkdir dir="${build.tests.dir}"/>
<javac debug="true" debuglevel="${debuglevel}" includeantruntime="false"
destdir="${build.tests.dir}"
source="${javac.source}"
target="${javac.target}">
<src path="${tests.dir}"/>
<classpath refid="project.classpath" />
</javac>
</target>
<target name="clean" description="Destroys all generated files and dirs.">
<delete dir="${build.dir}"/>
</target>
<!-- *************************************** EXECUTING *************************************** -->
<target name="execute" description="Execute a benchmark">
<condition property="benchmark" value="">
<not><isset property="benchmark"/></not>
</condition>
<condition property="config" value="">
<not><isset property="config"/></not>
</condition>
<condition property="create" value="false">
<not><isset property="create"/></not>
</condition>
<condition property="clear" value="false">
<not><isset property="clear"/></not>
</condition>
<condition property="load" value="false">
<not><isset property="load"/></not>
</condition>
<condition property="extra" value="">
<not><isset property="extra"/></not>
</condition>
<java fork="yes" failonerror="true" classname="com.oltpbenchmark.DBWorkload">
<jvmarg value="-Xmx2048m" />
<jvmarg value="-Dlog4j.configuration=${basedir}/log4j.properties"/>
<jvmarg value="-client" />
<arg line="-b ${benchmark}" />
<arg line="-c ${config}" />
<arg line="--create ${create}" />
<arg line="--clear ${clear}" />
<arg line="--load ${load}" />
<arg line="--execute ${execute}" />
<arg line="${extra}" />
<classpath refid='project.classpath' />
<assertions refid="assertions"/>
</java>
</target>
<!-- *************************************** TESTING *************************************** -->
<!-- common junit parameters go here -->
<macrodef name='run_junit'>
<attribute name='timeout' default='240000' />
<attribute name='printsummary' default='off' />
<attribute name='showoutput' default='false' />
<element name='tests'/>
<element name='formatters'/>
<sequential>
<mkdir dir='${build.testoutput.dir}' />
<junit
fork="yes"
haltonfailure="${junit.haltonfailure}"
failureproperty="junit.failures"
printsummary="@{printsummary}"
timeout="@{timeout}"
maxmemory='1024M'
showoutput="@{showoutput}"
>
<classpath refid='project.classpath' />
<jvmarg value="-server" />
<jvmarg value="-Xmx2048m"/>
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError"/>
<formatters/>
<batchtest todir="${build.testoutput.dir}">
<tests/>
</batchtest>
<assertions><enable/></assertions>
</junit>
</sequential>
</macrodef>
<target name="junit"
description="Run all test cases for framework."
depends="build" >
<!-- Run the unit tests -->
<condition property="timeoutLength" value="${timeoutLength}" else='600000'>
<isset property="timeoutLength"/>
</condition>
<!-- Copy Test Files -->
<copy todir="${build.dir}">
<fileset dir="${tests.dir}">
<include name="**/*-ddl.sql"/>
<include name="**/*-dialects.xml"/>
<include name="**/*.xsd"/>
</fileset>
</copy>
<run_junit timeout="${timeoutLength}" printsummary="yes">
<formatters>
<formatter type="plain" unless="hudson"/>
<formatter type="xml" />
</formatters>
<tests>
<fileset dir='${build.tests.dir}'>
<include name="**/Test*.class"/>
<exclude name="**/Test*$*.class"/>
<!--
These are the test cases that are currently broken, so
we're just going to disable them for now
-->
<exclude name="**/TestJPAB*.class"/>
<exclude name="**/TestAuctionMarkLoader.class"/>
<!-- <exclude name="**/TestTPCCLoader.class"/> -->
</fileset>
</tests>
</run_junit>
<fail
if="junit.failures"
unless="emma.enabled"
message="JUnit had failures"
/>
</target>
<target name='junitclass'
description="Run one test case">
<condition property="timeoutLength" value="${timeoutLength}" else='600000'>
<isset property="timeoutLength"/>
</condition>
<run_junit timeout="${timeoutLength}" printsummary="yes" showoutput="yes">
<formatters>
<formatter usefile="false" type="plain"/>
</formatters>
<tests>
<fileset dir='${build.tests.dir}'>
<include name="**/${junitclass}.class"/>
</fileset>
</tests>
</run_junit>
<fail if="junit.failures" message="JUnit had failures" />
</target>
<!-- *************************************** UTILITY *************************************** -->
<target name="dialects-export"
description="Export all of the SQL for a given benchmark to a dialects file">
<condition property="benchmark" value="">
<not><isset property="benchmark"/></not>
</condition>
<condition property="config" value="">
<not><isset property="config"/></not>
</condition>
<java fork="yes" failonerror="true" classname="com.oltpbenchmark.DBWorkload">
<jvmarg value="-Xmx1024m" />
<jvmarg value="-Dlog4j.configuration=${basedir}/log4j.properties"/>
<jvmarg value="-client" />
<arg line="-b ${benchmark}" />
<arg line="-c ${config}" />
<arg line="--dialects-export true" />
<classpath refid='project.classpath' />
<assertions><enable/></assertions>
</java>
</target>
</project>