nginx / njs

A subset of JavaScript language to use in nginx
http://nginx.org/en/docs/njs/
BSD 2-Clause "Simplified" License
1.25k stars 155 forks source link

Test failure with zlib-ng #704

Closed remicollet closed 7 months ago

remicollet commented 7 months ago

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]
...
remicollet commented 7 months ago

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

lancedockins commented 7 months ago

@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

remicollet commented 7 months ago

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.

xeioex commented 7 months ago

Hi @remicollet,

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

xeioex commented 7 months ago

Hi @remicollet,

Please let me know whether the patch works for you.

remicollet commented 7 months ago

I confirm the patch fixes the test suite

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

Thanks