diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2017-06-15 13:29:30 +0200 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2017-06-18 12:27:34 +0200 |
commit | 51898575ae2cc179699cc0c56cfc97ae22b235fc (patch) | |
tree | 9c0751e24131d1a4703ccf9a801237cdb280e50e /test/parallel/test-zlib-failed-init.js | |
parent | a8979a605434b0a07395c9764caafef362f3875e (diff) | |
download | android-node-v8-51898575ae2cc179699cc0c56cfc97ae22b235fc.tar.gz android-node-v8-51898575ae2cc179699cc0c56cfc97ae22b235fc.tar.bz2 android-node-v8-51898575ae2cc179699cc0c56cfc97ae22b235fc.zip |
test: check zlib version for createDeflateRaw
We are currenly builing Node with --shared-zlib which happens to be
version 1.2.8. The test for zlib.createDeflateRaw is expected to fail
but does not when using version 1.2.8.
As far as I can tell the fix referred to in the comments was
introduced in version 1.2.9:
- Reject a window size of 256 bytes if not using the zlib wrapper
This commit suggests adding a check for the version and skipping this
assert if the version is less than 1.2.9.
Refs: http://zlib.net/ChangeLog.txt
PR-URL: https://github.com/nodejs/node/pull/13697
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'test/parallel/test-zlib-failed-init.js')
-rw-r--r-- | test/parallel/test-zlib-failed-init.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/parallel/test-zlib-failed-init.js b/test/parallel/test-zlib-failed-init.js index 3b6da1d4fb..4f224ecd61 100644 --- a/test/parallel/test-zlib-failed-init.js +++ b/test/parallel/test-zlib-failed-init.js @@ -6,11 +6,15 @@ const assert = require('assert'); const zlib = require('zlib'); // For raw deflate encoding, requests for 256-byte windows are rejected as -// invalid by zlib. -// (http://zlib.net/manual.html#Advanced) -assert.throws(() => { - zlib.createDeflateRaw({ windowBits: 8 }); -}, /^Error: Init error$/); +// invalid by zlib (http://zlib.net/manual.html#Advanced). +// This check was introduced in version 1.2.9 and prior to that there was +// no such rejection which is the reason for the version check below +// (http://zlib.net/ChangeLog.txt). +if (!/^1\.2\.[0-8]$/.test(process.versions.zlib)) { + assert.throws(() => { + zlib.createDeflateRaw({ windowBits: 8 }); + }, /^Error: Init error$/); +} // Regression tests for bugs in the validation logic. |