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: fix test-sync-io-option #1840

Merged
merged 1 commit into from
Jun 3, 2015
Merged

Conversation

evanlucas
Copy link
Contributor

This test was failing occasionally both locally and on CI. Switched
from using spawn to execFile for a more reliable test.

Related: #1837

@Fishrock123
Copy link
Contributor

cc @trevnorris

@Fishrock123 Fishrock123 added the test Issues and PRs related to the tests. label May 29, 2015
if (flags.length > 0)
setImmediate(runTest, flags);
});
}(['--trace-sync-io', ' ']));
}(['--trace-sync-io', '--trace-deprecation']));
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we still test without flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test was throwing an error in the first place. I can add a test without flags though

@evanlucas
Copy link
Contributor Author

Ok, the test now runs with the flag and without.

@trevnorris
Copy link
Contributor

Fine by me.

if (flags.length > 0)
setImmediate(runTest, flags);
});
}(['--trace-sync-io', ' ']));
}(['--trace-sync-io', '']));
Copy link
Member

Choose a reason for hiding this comment

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

Why is this flags game and IIFE required?

Copy link
Contributor

Choose a reason for hiding this comment

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

When I wrote it I wanted each run to have it's own running context. So I kept most variables local to the IIFE so there wouldn't be any accidental interference. Just a technique to help write more reliable tests.

if (/^WARNING[\s\S]*fs\.readFileSync/.test(stderr))
cntr++;
if (args[0] === '--trace-sync-io') {
assert.equal(cntr, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change from 4 to 1 warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It changed because we only get stderr in the callback one time for each call. Previously it was in a data event which was emit more than once.

@silverwind
Copy link
Contributor

LGTM, should CI this.

@evanlucas
Copy link
Contributor Author

@silverwind
Copy link
Contributor

@trevnorris care to sign this off too?

@evanlucas
Copy link
Contributor Author

There is one failure, but seems unrelated

@trevnorris
Copy link
Contributor

LGTM

This test was failing occasionally both locally and on CI. Switched
from using spawn to execFile for a more reliable test.

Fixes: nodejs#1837
PR-URL: nodejs#1840
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
@evanlucas evanlucas closed this Jun 3, 2015
@evanlucas evanlucas deleted the fix-sync-io-test branch June 3, 2015 18:24
@evanlucas evanlucas merged commit 43a82f8 into nodejs:master Jun 3, 2015
@evanlucas
Copy link
Contributor Author

Landed in 43a82f8. Thanks!

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants