create and use new test-no-regression ant target in root build.xml

This commit is contained in:
Greg DiCristofaro 2020-11-02 13:51:40 -05:00
parent 40f35e713c
commit eee465f770
3 changed files with 63 additions and 45 deletions

View File

@ -44,4 +44,4 @@ build_script:
test_script: test_script:
- cd %APPVEYOR_BUILD_FOLDER% - cd %APPVEYOR_BUILD_FOLDER%
- cmd: ant -q test - cmd: ant -q test-no-regression

View File

@ -81,6 +81,38 @@
</delete> </delete>
</target> </target>
<!-- This target is similar to the regular test target that calls test on all nbm's,
but this target excludes the Testing nbm which runs the regression tests -->
<target name="test-no-regression" depends="build" description="Runs tests for all modules in the suite excluding the regression tests of the Testing NBM.">
<!--taken from https://stackoverflow.com/a/10859103; remove "Testing" from the modules and provide 'modulesNoTesting' as result. -->
<property name="modulesBeforeChange" value="${modules}"/>
<script language="javascript">
<![CDATA[
var before = project.getProperty("modulesBeforeChange");
var separator = ":";
var testingNbm = "Testing";
var beforeSplit = before.split(separator);
var items = [];
for (var i = 0; i < beforeSplit.length; i++) {
if (beforeSplit[i].toUpperCase() !== testingNbm.toUpperCase()) {
items.push(beforeSplit[i]);
}
}
var itemsJoined = items.join(separator);
project.setNewProperty("modulesNoTesting", itemsJoined);
]]>
</script>
<sortsuitemodules unsortedmodules="${modulesNoTesting}" sortedmodulesproperty="modules.test.sorted" sorttests="true"/>
<!-- continue on fail -->
<property name="continue.after.failing.tests" value="true"/>
<subant target="test" buildpath="${modules.test.sorted}" inheritrefs="false" inheritall="false">
<property name="cluster.path.evaluated" value="${cluster.path.evaluated}"/> <!-- Just for speed of pre-7.0 projects -->
<property name="harness.taskdefs.done" value="${harness.taskdefs.done}"/> <!-- optimization -->
<property name="continue.after.failing.tests" value="${continue.after.failing.tests}"/>
</subant>
</target>
<!-- This target will create a custom ZIP file for us. It first uses the general <!-- This target will create a custom ZIP file for us. It first uses the general
ZIP target and then opens it up and adds in any files that we want. This is where we customize the ZIP target and then opens it up and adds in any files that we want. This is where we customize the
version number. --> version number. -->

View File

@ -9,24 +9,10 @@ pushd bindings/java && ant -q dist && popd
echo "Building Autopsy..." && echo -en 'travis_fold:start:script.build\\r' echo "Building Autopsy..." && echo -en 'travis_fold:start:script.build\\r'
cd $TRAVIS_BUILD_DIR/ cd $TRAVIS_BUILD_DIR/
ant build ant build
build_rc=$?
echo -en 'travis_fold:end:script.build\\r' echo -en 'travis_fold:end:script.build\\r'
# don't continue to test if build failed.
if [[ $build_rc != 0 ]]; then
echo "Build failed. Not continuing to tests."
exit $build_rc
fi
echo "Testing Autopsy..." && echo -en 'travis_fold:start:script.tests\\r' echo "Testing Autopsy..." && echo -en 'travis_fold:start:script.tests\\r'
echo "Free Space:" echo "Free Space:"
echo `df -h .` echo `df -h .`
xvfb-run ant -q test xvfb-run ant -q test-no-regression
test_rc=$?
echo -en 'travis_fold:end:script.tests\\r' echo -en 'travis_fold:end:script.tests\\r'
exit $test_rc
if [[ $test_rc != 0 ]]; then
echo "There was a test failure."
exit $test_rc
fi