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: pummel test fixes #4998

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/pummel/test-crypto-dh.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var hashes = {
modp18 : 'a870b491bbbec9b131ae9878d07449d32e54f160'
};

for (var name in hashes) {
for (const name in hashes) {
var group = crypto.getDiffieHellman(name);
var private_key = group.getPrime('hex');
var hash1 = hashes[name];
Expand All @@ -40,7 +40,7 @@ for (var name in hashes) {
assert.equal(group.getGenerator('hex'), '02');
}

for (var name in hashes) {
for (const name in hashes) {
// modp1 is 768 bits, FIPS requires >= 1024
if (name == 'modp1' && common.hasFipsCrypto)
continue;
Expand Down
5 changes: 3 additions & 2 deletions test/pummel/test-exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ var common = require('../common');
var assert = require('assert');
var exec = require('child_process').exec;

var SLEEP3_COMMAND;
if (!common.isWindows) {
// Unix.
var SLEEP3_COMMAND = 'sleep 3';
SLEEP3_COMMAND = 'sleep 3';
} else {
// Windows: `choice` is a command built into cmd.exe. Use another cmd process
// to create a process tree, so we can catch bugs related to it.
var SLEEP3_COMMAND = 'cmd /c choice /t 3 /c X /d X';
SLEEP3_COMMAND = 'cmd /c choice /t 3 /c X /d X';
}


Expand Down
6 changes: 3 additions & 3 deletions test/pummel/test-stream-pipe-multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ process.on('exit', function() {
assert.equal(cnt, rclosed, 'readable streams closed');
});

for (var i = 0; i < chunkSize; i++) {
chunkSize[i] = i % 256;
for (let i = 0; i < chunkSize; i++) {
data[i] = i;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this is safe to remove? Obviously the chunkSize[i] part is wrong, but perhaps this should be kept and just replace chunkSize[i] with data[i] assuming that was the original intention?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's safe to remove because I don't think the contents of the buffer affects anything in the test. But regardless, I can see how failing to initialize the buffer contents doesn't pass the smell test even if those contents are unused. So I'll put some initialization back.

It's odd because the modulus operator is superfluous because the buffer has a length of 250 so % 256 doesn't do anything.

And all this stuff was in the very first commit for the test. So it seems likely that this test has never run successfully.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, initialization restored.

for (var i = 0; i < cnt; i++) {
for (let i = 0; i < cnt; i++) {
var r = new FakeStream();
r.on('close', function() {
console.error(this.ID, 'read close');
Expand Down