diff --git a/cfg/dir.js b/cfg/dir.js index 9f4f7b0..35a5a11 100644 --- a/cfg/dir.js +++ b/cfg/dir.js @@ -3,10 +3,10 @@ // CHECK: The report is generated in the specified folder -const f = require('fs') -const p = require('path') +const f = require('fs'); +const p = require('path'); -const d = p.join(__dirname, 'temp') -f.mkdirSync(d) -process.report.directory = d -process.report.writeReport() +const d = p.join(__dirname, 'temp'); +f.mkdirSync(d); +process.report.directory = d; +process.report.writeReport(); diff --git a/cfg/exception.js b/cfg/exception.js index bab7a6a..c8fb009 100644 --- a/cfg/exception.js +++ b/cfg/exception.js @@ -2,9 +2,9 @@ // RUN: node --experimental-report exception.js // CHECK: The report is generated upon uncaught exception -process.report.reportOnUncaughtException = true +process.report.reportOnUncaughtException = true; -const h = require('http') +const h = require('http'); h.createServer((q, r) => { r.end('hello!') }).listen(12000, ()=> { @@ -13,4 +13,4 @@ h.createServer((q, r) => { console.log(d.toString()) }) }) -}) +}); diff --git a/cfg/fatalerror.js b/cfg/fatalerror.js index 012ca20..9a919bd 100644 --- a/cfg/fatalerror.js +++ b/cfg/fatalerror.js @@ -2,7 +2,7 @@ // RUN: node --experimental-report --max-old-space-size=20 fatalerror.js // CHECK: The report is generated upon fatal error (OOM) -process.report.reportOnFatalError = true +process.report.reportOnFatalError = true; // emulate an Javascript heap OOM diff --git a/cfg/filename.js b/cfg/filename.js index 47e53d2..9329e6c 100644 --- a/cfg/filename.js +++ b/cfg/filename.js @@ -2,5 +2,5 @@ // RUN: node --experimental-report filename.js // CHECK: The report is generated wth the specified filename -process.report.filename = 'myreport.json' -process.report.writeReport() +process.report.filename = 'myreport.json'; +process.report.writeReport(); diff --git a/cfg/signal.js b/cfg/signal.js index 7de78b4..85dce8d 100644 --- a/cfg/signal.js +++ b/cfg/signal.js @@ -3,10 +3,10 @@ // CHECK: The report is generated upon the signal reception // simulate --report-on-signal at runtime -process.report.reportOnSignal = true +process.report.reportOnSignal = true; // dummy sleep so that the program does not exit premature -setTimeout(()=>{}, 1000) +setTimeout(()=>{}, 1000); // inject a signal process.kill(process.pid, 'SIGUSR2'); diff --git a/cli/cpu_k.js b/cli/cpu_k.js index eb35492..8a3b362 100644 --- a/cli/cpu_k.js +++ b/cli/cpu_k.js @@ -12,9 +12,9 @@ // Read node.exe a thousand times in a tight loop -const f = require('fs') +const f = require('fs'); for (var i = 0; i < 1000; i++) - f.readFileSync(process.execPath) + f.readFileSync(process.execPath); // and take a report -process.report.writeReport() +process.report.writeReport(); diff --git a/cli/cpu_u.js b/cli/cpu_u.js index 80a5ff5..7367d1c 100644 --- a/cli/cpu_u.js +++ b/cli/cpu_u.js @@ -11,8 +11,8 @@ // 8. Its value is close to 0 (total time spent in seconds in kernel space) // Tight loop for 10 seconds -const start = Date.now() +const start = Date.now(); while (Date.now() - start < 10000); // and take a report -process.report.writeReport() +process.report.writeReport(); diff --git a/cli/env.js b/cli/env.js index b03c64a..8aabdb5 100644 --- a/cli/env.js +++ b/cli/env.js @@ -12,7 +12,7 @@ // 9. locate the env variable FOO, make sure its value is BAR // dummy sleep so that the program does not exit premature -setTimeout(()=>{}, 1000) +setTimeout(()=>{}, 1000); // Inject a signal. -process.kill(process.pid, 'SIGUSR2') +process.kill(process.pid, 'SIGUSR2'); diff --git a/cli/exception.js b/cli/exception.js index 411b3e3..cd437dd 100644 --- a/cli/exception.js +++ b/cli/exception.js @@ -8,7 +8,7 @@ // 5. A valid Javastack with message is present in the report // 6. A valid native stack is present in the report -const h = require('http') +const h = require('http'); h.createServer((q, r) => { r.end('hello!') }).listen(12000, ()=> { @@ -17,4 +17,4 @@ h.createServer((q, r) => { console.log(d.toString()) }) }) -}) +}); diff --git a/cli/fatalerror.js b/cli/fatalerror.js index 5ae262d..2d976ee 100644 --- a/cli/fatalerror.js +++ b/cli/fatalerror.js @@ -9,14 +9,14 @@ // 6. A valid native stack is present in the report // 7. Javascript heap memory section shows little or no available memory at least in the old_space -const l = [] +const l = []; while (true) { - const r = new Type() + const r = new Type(); l.push(r) } function Type() { - this.name = 'foo' - this.id = 128 - this.account = 9845432470 + this.name = 'foo'; + this.id = 128; + this.account = 9845432470; } diff --git a/cli/signal.js b/cli/signal.js index b5e1862..b517975 100644 --- a/cli/signal.js +++ b/cli/signal.js @@ -11,7 +11,7 @@ // 8. environment variable section is present // dummy sleep so that the program does not exit premature -setTimeout(()=>{}, 1000) +setTimeout(()=>{}, 1000); // Inject a signal. -process.kill(process.pid, 'SIGUSR2') +process.kill(process.pid, 'SIGUSR2'); diff --git a/cli/uv_tcp.js b/cli/uv_tcp.js index 2b47f6b..148c795 100644 --- a/cli/uv_tcp.js +++ b/cli/uv_tcp.js @@ -11,14 +11,14 @@ // the client's port as the remote port -const h = require('http') +const h = require('http'); const s = h.createServer((q, r) => { q.on('end', () => { - process.report.writeReport() + process.report.writeReport(); process.exit(0) - }) - q.resume() -}) + }); + q.resume(); +}); s.listen(12000, () => { - h.get({ port: 12000 }) -}) + h.get({ port: 12000 }); +}); diff --git a/cli/uv_timer.js b/cli/uv_timer.js index 738f3bb..7364a77 100644 --- a/cli/uv_timer.js +++ b/cli/uv_timer.js @@ -8,8 +8,8 @@ // for timer, one with timer expired and non-active, while the // the other still active with some firesInMsFromNow less than 10K. -setTimeout(() => {}, 10000) +setTimeout(() => {}, 10000); setTimeout(() => { - process.report.writeReport() - process.exit(0) -}, 1000) + process.report.writeReport(); + process.exit(0); +}, 1000); diff --git a/cli/uv_udp.js b/cli/uv_udp.js index 8836112..5ec5359 100644 --- a/cli/uv_udp.js +++ b/cli/uv_udp.js @@ -7,12 +7,12 @@ // 4. In libuv section of the report, make sure there are 2 sections // for udp, one for the local and one for the remote endpoints. -const d = require('dgram') -const us = d.createSocket('udp4') -const cus = d.createSocket('udp4') +const d = require('dgram'); +const us = d.createSocket('udp4'); +const cus = d.createSocket('udp4'); us.bind({}, () => { cus.connect(us.address().port, () => { - process.report.writeReport() - process.exit(0) - }) -}) + process.report.writeReport(); + process.exit(0); + }); +}); diff --git a/cli/uv_watch.js b/cli/uv_watch.js index 4264e51..478ced8 100644 --- a/cli/uv_watch.js +++ b/cli/uv_watch.js @@ -7,17 +7,17 @@ // 4. In libuv section of the report, make sure there are sections for // i) fs_poll ii) fs_event that map to the file being watched. -const f = require('fs') -let w +const f = require('fs'); +let w; try { - w = f.watch(__filename) + w = f.watch(__filename); } catch { } -f.watchFile(__filename, () => {}) +f.watchFile(__filename, () => {}); setInterval(() => { - process.report.writeReport() - if (w) w.close() - process.exit(0) -}, 1000) + process.report.writeReport(); + if (w) w.close(); + process.exit(0); +}, 1000); diff --git a/rtk/diff.js b/rtk/diff.js index 7232f69..a1d6065 100644 --- a/rtk/diff.js +++ b/rtk/diff.js @@ -10,21 +10,21 @@ // Child sequence if (process.argv[2] === 'child') { // just write a report and exit - process.report.writeReport() - process.exit(0) + process.report.writeReport(); + process.exit(0); } else { // Parent sequence - const spawn = require('child_process').spawn - const args = ['--experimental-report', __filename, 'child'] + const spawn = require('child_process').spawn; + const args = ['--experimental-report', __filename, 'child']; // set an env called FOO with value X - process.env.FOO = 'X' - const c1 = spawn(process.execPath, args) + process.env.FOO = 'X'; + const c1 = spawn(process.execPath, args); c1.on('exit', (code) => { // reset FOO with value Y - process.env.FOO = 'Y' - spawn(process.execPath, args) + process.env.FOO = 'Y'; + spawn(process.execPath, args); }) } diff --git a/rtk/inspect.js b/rtk/inspect.js index e8ead9b..5101710 100644 --- a/rtk/inspect.js +++ b/rtk/inspect.js @@ -12,19 +12,19 @@ // Define a custom type function Type() { - this.name = 'foo' - this.id = 128 + this.name = 'foo'; + this.id = 128; this.account = 9845432470 } // A global array, only to leak memory -const l = [] +const l = []; // Create half a million objects and fill those into the array for (var i = 0; i < 500000; i++) { - const r = new Type() + const r = new Type(); l.push(r) } // Generate a report -process.report.writeReport() +process.report.writeReport(); diff --git a/rtk/redact.js b/rtk/redact.js index f4e7ada..d79acb6 100644 --- a/rtk/redact.js +++ b/rtk/redact.js @@ -15,7 +15,7 @@ // 12. verify that the PASSWORD value is redated in foo.json // dummy sleep so that the program does not exit premature -setTimeout(()=>{}, 1000) +setTimeout(()=>{}, 1000); // Inject a signal. -process.kill(process.pid, 'SIGUSR2') +process.kill(process.pid, 'SIGUSR2');