-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: stdio.js SIGWINCH test coverage #10063
Conversation
@Fishrock123 peep it 👀 -- is this what you were going for? |
ci: https://ci.nodejs.org/job/node-test-pull-request/5056/ @sarahmeyer great work! you will need to update the title of the first commit to follow our commit guidelines |
SmartOS failure looks related. |
Hmmm, the following output occurs on SmartOS (Solaris):
I suspect that Python does not correctly emulate this on SmartOS but I'll try to take a deeper look soon. Skipping on SmartOS may be the appropriate solution by the looks, though. |
@sarahmeyer As we briefly discussed, it would be useful to check the properties modifiable by I think everything should be the same so it also should not call the We could also check for an Edit: Forgot to say most things like checking what platform we are running on have helpers in the common "module", such as |
Got the coverage to (mostly) work locally, after some tweaking... You can find it at nodejs/testing#46 if you are interested. (To run it, run (from the node repo) the Suffice to say, this hits the correct paths (aside from the fact that the pty emulation always has the same values). |
@sarahmeyer Think you'll be able to take a look this weekend? |
/cc @nodejs/platform-smartos |
Ping @sarahmeyer: Are you still working on this? (No rush. Just want to make sure it's not stalled and, if it is, see if there's anything we can do to get it un-stalled.) |
I took the liberty of adding a few lines of code to swallow CI: https://ci.nodejs.org/job/node-test-pull-request/5583/ (If CI passes and this gets approval, will squash my commit away on landing.) |
CI is green. Reviews/comments? @sarahmeyer @Fishrock123 @nodejs/testing @nodejs/platform-smartos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit
}; | ||
|
||
const refreshSizeWrapperStdout = () => { | ||
console.log('calling stdout._refreshSize'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment indicating that the console.log
is part of the test would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done. Will run Ci again because there was some refactoring that accompanied it.
Not to bikeshed this thing forever, but it seems like we could wrap the functions in |
Possible additional advantage to going that route: I think using the |
Going to land this working version. We can always switch to 'use strict';
const common = require('../common');
const originalRefreshSizeStderr = process.stderr._refreshSize;
const originalRefreshSizeStdout = process.stdout._refreshSize;
const wrap = (fn, ioStream, string) => {
return common.mustCall(() => {
try {
fn.call(ioStream);
} catch (e) {
// EINVAL happens on SmartOS if emulation is incomplete
if (!common.isSunOS || e.code !== 'EINVAL')
throw e;
}
});
};
process.stderr._refreshSize = wrap(originalRefreshSizeStderr, process.stderr);
process.stdout._refreshSize = wrap(originalRefreshSizeStdout, process.stdout);
process.emit('SIGWINCH'); In that case, |
PR-URL: nodejs#10063 Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in a9b59ff. Thanks for the contribution, @sarahmeyer! 🎉 |
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
heh, forgot to get back to this This doesn't really test all that it should IIRC. I can give pointers for improvement if anyone else wants or otherwise I'll just do it myself I guess. |
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #10063 Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
Provides coverage for calling
process._refreshSize
when aSIGWINCH
is emitted withinstderr
andstdout
functions instdio.js