GeezerVison is showing github.com — test: split heap snapshot limit tests · nodejs/node@13fe17c
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +36Lines changed: 36 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +require('../common'); |
| 4 | +const tmpdir = require('../common/tmpdir'); |
| 5 | +const assert = require('assert'); |
| 6 | +const { spawnSync } = require('child_process'); |
| 7 | +const fixtures = require('../common/fixtures'); |
| 8 | +const fs = require('fs'); |
| 9 | +const env = { |
| 10 | + ...process.env, |
| 11 | + NODE_DEBUG_NATIVE: 'diagnostics' |
| 12 | +}; |
| 13 | + |
| 14 | +{ |
| 15 | + tmpdir.refresh(); |
| 16 | + const child = spawnSync(process.execPath, [ |
| 17 | + fixtures.path('workload', 'grow-worker.js') |
| 18 | + ], { |
| 19 | + cwd: tmpdir.path, |
| 20 | + env: { |
| 21 | + TEST_SNAPSHOTS: 1, |
| 22 | + TEST_OLD_SPACE_SIZE: 50, |
| 23 | + ...env |
| 24 | + } |
| 25 | + }); |
| 26 | + console.log(child.stdout.toString()); |
| 27 | + const stderr = child.stderr.toString(); |
| 28 | + console.log(stderr); |
| 29 | + // There should be one snapshot taken and then after the |
| 30 | + // snapshot heap limit callback is popped, the OOM callback |
| 31 | + // becomes effective. |
| 32 | + assert(stderr.includes('ERR_WORKER_OUT_OF_MEMORY')); |
| 33 | + const list = fs.readdirSync(tmpdir.path) |
| 34 | + .filter((file) => file.endsWith('.heapsnapshot')); |
| 35 | + assert.strictEqual(list.length, 1); |
| 36 | +} |
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-heapsnapshot-near-heap-limit.js -26Lines changed: 0 additions & 26 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -86,29 +86,3 @@ const env = { |
86 | 86 | .filter((file) => file.endsWith('.heapsnapshot')); |
87 | 87 | assert(list.length > 0 && list.length <= 3); |
88 | 88 | } |
89 | | - |
90 | | - |
91 | | -{ |
92 | | - console.log('\nTesting worker'); |
93 | | - tmpdir.refresh(); |
94 | | - const child = spawnSync(process.execPath, [ |
95 | | - fixtures.path('workload', 'grow-worker.js') |
96 | | - ], { |
97 | | - cwd: tmpdir.path, |
98 | | - env: { |
99 | | - TEST_SNAPSHOTS: 1, |
100 | | - TEST_OLD_SPACE_SIZE: 50, |
101 | | - ...env |
102 | | - } |
103 | | - }); |
104 | | - console.log(child.stdout.toString()); |
105 | | - const stderr = child.stderr.toString(); |
106 | | - console.log(stderr); |
107 | | - // There should be one snapshot taken and then after the |
108 | | - // snapshot heap limit callback is popped, the OOM callback |
109 | | - // becomes effective. |
110 | | - assert(stderr.includes('ERR_WORKER_OUT_OF_MEMORY')); |
111 | | - const list = fs.readdirSync(tmpdir.path) |
112 | | - .filter((file) => file.endsWith('.heapsnapshot')); |
113 | | - assert.strictEqual(list.length, 1); |
114 | | -} |