forked from I2P_Developers/i2p.i2p
cross platform unit test hostname faking not relying
on external tools The original method failed on Archlinux. This should work everywhere.
This commit is contained in:
@ -192,12 +192,14 @@
|
||||
<reporter type="stdout" />
|
||||
<reporter type="junitxml" directory="../../reports/core/scalatest/" />
|
||||
</scalatest>
|
||||
<!-- fetch the real hostname of this machine -->
|
||||
<exec executable="hostname" outputproperty="host.name"/>
|
||||
<!-- set if unset -->
|
||||
<property name="host.fakename" value="i2ptester" />
|
||||
<!-- replace hostname that junit inserts into reports with fake one -->
|
||||
<replace dir="../../reports/core/scalatest/" token="${host.name}" value="${host.fakename}"/>
|
||||
<replaceregexp byline="true"
|
||||
match="(hostname=)"[^"]+""
|
||||
replace="\1"${host.fakename}"">
|
||||
<fileset dir="../../reports/core/scalatest/" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
<target name="junit.test" depends="clean, junit.compileTest, prepareTest">
|
||||
<property name="hamcrest.home" value="${ant.home}/lib/" />
|
||||
@ -239,12 +241,14 @@
|
||||
</batchtest>
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
<!-- fetch the real hostname of this machine -->
|
||||
<exec executable="hostname" outputproperty="host.name"/>
|
||||
<!-- set if unset -->
|
||||
<property name="host.fakename" value="i2ptester" />
|
||||
<!-- replace hostname that junit inserts into reports with fake one -->
|
||||
<replace dir="../../reports/core/junit/" token="${host.name}" value="${host.fakename}"/>
|
||||
<replaceregexp byline="true"
|
||||
match="(hostname=)"[^"]+""
|
||||
replace="\1"${host.fakename}"">
|
||||
<fileset dir="../../reports/core/junit/" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
<target name="test" depends="junit.test, scalatest.test"/>
|
||||
<!-- test reports -->
|
||||
|
@ -204,12 +204,14 @@
|
||||
<reporter type="stdout" />
|
||||
<reporter type="junitxml" directory="../../reports/router/scalatest/" />
|
||||
</scalatest>
|
||||
<!-- fetch the real hostname of this machine -->
|
||||
<exec executable="hostname" outputproperty="host.name"/>
|
||||
<!-- set if unset -->
|
||||
<property name="host.fakename" value="i2ptester" />
|
||||
<!-- replace hostname that junit inserts into reports with fake one -->
|
||||
<replace dir="../../reports/router/scalatest/" token="${host.name}" value="${host.fakename}"/>
|
||||
<replaceregexp byline="true"
|
||||
match="(hostname=)"[^"]+""
|
||||
replace="\1"${host.fakename}"">
|
||||
<fileset dir="../../reports/router/scalatest/" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
<target name="junit.test" depends="clean, junit.compileTest, prepareTest">
|
||||
<mkdir dir="../../reports/router/junit/" />
|
||||
@ -240,12 +242,14 @@
|
||||
</batchtest>
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
<!-- fetch the real hostname of this machine -->
|
||||
<exec executable="hostname" outputproperty="host.name"/>
|
||||
<!-- set if unset -->
|
||||
<property name="host.fakename" value="i2ptester" />
|
||||
<!-- replace hostname that junit inserts into reports with fake one -->
|
||||
<replace dir="../../reports/router/junit/" token="${host.name}" value="${host.fakename}"/>
|
||||
<replaceregexp byline="true"
|
||||
match="(hostname=)"[^"]+""
|
||||
replace="\1"${host.fakename}"">
|
||||
<fileset dir="../../reports/router/junit/" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
<target name="test" depends="junit.test"/>
|
||||
<!-- test reports -->
|
||||
|
Reference in New Issue
Block a user