Skip to content

Commit 30b6155

Browse files
sam-githubMylesBorins
authored andcommittedDec 25, 2018
test: merge test with unnecessary child process
Test didn't require child process creation. While this test has not been unstable, child process creation is slower and can be flaky in ci, so test directly for the segfault regression. PR-URL: #25025 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent ed3303b commit 30b6155

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed
 

‎test/parallel/test-crypto-hash.js

+11
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ assert.throws(function() {
111111
crypto.createHash('xyzzy');
112112
}, /Digest method not supported/);
113113

114+
// Issue https://github.com/nodejs/node/issues/9819: throwing encoding used to
115+
// segfault.
116+
common.expectsError(
117+
() => crypto.createHash('sha256').digest({
118+
toString: () => { throw new Error('boom'); },
119+
}),
120+
{
121+
type: Error,
122+
message: 'boom'
123+
});
124+
114125
// Default UTF-8 encoding
115126
const hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex');
116127
assert.strictEqual(

‎test/parallel/test-crypto-hmac.js

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ common.expectsError(
2121
message: 'The "hmac" argument must be of type string. Received type object'
2222
});
2323

24+
// This used to segfault. See: https://github.com/nodejs/node/issues/9819
25+
common.expectsError(
26+
() => crypto.createHmac('sha256', 'key').digest({
27+
toString: () => { throw new Error('boom'); },
28+
}),
29+
{
30+
type: Error,
31+
message: 'boom'
32+
});
33+
2434
common.expectsError(
2535
() => crypto.createHmac('sha1', null),
2636
{

‎test/parallel/test-crypto-tostring-segfault.js

-27
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.