From 0e69905e2ef6fe0b58dee90e7219496a827e84c5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 30 Jan 2016 22:58:19 -0800 Subject: [PATCH 1/2] test: pummel test fixes This fixes some variable redeclarations in pummel tests and, in the process, gets `test-stream-pipe-multi.js` to run again. It had been failing to run. --- test/pummel/test-crypto-dh.js | 4 ++-- test/pummel/test-exec.js | 5 +++-- test/pummel/test-stream-pipe-multi.js | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/pummel/test-crypto-dh.js b/test/pummel/test-crypto-dh.js index 1a2020cd5579b1..596d107a287a28 100644 --- a/test/pummel/test-crypto-dh.js +++ b/test/pummel/test-crypto-dh.js @@ -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]; @@ -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; diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js index 994d859f408d84..90abaf6caaa1db 100644 --- a/test/pummel/test-exec.js +++ b/test/pummel/test-exec.js @@ -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'; } diff --git a/test/pummel/test-stream-pipe-multi.js b/test/pummel/test-stream-pipe-multi.js index 44d6973938debe..bda1fb399404d1 100644 --- a/test/pummel/test-stream-pipe-multi.js +++ b/test/pummel/test-stream-pipe-multi.js @@ -49,10 +49,6 @@ process.on('exit', function() { assert.equal(cnt, rclosed, 'readable streams closed'); }); -for (var i = 0; i < chunkSize; i++) { - chunkSize[i] = i % 256; -} - for (var i = 0; i < cnt; i++) { var r = new FakeStream(); r.on('close', function() { From eb94d73792aa3925d7b00b812092395470b4ffbe Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 31 Jan 2016 10:12:12 -0800 Subject: [PATCH 2/2] fixup: restore buffer initialization --- test/pummel/test-stream-pipe-multi.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/pummel/test-stream-pipe-multi.js b/test/pummel/test-stream-pipe-multi.js index bda1fb399404d1..4524f8ca0b68c0 100644 --- a/test/pummel/test-stream-pipe-multi.js +++ b/test/pummel/test-stream-pipe-multi.js @@ -49,7 +49,11 @@ process.on('exit', function() { assert.equal(cnt, rclosed, 'readable streams closed'); }); -for (var i = 0; i < cnt; i++) { +for (let i = 0; i < chunkSize; i++) { + data[i] = i; +} + +for (let i = 0; i < cnt; i++) { var r = new FakeStream(); r.on('close', function() { console.error(this.ID, 'read close');