nginx/njs

Test failure with zlib-ng

Closed this issue · 6 comments

Since Fedora 40, zlib-ng is used instead of zlib

Compressed output may differs, so test suite is failing

...
xml tests: PASSED [46/46]
njs("const zlib = require('zlib');['WAKA', 'αβγ'].map(v => zlib.deflateRawSync(v, {dictionary: Buffer.from('WAKA')}).toString('base64'))")
expected: "CwdiAA==,O7fx3KZzmwE="
     got: "C3f0dgQA,O7fx3KZzmwE="
zlib tests: FAILED [10/11]
module tests: PASSED [6/6]
...

I don't see any simple way to ignore 1 test :s

@remicollet did you set compat mode before doing your build? In zlib-ng, you have to set compat mode to 1 in the configure script. Zlib-NG's native API is different from Zlib's native API. Nginx does support the use of Zlib NG but not through their native API. If you set the compat mode to use the Zlib native API instead of Zlib NG's, it should work. That's all that I had to do to fix the compile process.

e.g.
sed -i "s/compat=0/compat=1/" /path/to/zlib-ng/configure

It is not about build (which is OK), but about test suite, as compressed result is different.

More information on https://fedoraproject.org/wiki/Changes/ZlibNGTransition
And "zlib-compat" mode is enabled.

Hi @remicollet,

Thanks for the report. I will rewrite the tests so they will work with any zlib library.

Hi @remicollet,

Please let me know whether the patch works for you.

I confirm the patch fixes the test suite

Pass with both zlib (1.2.13) and zlib-ng (2.1.6)

Thanks