From 3501c65abb4ea2b8e1234f263277b217554c73af Mon Sep 17 00:00:00 2001 From: mohanson Date: Wed, 18 Sep 2024 14:24:07 +0800 Subject: [PATCH] Fix 'make module' --- tests/ckb_js_tests/Makefile | 3 ++- tests/ckb_js_tests/test_data/spawn_caller.c | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/ckb_js_tests/Makefile b/tests/ckb_js_tests/Makefile index 1d5f4f9..452c56c 100644 --- a/tests/ckb_js_tests/Makefile +++ b/tests/ckb_js_tests/Makefile @@ -9,7 +9,8 @@ all: \ syscall \ fs_bytecode\ simple_udt\ - fs_mount + fs_mount \ + module cargo_test: cargo test diff --git a/tests/ckb_js_tests/test_data/spawn_caller.c b/tests/ckb_js_tests/test_data/spawn_caller.c index f7ef0ef..22a0813 100644 --- a/tests/ckb_js_tests/test_data/spawn_caller.c +++ b/tests/ckb_js_tests/test_data/spawn_caller.c @@ -1,19 +1,23 @@ #include "ckb_syscalls.h" int main() { + int err = 0; const char *argv[] = {"-f"}; - int8_t spawn_exit_code = -1; + uint64_t pid = 0; + uint64_t inherited_fds[1] = {0}; + int8_t exit_code = 0; spawn_args_t spgs = { - .memory_limit = 8, - .exit_code = &spawn_exit_code, - .content = NULL, - .content_length = NULL, + .argc = 1, + .argv = argv, + .process_id = &pid, + .inherited_fds = inherited_fds, }; - int success = ckb_spawn(1, 3, 0, 1, argv, &spgs); - if (success != 0) { + err = ckb_spawn(1, CKB_SOURCE_CELL_DEP, 0, 0, &spgs); + if (err != 0) { return 1; } - if (spawn_exit_code != 0) { + err = ckb_wait(pid, &exit_code); + if (err != 0) { return 1; } return 0;