xref: /third_party/node/test/node-api/test_fatal/test.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/node-api/test_fatal/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst child_process = require('child_process');
51cb0ef41Sopenharmony_ciconst test_fatal = require(`./build/${common.buildType}/test_fatal`);
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// Test in a child process because the test code will trigger a fatal error
81cb0ef41Sopenharmony_ci// that crashes the process.
91cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') {
101cb0ef41Sopenharmony_ci  test_fatal.Test();
111cb0ef41Sopenharmony_ci  return;
121cb0ef41Sopenharmony_ci}
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst p = child_process.spawnSync(
151cb0ef41Sopenharmony_ci  process.execPath, [ __filename, 'child' ]);
161cb0ef41Sopenharmony_ciassert.ifError(p.error);
171cb0ef41Sopenharmony_ciassert.ok(p.stderr.toString().includes(
181cb0ef41Sopenharmony_ci  'FATAL ERROR: test_fatal::Test fatal message'));
191cb0ef41Sopenharmony_ciassert.ok(p.status === 134 || p.signal === 'SIGABRT');
20

Indexes created Thu Nov 07 10:32:03 CST 2024