Skip to content

Commit

Permalink
test: improve SEA tests
Browse files Browse the repository at this point in the history
- Use spawnSyncAndExitWithoutError to log more information on error.
- Use NODE_DEBUG_NATIVE to log internals
  • Loading branch information
joyeecheung committed Nov 16, 2023
1 parent 02db7fc commit 0d2a341
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 35 deletions.
7 changes: 7 additions & 0 deletions test/common/sea.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const common = require('../common');
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');

const { readFileSync } = require('fs');
const {
Expand Down Expand Up @@ -43,6 +44,12 @@ function skipIfSingleExecutableIsNotSupported() {
common.skip('On s390x, postject fails with `memory access out of bounds`.');
}
}

tmpdir.refresh();

if (!tmpdir.hasEnoughSpace(120 * 1024 * 1024)) {
common.skip('Available disk space < 120MB');
}
}

function injectAndCodeSign(targetExecutable, resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ skipIfSingleExecutableIsNotSupported();
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');
const { copyFileSync, writeFileSync, existsSync } = require('fs');
const { execFileSync } = require('child_process');
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
const { join } = require('path');
const { strictEqual } = require('assert');
const assert = require('assert');

const inputFile = fixtures.path('sea.js');
Expand All @@ -44,17 +43,27 @@ writeFileSync(configFile, `

// Copy input to working directory
copyFileSync(inputFile, tmpdir.resolve('sea.js'));
execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], {
cwd: tmpdir.path
});
spawnSyncAndExitWithoutError(
process.execPath,
['--experimental-sea-config', 'sea-config.json'],
{ cwd: tmpdir.path },
{});

assert(existsSync(seaPrepBlob));

copyFileSync(process.execPath, outputFile);
injectAndCodeSign(outputFile, seaPrepBlob);

const singleExecutableApplicationOutput = execFileSync(
spawnSyncAndExitWithoutError(
outputFile,
[ '-a', '--b=c', 'd' ],
{ env: { COMMON_DIRECTORY: join(__dirname, '..', 'common') } });
strictEqual(singleExecutableApplicationOutput.toString(), 'Hello, world! 😊\n');
{
env: {
COMMON_DIRECTORY: join(__dirname, '..', 'common'),
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
}
},
{
stdout: 'Hello, world! 😊\n'
});
19 changes: 14 additions & 5 deletions test/sequential/test-single-executable-application-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ skipIfSingleExecutableIsNotSupported();

const tmpdir = require('../common/tmpdir');
const { copyFileSync, writeFileSync, existsSync } = require('fs');
const { execFileSync } = require('child_process');
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
const assert = require('assert');

const configFile = tmpdir.resolve('sea-config.json');
Expand All @@ -31,13 +31,22 @@ writeFileSync(configFile, `
}
`);

execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], {
cwd: tmpdir.path
});
spawnSyncAndExitWithoutError(
process.execPath,
['--experimental-sea-config', 'sea-config.json'],
{ cwd: tmpdir.path });

assert(existsSync(seaPrepBlob));

copyFileSync(process.execPath, outputFile);
injectAndCodeSign(outputFile, seaPrepBlob);

execFileSync(outputFile);
spawnSyncAndExitWithoutError(
outputFile,
{
env: {
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
}
},
{});
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' :
process.execPath,
['--experimental-sea-config', 'sea-config.json'],
{
cwd: tmpdir.path
cwd: tmpdir.path,
env: {
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
},
},
{
stderr: /"useCodeCache" is redundant when "useSnapshot" is true/
Expand All @@ -61,8 +65,15 @@ const outputFile = join(tmpdir.path, process.platform === 'win32' ? 'sea.exe' :
copyFileSync(process.execPath, outputFile);
injectAndCodeSign(outputFile, seaPrepBlob);

spawnSyncAndExitWithoutError(outputFile, {
stdout: 'Hello from snapshot',
trim: true,
});
spawnSyncAndExitWithoutError(

Check failure on line 68 in test/sequential/test-single-executable-application-snapshot-and-code-cache.js

View workflow job for this annotation

GitHub Actions / test-asan

--- stderr --- [process 207831]: --- stderr --- Found SEA blob 0x1a630060, size=3388364 Found SEA resource 0x1a630060, size=3388364 Read<uint32_t>()(4-byte), count=1: { 21223968 }, read 4 bytes Read SEA magic 143da20 Read<uint32_t>()(4-byte), count=1: { 6 }, read 4 bytes Read SEA flags 6 Read<uint64_t>()(8-byte), count=1: { 11 }, read 8 bytes ReadStringView(), length=11: 0x1a630070, read 11 bytes snapshot.jsRead SEA code path 0x1a630070, size=11 Read<uint64_t>()(8-byte), count=1: { 3388329 }, read 8 bytes ReadStringView(), length=3388329: 0x1a630083, read 3388329 bytes Read SEA resource snapshot 0x1a630083, size=3388329 Read<uint64_t>()(8-byte), count=1: { 0 }, read 8 bytes ReadStringView(), length=0: 0x1a96b434, read 0 bytes Read SEA resource code cache 0x1a96b434, size=0 deserializing IsolateDataSerializeInfo... { // -- primitive begins -- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, }, // -- primitive ends -- // -- template_values begins -- { { "async_wrap_ctor_template", 0, 435 }, { "binding_data_default_template", 2, 436 }, { "contextify_global_template", 6, 437 }, { "contextify_wrapper_template", 7, 438 }, { "env_proxy_template", 9, 439 }, { "env_proxy_ctor_template", 10, 440 }, { "dir_instance_template", 11, 441 }, { "fd_constructor_template", 12, 442 }, { "fdclose_constructor_template", 13, 443 }, { "filehandlereadwrap_template", 15, 444 }, { "fsreqpromise_constructor_template", 16, 445 }, { "handle_wrap_ctor_template", 17, 446 }, { "histogram_ctor_template", 18, 447 }, { "i18n_converter_template", 22, 448 }, { "js_transferable_constructor_template", 24, 449 }, { "libuv_stream_wrap_ctor_template", 25, 450 }, { "message_port_constructor_template", 26, 451 }, { "pipe_constructor_template", 28, 452 }, { "script_context_constructor_template", 31, 453 }, { "shutdown_wrap_template", 33, 454 }, { "tcp_constructor_template", 40, 455 }, { "write_wrap_template", 42, 456 }, { "worker_heap_snapshot_taker_template", 43, 457 }, { "async_wrap_binding_template", 45, 458 }, { "blob_binding_templat

Check failure on line 68 in test/sequential/test-single-executable-application-snapshot-and-code-cache.js

View workflow job for this annotation

GitHub Actions / test-linux

--- stderr --- [process 207858]: --- stderr --- Found SEA blob 0x561543ce0080, size=3390588 Found SEA resource 0x561543ce0080, size=3390588 Read<uint32_t>()(4-byte), count=1: { 21223968 }, read 4 bytes Read SEA magic 143da20 Read<uint32_t>()(4-byte), count=1: { 6 }, read 4 bytes Read SEA flags 6 Read<uint64_t>()(8-byte), count=1: { 11 }, read 8 bytes ReadStringView(), length=11: 0x561543ce0090, read 11 bytes snapshot.jsRead SEA code path 0x561543ce0090, size=11 Read<uint64_t>()(8-byte), count=1: { 3390553 }, read 8 bytes ReadStringView(), length=3390553: 0x561543ce00a3, read 3390553 bytes Read SEA resource snapshot 0x561543ce00a3, size=3390553 Read<uint64_t>()(8-byte), count=1: { 1408749273088 }, read 8 bytes ReadStringView(), length=1408749273088: 0x56154401bd04, read 1408749273088 bytes Read SEA resource code cache 0x56154401bd04, size=1408749273088 deserializing IsolateDataSerializeInfo... { // -- primitive begins -- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, }, // -- primitive ends -- // -- template_values begins -- { { "async_wrap_ctor_template", 0, 435 }, { "binding_data_default_template", 2, 436 }, { "contextify_global_template", 6, 437 }, { "contextify_wrapper_template", 7, 438 }, { "env_proxy_template", 9, 439 }, { "env_proxy_ctor_template", 10, 440 }, { "dir_instance_template", 11, 441 }, { "fd_constructor_template", 12, 442 }, { "fdclose_constructor_template", 13, 443 }, { "filehandlereadwrap_template", 15, 444 }, { "fsreqpromise_constructor_template", 16, 445 }, { "handle_wrap_ctor_template", 17, 446 }, { "histogram_ctor_template", 18, 447 }, { "i18n_converter_template", 22, 448 }, { "js_transferable_constructor_template", 24, 449 }, { "libuv_stream_wrap_ctor_template", 25, 450 }, { "message_port_constructor_template", 26, 451 }, { "pipe_constructor_template", 28, 452 }, { "script_context_constructor_template", 31, 453 }, { "shutdown_wrap_template", 33, 454 }, { "tcp_constructor_template", 40, 455 }, { "write_wrap_template", 42, 456 }, { "worker_heap_snapshot_taker_template", 43

Check failure on line 68 in test/sequential/test-single-executable-application-snapshot-and-code-cache.js

View workflow job for this annotation

GitHub Actions / test-macOS

--- stderr --- [process 23583]: --- stderr --- Found SEA blob 0x104f67000, size=3389485 Found SEA resource 0x104f67000, size=3389485 Read<uint32_t>()(4-byte), count=1: { 21223968 }, read 4 bytes Read SEA magic 143da20 Read<uint32_t>()(4-byte), count=1: { 6 }, read 4 bytes Read SEA flags 6 Read<uint64_t>()(8-byte), count=1: { 11 }, read 8 bytes ReadStringView(), length=11: 0x104f67010, read 11 bytes snapshot.jsRead SEA code path 0x104f67010, size=11 Read<uint64_t>()(8-byte), count=1: { 3389450 }, read 8 bytes ReadStringView(), length=3389450: 0x104f67023, read 3389450 bytes Read SEA resource snapshot 0x104f67023, size=3389450 Read<uint64_t>()(8-byte), count=1: { 0 }, read 8 bytes ReadStringView(), length=0: 0x1052a2835, read 0 bytes Read SEA resource code cache 0x1052a2835, size=0 deserializing IsolateDataSerializeInfo... { // -- primitive begins -- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, }, // -- primitive ends -- // -- template_values begins -- { { "async_wrap_ctor_template", 0, 435 }, { "binding_data_default_template", 2, 436 }, { "contextify_global_template", 6, 437 }, { "contextify_wrapper_template", 7, 438 }, { "env_proxy_template", 9, 439 }, { "env_proxy_ctor_template", 10, 440 }, { "dir_instance_template", 11, 441 }, { "fd_constructor_template", 12, 442 }, { "fdclose_constructor_template", 13, 443 }, { "filehandlereadwrap_template", 15, 444 }, { "fsreqpromise_constructor_template", 16, 445 }, { "handle_wrap_ctor_template", 17, 446 }, { "histogram_ctor_template", 18, 447 }, { "i18n_converter_template", 22, 448 }, { "js_transferable_constructor_template", 24, 449 }, { "libuv_stream_wrap_ctor_template", 25, 450 }, { "message_port_constructor_template", 26, 451 }, { "pipe_constructor_template", 28, 452 }, { "script_context_constructor_template", 31, 453 }, { "shutdown_wrap_template", 33, 454 }, { "tcp_constructor_template", 40, 455 }, { "write_wrap_template", 42, 456 }, { "worker_heap_snapshot_taker_template", 43, 457 }, { "async_wrap_binding_template", 45, 458 }, { "blob_binding_
outputFile,
{
env: {
NODE_DEBUG_NATIVE: 'SEA,MKSNAPSHOT',
...process.env,
}
}, {
stdout: 'Hello from snapshot',
trim: true,
});
}
12 changes: 11 additions & 1 deletion test/sequential/test-single-executable-application-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'se
process.execPath,
['--experimental-sea-config', 'sea-config.json'],
{
cwd: tmpdir.path
cwd: tmpdir.path,
env: {
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
},
},
{
stderr: /Single executable application is an experimental feature/
Expand All @@ -86,6 +90,12 @@ const outputFile = tmpdir.resolve(process.platform === 'win32' ? 'sea.exe' : 'se

spawnSyncAndExitWithoutError(

Check failure on line 91 in test/sequential/test-single-executable-application-snapshot.js

View workflow job for this annotation

GitHub Actions / test-asan

--- stderr --- [process 207183]: --- stderr --- Found SEA blob 0x1a630060, size=3388332 Found SEA resource 0x1a630060, size=3388332 Read<uint32_t>()(4-byte), count=1: { 21223968 }, read 4 bytes Read SEA magic 143da20 Read<uint32_t>()(4-byte), count=1: { 2 }, read 4 bytes Read SEA flags 2 Read<uint64_t>()(8-byte), count=1: { 11 }, read 8 bytes ReadStringView(), length=11: 0x1a630070, read 11 bytes snapshot.jsRead SEA code path 0x1a630070, size=11 Read<uint64_t>()(8-byte), count=1: { 3388297 }, read 8 bytes ReadStringView(), length=3388297: 0x1a630083, read 3388297 bytes Read SEA resource snapshot 0x1a630083, size=3388297 deserializing IsolateDataSerializeInfo... { // -- primitive begins -- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, }, // -- primitive ends -- // -- template_values begins -- { { "async_wrap_ctor_template", 0, 435 }, { "binding_data_default_template", 2, 436 }, { "contextify_global_template", 6, 437 }, { "contextify_wrapper_template", 7, 438 }, { "env_proxy_template", 9, 439 }, { "env_proxy_ctor_template", 10, 440 }, { "dir_instance_template", 11, 441 }, { "fd_constructor_template", 12, 442 }, { "fdclose_constructor_template", 13, 443 }, { "filehandlereadwrap_template", 15, 444 }, { "fsreqpromise_constructor_template", 16, 445 }, { "handle_wrap_ctor_template", 17, 446 }, { "histogram_ctor_template", 18, 447 }, { "i18n_converter_template", 22, 448 }, { "js_transferable_constructor_template", 24, 449 }, { "libuv_stream_wrap_ctor_template", 25, 450 }, { "message_port_constructor_template", 26, 451 }, { "pipe_constructor_template", 28, 452 }, { "script_context_constructor_template", 31, 453 }, { "shutdown_wrap_template", 33, 454 }, { "tcp_constructor_template", 40, 455 }, { "write_wrap_template", 42, 456 }, { "worker_heap_snapshot_taker_template", 43, 457 }, { "async_wrap_binding_template", 45, 458 }, { "blob_binding_template", 46, 459 }, { "builtins_binding_template", 47, 460 }, { "contextify_binding_template", 48, 461 }, { "encoding_binding_binding_template", 49, 462 },

Check failure on line 91 in test/sequential/test-single-executable-application-snapshot.js

View workflow job for this annotation

GitHub Actions / test-linux

--- stderr --- [process 207253]: --- stderr --- Found SEA blob 0x5652504e0080, size=3388380 Found SEA resource 0x5652504e0080, size=3388380 Read<uint32_t>()(4-byte), count=1: { 21223968 }, read 4 bytes Read SEA magic 143da20 Read<uint32_t>()(4-byte), count=1: { 2 }, read 4 bytes Read SEA flags 2 Read<uint64_t>()(8-byte), count=1: { 11 }, read 8 bytes ReadStringView(), length=11: 0x5652504e0090, read 11 bytes snapshot.jsRead SEA code path 0x5652504e0090, size=11 Read<uint64_t>()(8-byte), count=1: { 3388345 }, read 8 bytes ReadStringView(), length=3388345: 0x5652504e00a3, read 3388345 bytes Read SEA resource snapshot 0x5652504e00a3, size=3388345 deserializing IsolateDataSerializeInfo... { // -- primitive begins -- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, }, // -- primitive ends -- // -- template_values begins -- { { "async_wrap_ctor_template", 0, 435 }, { "binding_data_default_template", 2, 436 }, { "contextify_global_template", 6, 437 }, { "contextify_wrapper_template", 7, 438 }, { "env_proxy_template", 9, 439 }, { "env_proxy_ctor_template", 10, 440 }, { "dir_instance_template", 11, 441 }, { "fd_constructor_template", 12, 442 }, { "fdclose_constructor_template", 13, 443 }, { "filehandlereadwrap_template", 15, 444 }, { "fsreqpromise_constructor_template", 16, 445 }, { "handle_wrap_ctor_template", 17, 446 }, { "histogram_ctor_template", 18, 447 }, { "i18n_converter_template", 22, 448 }, { "js_transferable_constructor_template", 24, 449 }, { "libuv_stream_wrap_ctor_template", 25, 450 }, { "message_port_constructor_template", 26, 451 }, { "pipe_constructor_template", 28, 452 }, { "script_context_constructor_template", 31, 453 }, { "shutdown_wrap_template", 33, 454 }, { "tcp_constructor_template", 40, 455 }, { "write_wrap_template", 42, 456 }, { "worker_heap_snapshot_taker_template", 43, 457 }, { "async_wrap_binding_template", 45, 458 }, { "blob_binding_template", 46, 459 }, { "builtins_binding_template", 47, 460 }, { "contextify_binding_template", 48, 461 }, { "encoding_binding_bindi

Check failure on line 91 in test/sequential/test-single-executable-application-snapshot.js

View workflow job for this annotation

GitHub Actions / test-macOS

--- stderr --- [process 22923]: --- stderr --- Found SEA blob 0x1114e1000, size=3388189 Found SEA resource 0x1114e1000, size=3388189 Read<uint32_t>()(4-byte), count=1: { 21223968 }, read 4 bytes Read SEA magic 143da20 Read<uint32_t>()(4-byte), count=1: { 2 }, read 4 bytes Read SEA flags 2 Read<uint64_t>()(8-byte), count=1: { 11 }, read 8 bytes ReadStringView(), length=11: 0x1114e1010, read 11 bytes snapshot.jsRead SEA code path 0x1114e1010, size=11 Read<uint64_t>()(8-byte), count=1: { 3388154 }, read 8 bytes ReadStringView(), length=3388154: 0x1114e1023, read 3388154 bytes Read SEA resource snapshot 0x1114e1023, size=3388154 deserializing IsolateDataSerializeInfo... { // -- primitive begins -- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, }, // -- primitive ends -- // -- template_values begins -- { { "async_wrap_ctor_template", 0, 435 }, { "binding_data_default_template", 2, 436 }, { "contextify_global_template", 6, 437 }, { "contextify_wrapper_template", 7, 438 }, { "env_proxy_template", 9, 439 }, { "env_proxy_ctor_template", 10, 440 }, { "dir_instance_template", 11, 441 }, { "fd_constructor_template", 12, 442 }, { "fdclose_constructor_template", 13, 443 }, { "filehandlereadwrap_template", 15, 444 }, { "fsreqpromise_constructor_template", 16, 445 }, { "handle_wrap_ctor_template", 17, 446 }, { "histogram_ctor_template", 18, 447 }, { "i18n_converter_template", 22, 448 }, { "js_transferable_constructor_template", 24, 449 }, { "libuv_stream_wrap_ctor_template", 25, 450 }, { "message_port_constructor_template", 26, 451 }, { "pipe_constructor_template", 28, 452 }, { "script_context_constructor_template", 31, 453 }, { "shutdown_wrap_template", 33, 454 }, { "tcp_constructor_template", 40, 455 }, { "write_wrap_template", 42, 456 }, { "worker_heap_snapshot_taker_template", 43, 457 }, { "async_wrap_binding_template", 45, 458 }, { "blob_binding_template", 46, 459 }, { "builtins_binding_template", 47, 460 }, { "contextify_binding_template", 48, 461 }, { "encoding_binding_binding_template", 49, 4
outputFile,
{
env: {
NODE_DEBUG_NATIVE: 'SEA,MKSNAPSHOT',
...process.env,
}
},
{
trim: true,
stdout: 'Hello from snapshot',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ skipIfSingleExecutableIsNotSupported();
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');
const { copyFileSync, writeFileSync, existsSync } = require('fs');
const { execFileSync } = require('child_process');
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
const { join } = require('path');
const { strictEqual } = require('assert');
const assert = require('assert');

const inputFile = fixtures.path('sea.js');
Expand All @@ -44,17 +43,32 @@ writeFileSync(configFile, `

// Copy input to working directory
copyFileSync(inputFile, tmpdir.resolve('sea.js'));
execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], {
cwd: tmpdir.path
});
spawnSyncAndExitWithoutError(
process.execPath,
['--experimental-sea-config', 'sea-config.json'],
{
cwd: tmpdir.path,
env: {
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
},
});

assert(existsSync(seaPrepBlob));

copyFileSync(process.execPath, outputFile);
injectAndCodeSign(outputFile, seaPrepBlob);

const singleExecutableApplicationOutput = execFileSync(
spawnSyncAndExitWithoutError(
outputFile,
[ '-a', '--b=c', 'd' ],
{ env: { COMMON_DIRECTORY: join(__dirname, '..', 'common') } });
strictEqual(singleExecutableApplicationOutput.toString(), 'Hello, world! 😊\n');
{
env: {
COMMON_DIRECTORY: join(__dirname, '..', 'common'),
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
}
},
{
stdout: 'Hello, world! 😊\n'
});
25 changes: 17 additions & 8 deletions test/sequential/test-single-executable-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ skipIfSingleExecutableIsNotSupported();
const fixtures = require('../common/fixtures');
const tmpdir = require('../common/tmpdir');
const { copyFileSync, writeFileSync, existsSync } = require('fs');
const { execFileSync } = require('child_process');
const { spawnSyncAndExitWithoutError } = require('../common/child_process');
const { join } = require('path');
const { strictEqual } = require('assert');
const assert = require('assert');

const inputFile = fixtures.path('sea.js');
Expand All @@ -43,17 +42,27 @@ writeFileSync(configFile, `

// Copy input to working directory
copyFileSync(inputFile, tmpdir.resolve('sea.js'));
execFileSync(process.execPath, ['--experimental-sea-config', 'sea-config.json'], {
cwd: tmpdir.path
});
spawnSyncAndExitWithoutError(
process.execPath,
['--experimental-sea-config', 'sea-config.json'],
{ cwd: tmpdir.path },
{});

assert(existsSync(seaPrepBlob));

copyFileSync(process.execPath, outputFile);
injectAndCodeSign(outputFile, seaPrepBlob);

const singleExecutableApplicationOutput = execFileSync(
spawnSyncAndExitWithoutError(
outputFile,
[ '-a', '--b=c', 'd' ],
{ env: { COMMON_DIRECTORY: join(__dirname, '..', 'common') } });
strictEqual(singleExecutableApplicationOutput.toString(), 'Hello, world! 😊\n');
{
env: {
COMMON_DIRECTORY: join(__dirname, '..', 'common'),
NODE_DEBUG_NATIVE: 'SEA',
...process.env,
}
},
{
stdout: 'Hello, world! 😊\n'
});

0 comments on commit 0d2a341

Please sign in to comment.