11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst child_process = require('child_process'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// Regression test for https://github.com/nodejs/node/issues/34797 71cb0ef41Sopenharmony_ciconst eightMB = 8 * 1024 * 1024; 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') { 101cb0ef41Sopenharmony_ci for (let i = 0; i < 4; i++) { 111cb0ef41Sopenharmony_ci process.send(new Uint8Array(eightMB).fill(i)); 121cb0ef41Sopenharmony_ci } 131cb0ef41Sopenharmony_ci} else { 141cb0ef41Sopenharmony_ci const child = child_process.spawn(process.execPath, [__filename, 'child'], { 151cb0ef41Sopenharmony_ci stdio: ['inherit', 'inherit', 'inherit', 'ipc'], 161cb0ef41Sopenharmony_ci serialization: 'advanced' 171cb0ef41Sopenharmony_ci }); 181cb0ef41Sopenharmony_ci const received = []; 191cb0ef41Sopenharmony_ci child.on('message', common.mustCall((chunk) => { 201cb0ef41Sopenharmony_ci assert.deepStrictEqual(chunk, new Uint8Array(eightMB).fill(chunk[0])); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci received.push(chunk[0]); 231cb0ef41Sopenharmony_ci if (received.length === 4) { 241cb0ef41Sopenharmony_ci assert.deepStrictEqual(received, [0, 1, 2, 3]); 251cb0ef41Sopenharmony_ci } 261cb0ef41Sopenharmony_ci }, 4)); 271cb0ef41Sopenharmony_ci} 28