MCPcopy Index your code
hub / github.com/nodejs/node / skipIfSingleExecutableIsNotSupported

Function skipIfSingleExecutableIsNotSupported

test/common/sea.js:23–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21}
22
23function skipIfSingleExecutableIsNotSupported() {
24 if (!process.config.variables.single_executable_application)
25 common.skip('Single Executable Application support has been disabled.');
26
27 if (!['darwin', 'win32', 'linux'].includes(process.platform))
28 common.skip(`Unsupported platform ${process.platform}.`);
29
30 if (process.platform === 'linux' && process.config.variables.is_debug === 1)
31 common.skip('Running the resultant binary fails with `Couldn\'t read target executable"`.');
32
33 if (process.config.variables.node_shared)
34 common.skip('Running the resultant binary fails with ' +
35 '`/home/iojs/node-tmp/.tmp.2366/sea: error while loading shared libraries: ' +
36 'libnode.so.112: cannot open shared object file: No such file or directory`.');
37
38 if (process.config.variables.icu_gyp_path === 'tools/icu/icu-system.gyp')
39 common.skip('Running the resultant binary fails with ' +
40 '`/home/iojs/node-tmp/.tmp.2379/sea: error while loading shared libraries: ' +
41 'libicui18n.so.71: cannot open shared object file: No such file or directory`.');
42
43 if (!process.config.variables.node_use_openssl || process.config.variables.node_shared_openssl)
44 common.skip('Running the resultant binary fails with `Node.js is not compiled with OpenSSL crypto support`.');
45
46 if (process.config.variables.want_separate_host_toolset !== 0)
47 common.skip('Running the resultant binary fails with `Segmentation fault (core dumped)`.');
48
49 if (process.platform === 'linux') {
50 const osReleaseText = readFileSync('/etc/os-release', { encoding: 'utf-8' });
51 const isAlpine = /^NAME="Alpine Linux"/m.test(osReleaseText);
52 if (isAlpine) common.skip('Alpine Linux is not supported.');
53
54 if (process.arch === 's390x') {
55 common.skip('On s390x, postject fails with `memory access out of bounds`.');
56 }
57 }
58
59 if (process.config.variables.ubsan) {
60 common.skip('UndefinedBehavior Sanitizer is not supported');
61 }
62
63 try {
64 readFileSync(process.execPath);
65 } catch (e) {
66 if (e.code === 'ERR_FS_FILE_TOO_LARGE') {
67 common.skip('The Node.js binary is too large to be supported by postject');
68 }
69 }
70
71 tmpdir.refresh();
72
73 // The SEA tests involve making a copy of the executable and writing some fixtures
74 // to the tmpdir. To be safe, ensure that the disk space has at least a copy of the
75 // executable and some extra space for blobs and configs is available.
76 const stat = statSync(process.execPath);
77 const expectedSpace = stat.size + 10 * 1024 * 1024;
78 if (!tmpdir.hasEnoughSpace(expectedSpace)) {
79 common.skip(`Available disk space < ${Math.floor(expectedSpace / 1024 / 1024)} MB`);
80 }

Callers 3

test.jsFile · 0.85

Calls 6

includesMethod · 0.80
readFileSyncFunction · 0.50
statSyncFunction · 0.50
skipMethod · 0.45
testMethod · 0.45
refreshMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…