11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciif (common.isPi) { 61cb0ef41Sopenharmony_ci common.skip('Too slow for Raspberry Pi devices'); 71cb0ef41Sopenharmony_ci} 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 101cb0ef41Sopenharmony_ciconst assert = require('assert'); 111cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process'); 121cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 131cb0ef41Sopenharmony_ciconst fs = require('fs'); 141cb0ef41Sopenharmony_ciconst env = { 151cb0ef41Sopenharmony_ci ...process.env, 161cb0ef41Sopenharmony_ci TEST_ALLOCATION: 50000, 171cb0ef41Sopenharmony_ci TEST_CHUNK: 1000, 181cb0ef41Sopenharmony_ci TEST_CLEAN_INTERVAL: 500, 191cb0ef41Sopenharmony_ci NODE_DEBUG_NATIVE: 'diagnostics', 201cb0ef41Sopenharmony_ci}; 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci{ 231cb0ef41Sopenharmony_ci console.log('\nTesting limit = 1'); 241cb0ef41Sopenharmony_ci tmpdir.refresh(); 251cb0ef41Sopenharmony_ci const child = spawnSync(process.execPath, [ 261cb0ef41Sopenharmony_ci '--trace-gc', 271cb0ef41Sopenharmony_ci '--heapsnapshot-near-heap-limit=1', 281cb0ef41Sopenharmony_ci '--max-old-space-size=50', 291cb0ef41Sopenharmony_ci fixtures.path('workload', 'bounded.js'), 301cb0ef41Sopenharmony_ci ], { 311cb0ef41Sopenharmony_ci cwd: tmpdir.path, 321cb0ef41Sopenharmony_ci env, 331cb0ef41Sopenharmony_ci }); 341cb0ef41Sopenharmony_ci console.log(child.stdout.toString()); 351cb0ef41Sopenharmony_ci console.log(child.stderr.toString()); 361cb0ef41Sopenharmony_ci assert.strictEqual(child.signal, null); 371cb0ef41Sopenharmony_ci assert.strictEqual(child.status, 0); 381cb0ef41Sopenharmony_ci const list = fs.readdirSync(tmpdir.path) 391cb0ef41Sopenharmony_ci .filter((file) => file.endsWith('.heapsnapshot')); 401cb0ef41Sopenharmony_ci assert.strictEqual(list.length, 0); 411cb0ef41Sopenharmony_ci} 42