mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
fail test on diff; updated test targets
This commit is contained in:
parent
3d69ac5980
commit
f273a1ae4f
104
Core/build.xml
104
Core/build.xml
@ -173,15 +173,6 @@
|
||||
|
||||
<target name="init" depends="get-deps,harness.init"/>
|
||||
|
||||
<target name="test-init" depends="projectized-common.test-init">
|
||||
<!--create test property for integration config file location-->
|
||||
<property name="test.qa-functional.properties.integrationConfigFile" value="${integrationConfigFile}"/>
|
||||
<!--map that to the qa functional test properties-->
|
||||
<propertyset id="test.qa-functional.properties">
|
||||
<propertyref prefix="test.qa-functional.properties."/>
|
||||
<mapper type="glob" from="test.qa-functional.properties.*" to="*"/>
|
||||
</propertyset>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean" depends="projectized-common.clean">
|
||||
@ -207,90 +198,27 @@
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="test-init" depends="projectized-common.test-init">
|
||||
<!--create test property for integration config file location-->
|
||||
<property name="test.qa-functional.properties.integrationConfigFile" value="${integrationConfigFile}"/>
|
||||
<!--map that to the qa functional test properties-->
|
||||
<propertyset id="test.qa-functional.properties">
|
||||
<propertyref prefix="test.qa-functional.properties."/>
|
||||
<mapper type="glob" from="test.qa-functional.properties.*" to="*"/>
|
||||
</propertyset>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="test-qa-functional">
|
||||
<!--We don't want integration testing to run from standard qa functional-->
|
||||
<property name="test.config.qa-functional.excludes" value="**/org/sleuthkit/autopsy/integrationtesting/MainTestRunner.class"/>
|
||||
<property name="test.excludes" value="**/org/sleuthkit/autopsy/integrationtesting/MainTestRunner.class"/>
|
||||
<antcall target="projectized-common.test-qa-functional" />
|
||||
</target>
|
||||
|
||||
<target name="check-integration-test-args">
|
||||
<target name="integration-test">
|
||||
<fail message="Missing required argument: integrationConfigFile" unless="integrationConfigFile"/>
|
||||
</target>
|
||||
|
||||
<!-- use manifestclasspath (http://ant.apache.org/manual/Tasks/manifestclasspath.html) to put all the jar files that we need for junit/regression test
|
||||
to a single jar file: allJarsInUse.jar. Then we put this new jar to classpath for testing program to avoid command line Java classpath too long problem.
|
||||
Note: Started from ant 1.10, maxParentLevels are enforced. If you get error from manifestclasspath complaines 'No suitable relative path from ...' then it's time to
|
||||
increase your maxParentLevels -->
|
||||
<target name="regression-test-manifest-classpath">
|
||||
<manifestclasspath property="tem.classpath" jarfile="allJarsInUse.jar" maxParentLevels="5">
|
||||
<classpath refid="test.qa-functional.run.cp"/>
|
||||
</manifestclasspath>
|
||||
<jar destfile="allJarsInUse.jar" basedir="build/classes">
|
||||
<manifest>
|
||||
<attribute name="Class-Path" value="${tem.classpath}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
<path id="test.classpath">
|
||||
<pathelement path="allJarsInUse.jar"/>
|
||||
</path>
|
||||
</target>
|
||||
|
||||
<target
|
||||
name="integration-test"
|
||||
depends="check-integration-test-args,init,test-init,test-build,regression-test-manifest-classpath"
|
||||
if="exists.test.qa-functional.src.dir"
|
||||
>
|
||||
|
||||
<sequential>
|
||||
<property name="test.type" value="qa-functional"/>
|
||||
<property name="test.config" value="default"/>
|
||||
<property name="test.config.${test.config}.excludes" value=""/>
|
||||
<property name="test.config.default.includes" value="**/org/sleuthkit/autopsy/integrationtesting/MainTestRunner.class"/>
|
||||
<!--<property name="test.config.${test.config}.includes" value="NOTHING"/>-->
|
||||
|
||||
<metaproperty name="test.includes" value="test.config.${test.config}.includes"/>
|
||||
<metaproperty name="test.excludes" value="test.config.${test.config}.excludes"/>
|
||||
|
||||
<metaproperty name="resultsDir" value="build.test.${test.type}.results.dir"/>
|
||||
<metaproperty name="classesDir" value="build.test.${test.type}.classes.dir"/>
|
||||
|
||||
<mkdir dir="${resultsDir}"/>
|
||||
<junit
|
||||
fork="true"
|
||||
failureproperty="tests.failed"
|
||||
errorproperty="tests.failed"
|
||||
filtertrace="${test.filter.trace}"
|
||||
tempdir="${resultsDir}"
|
||||
>
|
||||
<batchtest todir="${resultsDir}">
|
||||
<fileset dir="${classesDir}" includes="${test.includes}" excludes="${test.excludes}"/>
|
||||
</batchtest>
|
||||
<classpath refid="test.classpath"/>
|
||||
<!--<classpath refid="test.@{test.type}.run.cp"/>-->
|
||||
<syspropertyset refid="test.${test.type}.properties"/>
|
||||
<jvmarg line="${test.bootclasspath.prepend.args}"/>
|
||||
<jvmarg line="${test.run.args}"/>
|
||||
<!-- should be in sync with project.properties and build.xml of autopsy main project -->
|
||||
<!-- disable for now, causes issues with Java 7 -->
|
||||
<!-- <jvmarg line="-J-Xms24m -J-Xmx512m -J-XX:MaxPermSize=128M -J-Xverify:none"/> -->
|
||||
<sysproperty key="integrationConfigFile" value="${integrationConfigFile}"/>
|
||||
|
||||
<!--needed to have tests NOT to steal focus when running, works in latest apple jdk update only.-->
|
||||
<sysproperty key="apple.awt.UIElement" value="false"/>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
<fail message="Some tests failed; see details above.">
|
||||
<condition>
|
||||
<and>
|
||||
<isset property="tests.failed"/>
|
||||
<isfalse value="${continue.after.failing.tests}"/>
|
||||
</and>
|
||||
</condition>
|
||||
</fail>
|
||||
|
||||
<!--delete the jar created in manifest-classpath-->
|
||||
<delete file="allJarsInUse.jar"/>
|
||||
</sequential>
|
||||
<!--We don't want integration testing to run from standard qa functional-->
|
||||
<property name="test.includes" value="**/org/sleuthkit/autopsy/integrationtesting/MainTestRunner.class"/>
|
||||
<antcall target="projectized-common.test-qa-functional" />
|
||||
</target>
|
||||
</project>
|
@ -33,6 +33,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@ -355,7 +356,8 @@ public class MainTestRunner extends TestCase {
|
||||
|
||||
/**
|
||||
* Writes any differences found between gold and output to a diff file. Only
|
||||
* works if a gold and diff location are specified in the EnvConfig.
|
||||
* works if a gold and diff location are specified in the EnvConfig. If
|
||||
* there is a diff, fail.
|
||||
*
|
||||
* @param envConfig The env config.
|
||||
*/
|
||||
@ -384,7 +386,10 @@ public class MainTestRunner extends TestCase {
|
||||
} catch (IOException ex) {
|
||||
logger.log(Level.SEVERE, "Unable to write diff file to " + diffPath);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.fail(String.format("There was a diff between the integration test gold data: %s "
|
||||
+ "and the current iteration output data: %s. Diff file created at %s.",
|
||||
goldPath, outputPath, diffPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user