Skip to content

test: improve zlib tests - #14455

Closed
jasnell wants to merge 10 commits into
nodejs:masterfrom
jasnell:improve-zlib-tests
Closed

test: improve zlib tests#14455
jasnell wants to merge 10 commits into
nodejs:masterfrom
jasnell:improve-zlib-tests

Conversation

@jasnell

Copy link
Copy Markdown
Member

Multiple general improvements to zlib tests

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Jul 24, 2017
@jasnell
jasnellforce-pushed the improve-zlib-tests branch from 2b1fb45 to 6b6140eCompareJuly 24, 2017 18:58
@mscdexmscdex added the zlib Issues and PRs related to the zlib subsystem. label Jul 24, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loses the check that result is undefined. I'd prefer leaving the old code. I don't think common.expectsError() adds significant value, but the check for result is in fact significant.

Trott
Trott previously requested changes Jul 24, 2017

@TrottTrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to zlib-random-byte-pipes introduce flakiness under load that is not there currently.

@Trott

Trott commented Jul 24, 2017

Copy link
Copy Markdown
Member

With changes in this PR:

$ tools/test.py -j 96 --repeat 96 test/parallel/test-zlib-random-byte-pipes.js=== release test-zlib-random-byte-pipes === Path: parallel/test-zlib-random-byte-pipesMismatched noop function calls. Expected exactly 4, actual 5. at Object.exports.mustCall (/Users/trott/io.js/test/common/index.js:475:10) at Object.<anonymous> (/Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js:153:23) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12) at Function.Module._load (module.js:462:3) at Function.Module.runMain (module.js:609:10) at startup (bootstrap_node.js:158:16)Command: out/Release/node /Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js=== release test-zlib-random-byte-pipes === Path: parallel/test-zlib-random-byte-pipesMismatched noop function calls. Expected exactly 4, actual 5. at Object.exports.mustCall (/Users/trott/io.js/test/common/index.js:475:10) at Object.<anonymous> (/Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js:153:23) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12) at Function.Module._load (module.js:462:3) at Function.Module.runMain (module.js:609:10) at startup (bootstrap_node.js:158:16)Command: out/Release/node /Users/trott/io.js/test/parallel/test-zlib-random-byte-pipes.js[...snip...]

On current master:

$ tools/test.py -j 96 --repeat 96 test/parallel/test-zlib-random-byte-pipes.js [00:11|% 100|+ 96|- 0]: Done 
$

@TrottTrottJul 24, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empirical testing shows that there is no guarantee that this will be called 4 times. Under load at least, it may be called 5 times.

Assuming that discrepancy is valid behavior, seeing that this is all from inp.pipe(gzip).pipe(gunz).pipe(out) and we have a check later for the data event on out, I think this can just be removed. Probably the same for the gunz and gzip checks below.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was a bit afraid of that. Looking at it, the on('data') events here look entirely unnecessary.

@jasnell

Copy link
Copy Markdown
MemberAuthor

@Trott ... updated

@jasnell

Copy link
Copy Markdown
MemberAuthor

ping @Trott ... I know this needs a rebase, but when you get a moment to take another look I'd appreciate it :-)

@Trott
Trott dismissed their stale reviewAugust 2, 2017 16:21

comments addressed, dismissing review

@Trott

Trott commented Aug 2, 2017

Copy link
Copy Markdown
Member

@nodejs/testing

@jasnell
jasnellforce-pushed the improve-zlib-tests branch from daff20c to a905f3bCompareAugust 3, 2017 18:56
@jasnell

Copy link
Copy Markdown
MemberAuthor

Rebased!

@jasnell
jasnell requested a review from addaleaxAugust 3, 2017 18:56

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, two small comments but nothing I’d consider blocking

write(c) {
// Simulate the way that an fs.ReadStream returns false
// on *every* write like a jerk, only to resume a
// moment later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but we shouldn’t keep this in the source code.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh... indeed. completely missed that!

// on *every* write like a jerk, only to resume a
// moment later.
this._hasher.update(c);
process.nextTick(this.resume.bind(this));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to replace these with arrow functions if you like :)

@jasnell

jasnell commented Aug 3, 2017

Copy link
Copy Markdown
MemberAuthor

@jasnell

Copy link
Copy Markdown
MemberAuthor

Only failure is unrelated.

jasnell added a commit that referenced this pull request Aug 4, 2017
PR-URL: #14455
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in 4e8bc71

@jasnelljasnell closed this Aug 4, 2017
MylesBorins pushed a commit that referenced this pull request Sep 9, 2017
PR-URL: #14455
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorinsMylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 20, 2017
PR-URL: #14455
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@MylesBorinsMylesBorins mentioned this pull request Sep 20, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.zlibIssues and PRs related to the zlib subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@jasnell@Trott@addaleax@mscdex@MylesBorins@nodejs-github-bot