Changeset 8d3fb0c


Ignore:
Timestamp:
Jul 25, 2015 12:08:17 PM (5 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
841e27f
Parents:
d662514
Message:

Add build harness for ministreaming tests

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/ministreaming/java/.classpath

    rd662514 r8d3fb0c  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
     4        <classpathentry kind="src" path="test/junit"/>
    45        <classpathentry kind="src" path="demo"/>
    56        <classpathentry combineaccessrules="false" kind="src" path="/i2p_sdk"/>
  • apps/ministreaming/java/build.xml

    rd662514 r8d3fb0c  
    139139            windowtitle="I2P ministreaming library" />
    140140    </target>
     141
     142    <target name="builddeptest">
     143        <ant dir="../../../core/java" target="jar" />
     144    </target>
     145    <target name="junit.compileTest" depends="builddeptest, compile">
     146
     147        <echo message="[DEBUG] ant home is ${ant.home}" />
     148        <echo message="[DEBUG] junit home before override is ${junit.home}" />
     149        <echo message="[DEBUG] hamcrest home before override is ${hamcrest.home}" />
     150
     151        <property name="junit.home" value="${ant.home}/lib" />
     152        <property name="hamcrest.home" value="${ant.home}/lib" />
     153
     154        <echo message="[DEBUG] junit home after override is ${junit.home}" />
     155        <echo message="[DEBUG] hamcrest home after override is ${hamcrest.home}" />
     156
     157        <javac
     158            srcdir="./test/junit"
     159            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}"
     160            includeAntRuntime="false"
     161            destdir="./build/obj" >
     162            <classpath>
     163                <pathelement location="../../../core/java/build/i2p.jar" />
     164                <pathelement location="${junit.home}/junit4.jar" />
     165                <pathelement location="${hamcrest.home}/hamcrest.jar" />
     166                <pathelement location="${hamcrest.home}/hamcrest-all.jar" />
     167            </classpath>
     168            <compilerarg line="${javac.compilerargs}" />
     169        </javac>
     170    </target>
     171
     172    <!-- preparation of code coverage tool of choice -->
     173    <target name="prepareClover" depends="compile" if="with.clover">
     174        <taskdef resource="clovertasks"/>
     175        <mkdir dir="../../../reports/ministreaming/clover" />
     176        <clover-setup initString="../../../reports/ministreaming/clover/coverage.db"/>
     177    </target>
     178    <target name="prepareCobertura" depends="compile" if="with.cobertura">
     179        <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" />
     180        <mkdir dir="./build/obj_cobertura" />
     181        <delete file="./cobertura.ser" />
     182        <cobertura-instrument todir="./build/obj_cobertura">
     183            <fileset dir="./build/obj">
     184                <include name="**/*.class"/>
     185                <!-- exclude Test classes -->
     186                <exclude name="**/*Test.class" />
     187                <!-- exclude anything not in net.i2p.* -->
     188                <exclude name="org/cybergarage/**/*.class" />
     189                <exclude name="org/freenetproject/**/*.class" />
     190                <exclude name="org/xlattice/**/*.class" />
     191            </fileset>
     192        </cobertura-instrument>
     193    </target>
     194
     195    <target name="prepareTest" depends="prepareClover, prepareCobertura" />
     196
     197    <target name="junit.test" depends="clean, junit.compileTest, prepareTest">
     198        <mkdir dir="../../../reports/ministreaming/junit/" />
     199        <delete>
     200            <fileset dir="../../../reports/ministreaming/junit">
     201                <include name="TEST-*.xml"/>
     202            </fileset>
     203        </delete>
     204
     205        <property name="junit.home" value="${ant.home}/lib" />
     206        <property name="hamcrest.home" value="${ant.home}/lib" />
     207
     208        <junit printsummary="withOutAndErr" fork="yes" showoutput="yes" >
     209            <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" />
     210            <classpath>
     211                <pathelement path="${javac.classpath}" />
     212                <pathelement location="${hamcrest.home}/hamcrest-core.jar" />
     213                <pathelement location="${hamcrest.home}/hamcrest-library.jar" />
     214                <pathelement location="${hamcrest.home}/hamcrest-integration.jar" />
     215                <pathelement location="${hamcrest.home}/hamcrest-all.jar" />
     216                <pathelement location="${junit.home}/junit4.jar" />
     217                <pathelement location="./build/obj_cobertura" />
     218                <pathelement location="./build/obj" />
     219                <pathelement location="../../../core/java/build/i2ptest.jar" />
     220                <pathelement location="../../../core/java/build/i2p.jar" />
     221                <pathelement location="../../build/jbigi.jar" />
     222                <pathelement location="${with.clover}" />
     223                <pathelement location="${with.cobertura}" />
     224            </classpath>
     225            <batchtest todir="../../../reports/ministreaming/junit/">
     226                <fileset dir="./test/junit">
     227                    <include name="**/*Test.java" />
     228                </fileset>
     229            </batchtest>
     230            <formatter type="xml"/>
     231        </junit>
     232        <!-- set if unset -->
     233        <property name="host.fakename" value="i2ptester" />
     234        <!-- replace hostname that junit inserts into reports with fake one -->
     235        <replaceregexp byline="true"
     236            match="(hostname=)&quot;[^&quot;]+&quot;"
     237            replace="\1&quot;${host.fakename}&quot;">
     238            <fileset dir="../../../reports/ministreaming/junit/" />
     239        </replaceregexp>
     240    </target>
     241    <target name="test" depends="junit.test"/>
     242    <!-- test reports -->
     243    <target name="junit.report">
     244        <junitreport todir="../../../reports/ministreaming/junit">
     245            <fileset dir="../../../reports/ministreaming/junit">
     246                <include name="TEST-*.xml"/>
     247            </fileset>
     248            <report format="frames" todir="../../../reports/ministreaming/html/junit"/>
     249        </junitreport>
     250    </target>
     251    <target name="clover.report" depends="test" if="with.clover">
     252        <clover-report>
     253            <current outfile="../../../reports/ministreaming/html/clover">
     254                <format type="html"/>
     255            </current>
     256        </clover-report>
     257    </target>
     258    <target name="cobertura.report" depends="test" if="with.cobertura">
     259        <mkdir dir="../../../reports/ministreaming/cobertura" />
     260        <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/ministreaming/cobertura" />
     261        <mkdir dir="../../../reports/ministreaming/html/cobertura" />
     262        <cobertura-report format="html" srcdir="./src" destdir="../../../reports/ministreaming/html/cobertura" />
     263        <delete file="./cobertura.ser" />
     264    </target>
     265    <target name="test.report" depends="junit.report, clover.report, cobertura.report"/>
     266    <!-- end test reports -->
     267    <target name="fulltest" depends="cleandep, test, test.report" />
     268    <!-- end unit tests -->
     269
    141270    <target name="clean">
    142271        <delete dir="./build" />
  • build.xml

    rd662514 r8d3fb0c  
    16081608        <ant dir="core/java/" target="junit.test" />
    16091609        <ant dir="router/java/" target="junit.test" />
     1610        <ant dir="apps/ministreaming/java/" target="junit.test" />
    16101611        <ant dir="apps/streaming/java/" target="junit.test" />
    16111612    </target>
     
    16191620        <ant dir="core/java/" target="test" />
    16201621        <ant dir="router/java/" target="test" />
     1622        <ant dir="apps/ministreaming/java/" target="test" />
    16211623        <ant dir="apps/streaming/java/" target="test" />
    16221624    </target>
     
    16281630        <ant dir="core/java/" target="junit.report" />
    16291631        <ant dir="router/java/" target="junit.report" />
     1632        <ant dir="apps/ministreaming/java/" target="junit.report" />
    16301633        <ant dir="apps/streaming/java/" target="junit.report" />
    16311634    </target>
     
    16331636        <ant dir="core/java/" target="clover.report" />
    16341637        <ant dir="router/java/" target="clover.report" />
     1638        <ant dir="apps/ministreaming/java" target="clover.report" />
    16351639        <ant dir="apps/streaming/java" target="clover.report" />
    16361640    </target>
     
    16381642        <ant dir="core/java/" target="cobertura.report" />
    16391643        <ant dir="router/java/" target="cobertura.report" />
     1644        <ant dir="apps/ministreaming/java" target="cobertura.report" />
    16401645        <ant dir="apps/streaming/java" target="cobertura.report" />
    16411646    </target>
     
    16441649        <ant dir="core/java/" target="fulltest" />
    16451650        <ant dir="router/java/" target="fulltest" />
     1651        <ant dir="apps/ministreaming/java" target="fulltest" />
    16461652        <ant dir="apps/streaming/java" target="fulltest" />
    16471653    </target>
     
    16591665        <replaceregexp byline="true" file="reports/router/cobertura/coverage.xml"
    16601666            match="&lt;source&gt;./src" replace="&lt;source&gt;router/java/src"/>
     1667
     1668        <replaceregexp byline="true" file="reports/ministreaming/cobertura/coverage.xml"
     1669            match='filename="net' replace='filename="apps/ministreaming/java/src/net'/>
     1670        <replaceregexp byline="true" file="reports/ministreaming/cobertura/coverage.xml"
     1671            match="&lt;source&gt;./src" replace="&lt;source&gt;apps/ministreaming/java/src"/>
    16611672
    16621673        <replaceregexp byline="true" file="reports/streaming/cobertura/coverage.xml"
Note: See TracChangeset for help on using the changeset viewer.