Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve zlib tests #14455

Closed
wants to merge 10 commits into from
Closed

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Jul 24, 2017

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-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jul 24, 2017
@mscdex mscdex added the zlib Issues and PRs related to the zlib subsystem. label Jul 24, 2017
zlib.gunzip(data, common.expectsError({
code: 'Z_DATA_ERROR',
type: Error,
message: 'unknown compression method'
}));
Copy link
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
Copy link
Member

@Trott Trott left a comment

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
Copy link
Member

Trott commented Jul 24, 2017

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-pipes
Mismatched 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-pipes
Mismatched 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                                
$


out.on('data', common.mustCall(function(c) {
console.error('hash=%s', c);
inp.on('data', common.mustCall(4));
Copy link
Member

@Trott Trott Jul 24, 2017

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
Member Author

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
Member Author

jasnell commented Jul 24, 2017

@Trott ... updated

@jasnell
Copy link
Member Author

jasnell commented Aug 2, 2017

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 review August 2, 2017 16:21

comments addressed, dismissing review

@Trott
Copy link
Member

Trott commented Aug 2, 2017

@nodejs/testing

@jasnell
Copy link
Member Author

jasnell commented Aug 3, 2017

Rebased!

@jasnell jasnell requested a review from addaleax August 3, 2017 18:56
Copy link
Member

@addaleax addaleax left a comment

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
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
Member Author

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
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
Copy link
Member Author

jasnell commented Aug 3, 2017

@jasnell
Copy link
Member Author

jasnell commented Aug 4, 2017

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
Member Author

jasnell commented Aug 4, 2017

Landed in 4e8bc71

@jasnell jasnell 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>
@MylesBorins MylesBorins 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>
@MylesBorins MylesBorins mentioned this pull request Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants