ruby / zlib

Ruby interface for the zlib compression/decompression library
Other
49 stars 35 forks source link

Workaround: Fix test failures on Ubuntu jammy s390x. #63

Closed junaruga closed 11 months ago

junaruga commented 11 months ago

This PR fixes #60, the test failures on the zlib in Ubuntu jammy s390x.

This PR has 2 commits.

The 1st commit

According to the https://packages.ubuntu.com/jammy-updates/zlib1g - zlib_1.2.11.dfsg-2ubuntu9.2.debian.tar.xz, the zlib deb package is applying the patch 410.patch (madler/zlib#410), and configured by ./configure --dfltcc on Ubuntu jammy s390x. The --dfltcc is to enable the deflate algorithm in hardware.

It produces a different (but still valid) compressed byte stream, and causes the test failures in ruby/zlib. As a workaround, set the environment variable DFLTCC=0 disabling the implementation in zlib on s390x to the failing tests.

Note we need to test in a child Ruby process with assert_separately to test on the DFLTCC=0 set by the parent Ruby process.

I tested the ruby/zlib unit test on Ruby's s390x Ubuntu jammy server, and confirmed it passed.

The 2nd commit

I want to use Travis CI again for this repository to test the Ubuntu jammy s390x case on CI. Right now the only choice to test s390x on pull-request is Travis CI as far as I know.

junaruga commented 11 months ago

Note below is the Travis CI Ubuntu jammy s390x result before this PR on my forked repository. It failed as expected. https://app.travis-ci.com/github/junaruga/ruby-zlib/builds/266170549

And below is the Travis CI Ubuntu jammy s390x result after this PR. It passed as expected. https://app.travis-ci.com/github/junaruga/ruby-zlib/builds/266170621

junaruga commented 11 months ago

@hsbt or @nurse It seems Travis CI for ruby/zlib doesn't start unlike Travis CI for ruby/ruby. Could you enable it? Thanks.

junaruga commented 11 months ago

I rebased the PR using the Zlib::CHILD_ENV instead of child_env method. The Travis CI passed on my forked repository. https://app.travis-ci.com/github/junaruga/ruby-zlib/builds/266171389

junaruga commented 11 months ago

Thanks for your review. Let me merge this PR, though the Travis CI is not enabled for this repository yet.

ioquatix commented 11 months ago

Nice work figuring out the root cause.

junaruga commented 11 months ago

Nice work figuring out the root cause.

Thanks. I was definitely not able to fix the issue by the workaround without @iii-i's help and info at https://github.com/ruby/zlib/issues/60#issuecomment-1733149916.

junaruga commented 11 months ago

Note I opened another PR https://github.com/ruby/zlib/pull/65 that is rework for this PR.