node/test/parallel/test-zlib-flush-drain-longblock.js
Adam Majer 26d7015192
test: s390x z15 accelerated zlib fixes
Modern s390x x15 has accelerated zlib operations on the CPU. Many
distros currently have patches to take advantage of this feature. One
side-effect of these patches is that compression routine is no longer
deterministic as with software. Interruption to input produces
different compressed results. Invalid input can result in processor
fault.

PR-URL: https://github.com/nodejs/node/pull/44117
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2022-08-06 21:29:00 +00:00

28 lines
733 B
JavaScript

'use strict';
// Regression test for https://github.com/nodejs/node/issues/14523.
// Checks that flushes interact properly with writableState.needDrain,
// even if no flush callback was passed.
const common = require('../common');
const assert = require('assert');
const zlib = require('zlib');
const zipper = zlib.createGzip({ highWaterMark: 16384 });
const unzipper = zlib.createGunzip();
zipper.pipe(unzipper);
zipper.write('A'.repeat(17000));
zipper.flush();
let received = 0;
unzipper.on('data', common.mustCallAtLeast((d) => {
received += d.length;
}, 2));
// Properly `.end()`ing the streams would interfere with checking that
// `.flush()` works.
process.on('exit', () => {
assert.strictEqual(received, 17000);
});