Repository: ant-antlibs-compress Updated Branches: refs/heads/master 06bfe68f8 -> 5ba5470cf
try to fix test failures see https://issues.apache.org/jira/browse/COMPRESS-326 for background Project: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/commit/5ba5470c Tree: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/tree/5ba5470c Diff: http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/diff/5ba5470c Branch: refs/heads/master Commit: 5ba5470cf411af35fb187ffd8d1f558a34ceb735 Parents: 06bfe68 Author: Stefan Bodewig <[email protected]> Authored: Sun May 7 13:25:25 2017 +0200 Committer: Stefan Bodewig <[email protected]> Committed: Sun May 7 13:25:25 2017 +0200 ---------------------------------------------------------------------- src/tests/antunit/antunit-base.xml | 37 +++++++++++++++++++++++++++++++++ src/tests/antunit/ar-test.xml | 10 ++++----- 2 files changed, 42 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5ba5470c/src/tests/antunit/antunit-base.xml ---------------------------------------------------------------------- diff --git a/src/tests/antunit/antunit-base.xml b/src/tests/antunit/antunit-base.xml index d3cb236..cd1ae28 100644 --- a/src/tests/antunit/antunit-base.xml +++ b/src/tests/antunit/antunit-base.xml @@ -17,6 +17,7 @@ --> <project name="antunit-base" xmlns:cond="antlib:org.apache.tools.ant.types.conditions" + xmlns:cmp="antlib:org.apache.ant.compress" xmlns:au="antlib:org.apache.ant.antunit"> <property name="input" location="${java.io.tmpdir}/testinput"/> @@ -55,4 +56,40 @@ </au:assertFalse> </sequential> </macrodef> + + <target name="-detect-zip-usage-of-extra-field"> + <!-- startig with a patch release of Java8 + java.util.zip.ZipEntry#getTime has started to use extended + timestamp extra fields contained within ZIP archives, which + leads to the timestamps contained within our tests to depend + onthe local timezone and the version of Java. + This target tries to detect whether the newer version is used + (in which case the pattern including the timezone is + required). + The change in OpenJDK is + http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/90df6756406f + --> + <condition property="zip-uses-extra-field"> + <cond:islastmodified datetime="2001-11-19-15:34:20 +0100" + pattern="yyyy-MM-dd-HH:mm:ss Z"> + <cmp:zipentry name="asf-logo.gif"> + <file file="../resources/asf-logo.gif.zip"/> + </cmp:zipentry> + </cond:islastmodified> + </condition> + </target> + <target name="-zip-with-extra-field" + depends="-detect-zip-usage-of-extra-field" + if="zip-uses-extra-field"> + <property name="zip-ts-pattern" value="yyyy-MM-dd-HH:mm:ss Z"/> + <property name="zip-ts-value" value="2001-11-19-15:34:20 +0100"/> + </target> + <target name="-zip-without-extra-field" + depends="-detect-zip-usage-of-extra-field" + unless="zip-uses-extra-field"> + <property name="zip-ts-pattern" value="yyyy-MM-dd-HH:mm:ss"/> + <property name="zip-ts-value" value="2001-11-19-15:34:20"/> + </target> + <target name="-set-zip-ts-properties" + depends="-zip-with-extra-field, -zip-without-extra-field"/> </project> http://git-wip-us.apache.org/repos/asf/ant-antlibs-compress/blob/5ba5470c/src/tests/antunit/ar-test.xml ---------------------------------------------------------------------- diff --git a/src/tests/antunit/ar-test.xml b/src/tests/antunit/ar-test.xml index c2a291e..df5c126 100644 --- a/src/tests/antunit/ar-test.xml +++ b/src/tests/antunit/ar-test.xml @@ -22,7 +22,7 @@ <import file="antunit-base.xml" /> - <target name="setUp"> + <target name="setUp" depends="-set-zip-ts-properties"> <mkdir dir="${output}"/> <property name="dest" location="${output}/test.ar"/> <mkdir dir="${input}/s"/> @@ -84,8 +84,8 @@ <zipfileset src="../resources/asf-logo.gif.zip" includes="asf-logo.gif"/> </cmp:ar> - <checkProperties dateTime="2001-11-19-15:34:20" - pattern="yyyy-MM-dd-HH:mm:ss" + <checkProperties dateTime="${zip-ts-value}" + pattern="${zip-ts-pattern}" mode="644"/> </target> @@ -94,8 +94,8 @@ <cmp:zipfileset src="../resources/asf-logo.gif.zip" includes="asf-logo.gif"/> </cmp:ar> - <checkProperties dateTime="2001-11-19-15:34:20" - pattern="yyyy-MM-dd-HH:mm:ss" + <checkProperties dateTime="${zip-ts-value}" + pattern="${zip-ts-pattern}" mode="644"/> </target>
