Skip to content

Commit 116e8dd

Browse files
committed
test MEMORY64 + pthread
1 parent d3681f8 commit 116e8dd

File tree

9 files changed

+30
-23
lines changed

9 files changed

+30
-23
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- uses: mymindstorm/setup-emsdk@v11
3838
if: ${{ matrix.target == 'emscripten' }}
3939
with:
40-
version: '3.1.29'
40+
version: '3.1.32'
4141
# no-cache: true
4242
actions-cache-folder: 'emsdk-cache'
4343
- uses: actions-rs/toolchain@v1
@@ -79,7 +79,7 @@ jobs:
7979
8080
- uses: actions/setup-node@v3
8181
with:
82-
node-version: '18.12.1'
82+
node-version: ${{ (matrix.target == 'emscripten' && '20.0.0-v8-canary202302081604228b65') || '18.12.1' }}
8383
registry-url: 'https://registry.npmjs.org'
8484
env:
8585
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -165,7 +165,7 @@ jobs:
165165
- uses: mymindstorm/setup-emsdk@v11
166166
if: ${{ matrix.target == 'emscripten' }}
167167
with:
168-
version: '3.1.29'
168+
version: '3.1.32'
169169
# no-cache: true
170170
actions-cache-folder: 'emsdk-cache'
171171
- name: Install wasi-sdk

packages/test/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ if(IS_EMSCRIPTEN)
8282
"-sNODEJS_CATCH_EXIT=0"
8383
"-sWASM_BIGINT=1"
8484
"-sALLOW_MEMORY_GROWTH=1"
85-
"-sMIN_CHROME_VERSION=67"
85+
"-sMIN_CHROME_VERSION=84"
8686
"-sSTACK_SIZE=2MB"
8787
"-sDEFAULT_PTHREAD_STACK_SIZE=2MB"
8888
"-sSAFE_HEAP=1"
@@ -221,11 +221,11 @@ endfunction()
221221
add_test("env" "./env/binding.c" OFF OFF "")
222222
add_test("hello" "./hello/binding.c" OFF OFF "")
223223

224-
if((NOT IS_WASM) OR IS_WASI OR (IS_EMSCRIPTEN AND NOT IS_MEMORY64))
224+
if((NOT IS_WASM) OR IS_WASI OR IS_EMSCRIPTEN)
225225
add_test("async" "./async/binding.c" OFF ON "")
226226
endif()
227227

228-
if((NOT IS_WASM) OR (IS_EMSCRIPTEN AND NOT IS_MEMORY64))
228+
if((NOT IS_WASM) OR IS_EMSCRIPTEN)
229229
add_test("string_mt" "./string/binding.c" ON ON "")
230230
if(IS_EMSCRIPTEN)
231231
add_test("pool" "./pool/binding.c" OFF ON "--pre-js=../pool/pre.js")
@@ -281,11 +281,13 @@ add_test("version" "./version/binding.c" OFF OFF "")
281281
add_test("make_callback" "./make_callback/binding.c" OFF OFF "")
282282
add_test("async_context" "./async_context/binding.c" OFF OFF "")
283283

284-
if(IS_EMSCRIPTEN AND NOT IS_MEMORY64)
284+
if(IS_EMSCRIPTEN)
285285
file(GLOB_RECURSE naa_binding_SRC
286286
"./node-addon-api/*.cc")
287287

288+
if(NOT IS_MEMORY64)
288289
add_naa_test("naa_binding" "${naa_binding_SRC}" "" ON)
290+
endif()
289291
add_naa_test("naa_binding_noexcept" "${naa_binding_SRC}" "" OFF)
290292
add_naa_test("naa_binding_noexcept_maybe" "${naa_binding_SRC}" "NODE_ADDON_API_ENABLE_MAYBE" OFF)
291293
add_naa_test("naa_binding_custom_namespace" "${naa_binding_SRC}" "NAPI_CPP_CUSTOM_NAMESPACE=cstm" OFF)

packages/test/async/async.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ async function main () {
3030
const p = child_process.spawnSync(
3131
process.execPath, [
3232
...(process.env.EMNAPI_TEST_WASI ? ['--experimental-wasi-unstable-preview1'] : []),
33+
...(process.env.MEMORY64 ? ['--experimental-wasm-memory64'] : []),
3334
__filename,
3435
'child'
3536
])

packages/test/async_cleanup_hook/async_cleanup_hook.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ module.exports = new Promise((resolve, reject) => {
77
const w = new Worker(`
88
const { load } = require(${JSON.stringify(require.resolve('../util.js'))})
99
load('async_cleanup_hook')
10-
`, { eval: true, env: process.env, execArgv: process.env.EMNAPI_TEST_WASI ? ['--experimental-wasi-unstable-preview1'] : [] })
10+
`, {
11+
eval: true,
12+
env: process.env,
13+
execArgv: [
14+
...(process.env.EMNAPI_TEST_WASI ? ['--experimental-wasi-unstable-preview1'] : [])
15+
]
16+
})
1117
w.on('exit', common.mustCall((code) => {
1218
console.log('Worker exit')
1319
if (code !== 0) {

packages/test/hello/hello.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ module.exports = new Promise((resolve, reject) => {
2020
load('hello').then((binding) => { const msg = binding.hello(); parentPort.postMessage(msg) });`, {
2121
eval: true,
2222
env: process.env,
23-
execArgv: process.env.EMNAPI_TEST_WASI ? ['--experimental-wasi-unstable-preview1'] : []
23+
execArgv: [
24+
...(process.env.EMNAPI_TEST_WASI ? ['--experimental-wasi-unstable-preview1'] : [])
25+
]
2426
})
2527
.on('message', common.mustCall((msg) => {
2628
try {

packages/test/node-addon-api/common/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function runTest (test, buildType, buildPathRoot = process.env.BUILD_PATH
8484
// path.join(buildPathRoot, `../build/${buildType}/binding_noexcept.node`),
8585
// path.join(buildPathRoot, `../build/${buildType}/binding_noexcept_maybe.node`),
8686
// path.join(buildPathRoot, `../build/${buildType}/binding_custom_namespace.node`)
87-
'naa_binding',
87+
...(!process.env.MEMORY64 ? ['naa_binding'] : []),
8888
'naa_binding_noexcept',
8989
'naa_binding_noexcept_maybe',
9090
'naa_binding_custom_namespace'

packages/test/pool/binding.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ typedef struct {
1111
napi_async_work _request;
1212
} carrier;
1313

14-
static void F(void* data) {
14+
static void* F(void* data) {
1515
uv_sleep(1000);
16+
return NULL;
1617
}
1718

1819
static void some_method() {
1920
uv_thread_t pid[3];
2021
printf("some_method()\n");
2122
for (int i = 0; i < 3; ++i) {
22-
uv_thread_create(pid + i, F, NULL);
23+
uv_thread_create(pid + i, (uv_thread_cb)F, NULL);
2324
}
2425
for (int i = 0; i < 3; ++i) {
2526
uv_thread_join(pid + i);

packages/test/script/test.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ const pthread = [
1616
'string/string-pthread.test.js'
1717
]
1818

19-
if (process.env.MEMORY64) {
20-
ignore = [...new Set([
21-
...ignore,
22-
...pthread
23-
])]
24-
}
25-
2619
if (process.env.EMNAPI_TEST_NATIVE) {
2720
ignore = [...new Set([
2821
...ignore,

packages/test/tsfn/binding.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,18 @@ static ts_fn_hint ts_info;
3030
// Thread data to transmit to JS
3131
static int ints[ARRAY_LENGTH];
3232

33-
static void secondary_thread(void* data) {
33+
static void* secondary_thread(void* data) {
3434
napi_threadsafe_function ts_fn = data;
3535

3636
if (napi_release_threadsafe_function(ts_fn, napi_tsfn_release) != napi_ok) {
3737
napi_fatal_error("secondary_thread", NAPI_AUTO_LENGTH,
3838
"napi_release_threadsafe_function failed", NAPI_AUTO_LENGTH);
3939
}
40+
return NULL;
4041
}
4142

4243
// Source thread producing the data
43-
static void data_source_thread(void* data) {
44+
static void* data_source_thread(void* data) {
4445
napi_threadsafe_function ts_fn = data;
4546
int index;
4647
void* hint;
@@ -67,7 +68,7 @@ static void data_source_thread(void* data) {
6768
"napi_acquire_threadsafe_function failed", NAPI_AUTO_LENGTH);
6869
}
6970

70-
if (uv_thread_create(&uv_threads[1], secondary_thread, ts_fn) != 0) {
71+
if (uv_thread_create(&uv_threads[1], (uv_thread_cb)secondary_thread, ts_fn) != 0) {
7172
napi_fatal_error("data_source_thread", NAPI_AUTO_LENGTH,
7273
"failed to start secondary thread", NAPI_AUTO_LENGTH);
7374
}
@@ -126,6 +127,7 @@ static void data_source_thread(void* data) {
126127
napi_fatal_error("data_source_thread", NAPI_AUTO_LENGTH,
127128
"napi_release_threadsafe_function failed", NAPI_AUTO_LENGTH);
128129
}
130+
return NULL;
129131
}
130132

131133
// Getting the data into JS
@@ -239,7 +241,7 @@ static napi_value StartThreadInternal(napi_env env,
239241
napi_get_value_bool(env, argv[2], &(ts_info.start_secondary)));
240242

241243
NAPI_ASSERT(env,
242-
(uv_thread_create(&uv_threads[0], data_source_thread, ts_fn) == 0),
244+
(uv_thread_create(&uv_threads[0], (uv_thread_cb)data_source_thread, ts_fn) == 0),
243245
"Thread creation");
244246

245247
return NULL;

0 commit comments

Comments
 (0)