JDK <= 11 tests may fail when built with "--with-zlib=system"
Antonio Vieiro
avieirov at redhat.com
Thu May 16 11:33:00 UTC 2024
Hi all,
The files generated with "jar" and "pack200" may have different sizes
depending if OpenJDK was compiled with "--with-zlib=system" or
"--with-zlib=bundled", even though the files are correctly compressed.
As a consequence the tests "DeflateIn_InflateOut" and "PackTestZip64" in
"java.base", which use the generated file size at different stages, may
fail when "--with-zlib=system" is used.
This is indeed the case in Fedora 40, where tier1 tests fail [4], [5]
because of these tests.
### DeflateIn_InflateOut
The problem with the "DeflateIn_InflateOut" test could be solved by
backporting https://bugs.openjdk.org/browse/JDK-8240226 (which better
handles the sizes of the generated files) to OpenJDK 11 and earlier.
### PackTestZip64
The PackTestZip64 test [2] uses the generated "pack200" tool to repack,
pack and unpack a "golden.jar" file [3] (probably generated with
--with-zlib=bundled), and expects that the resulting size of the file is
equal to the original size of "golden.jar".
File sizes are indeed equal if "pack200" was compiled with
"--with-zlib=bundled" (so the repacking, packing and unpacking produces
the very same golden.jar file).
But when "pack200" is built with "--with-zlib=system" the repacking,
packing and unpacking of golden.jar is being performed with the system
library and may produce a golden.jar file that is equivalent to the
original golden.jar file, although the length of the file is different.
## Proposed solution
To ensure that OpenJDK 11 and earlier can be tested in a variety of
systems with "--with-zlib=system" we could backport JDK-8240226 and we
will need to create a bug for the PackTestZip64 test.
The PackTestZip64 could be either:
- Ignored
- Updated to verify the integrity of the resulting files, instead of
just checking the sizes of the files.
Would it be possible to open a bug for PackTestZip64 so we can fix &
backport it?
Thanks,
Antonio
[1]
https://fedoraproject.org/wiki/Changes/ZlibNGTransition
[2]
https://github.com/openjdk/jdk11u/blob/master/test/jdk/tools/pack200/PackTestZip64.java#L116
[3]
https://github.com/openjdk/jdk11u/blob/42f70422f10472aa67ca86bfbac25a5d5c314ec2/test/jdk/tools/pack200/pack200-verifier/data/golden.jar
[4]
/home/avieirov/REPOS/OPENJDK/jdk11u-dev/build/linux-x86_64-normal-server-release/images/jdk/bin/unpack200
tools.pack.gz tools_native.jar
Warning: The unpack200 tool is deprecated, and is planned for removal in
a future JDK release.
STDERR:
java.io.IOException: Files are differ starting at position: 43630
at PackTestZip64.compareTwoFiles(PackTestZip64.java:117)
at PackTestZip64.testPacking(PackTestZip64.java:89)
at PackTestZip64.main(PackTestZip64.java:48)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at
com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
at java.base/java.lang.Thread.run(Thread.java:829)
JavaTest Message: Test threw exception: java.io.IOException
JavaTest Message: shutting down test
TEST RESULT: Failed. Execution failed: `main' threw exception:
java.io.IOException: Files are differ starting at position: 43630
[5]
https://bugzilla.redhat.com/show_bug.cgi?id=2280757
More information about the jdk-updates-dev
mailing list