Skip to content

Commit 17316b7

Browse files
committed
Tests: enable the v5-clean reference double-free conformance test
Adds test_reference_double_free (js-native-api) to the enabled suite -- a real v5 reference/double-free test, green on macOS (system JSC, including ASan) and Android (V8). Its test_wrap.js is quarantined via a known-failing allow-list in test_main.cpp: JSC napi_remove_wrap on an unwrapped object returns napi_invalid_arg (the consecutive remove_wrap+delete_reference path itself does not crash); tracked as a separate JSC fix. The rest of the reference/finalizer/wrap suite (test_reference, test_finalizer, 6_object_wrap) targets newer Node-API -- node_api_symbol_for (v9), napi_get_instance_data (v6), node_api_basic_env / node_api_post_finalizer (v9) -- and is documented for the staged NAPI_VERSION bump.
1 parent e94c72e commit 17316b7

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

Tests/NodeApi/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ set(JSR_NODE_API_NATIVE_TEST_DIRS
77
3_callbacks
88
4_object_factory
99
5_function_factory
10+
# v5-clean reference coverage. The rest of the reference/finalizer/wrap suite targets newer
11+
# Node-API and is staged for the NAPI_VERSION bump:
12+
# test_reference -> node_api_symbol_for (v9)
13+
# test_finalizer/ -> napi_get_instance_data (v6), node_api_basic_env / node_api_post_finalizer (v9)
14+
# 6_object_wrap -> napi_get_instance_data (v6), node_api_basic_env (v9)
15+
# (test_reference_double_free/test_wrap.js is quarantined in test_main.cpp -- a JSC remove_wrap
16+
# edge case that returns napi_invalid_arg; tracked as a separate fix, not a v5 blocker.)
17+
test_reference_double_free
1018
)
1119

1220
function(node_api_copy_test_sources TARGET_NAME)

Tests/NodeApi/test_main.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ class NodeApiTestFixture : public TestFixtureBase {
6060
ASSERT_TRUE(static_cast<bool>(config.run_script))
6161
<< "Node-API test runner is not configured.";
6262

63+
// Quarantined conformance cases: known-failing against the current v5 surface. Kept registered
64+
// (and skipped, so they stay visible) rather than silently dropped. Each needs a separate fix or
65+
// a NAPI_VERSION bump and must not block the v5 suite.
66+
static constexpr const char* kQuarantined[] = {
67+
// JSC napi_remove_wrap on an object that was never wrapped returns napi_invalid_arg, which the
68+
// runner surfaces as a failure. The consecutive remove_wrap+delete_reference path itself does
69+
// not crash. Tracked separately as a JSC remove_wrap fix.
70+
"test_reference_double_free/test_wrap.js",
71+
};
72+
for (const char* quarantined : kQuarantined) {
73+
if (m_jsFilePath.generic_string().find(quarantined) != std::string::npos) {
74+
GTEST_SKIP() << "Quarantined (known-failing on the v5 surface): " << quarantined;
75+
}
76+
}
77+
6378
ProcessResult result = config.run_script(m_jsFilePath);
6479
if (result.status == 0) {
6580
return;

Tests/UnitTests/Android/app/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ if(ANDROID)
7474
target_link_libraries(UnitTestsJNI PRIVATE dl)
7575
endif()
7676
target_compile_definitions(UnitTestsJNI
77-
PRIVATE NODE_API_AVAILABLE_NATIVE_TESTS="2_function_arguments,3_callbacks,4_object_factory,5_function_factory")
77+
PRIVATE NODE_API_AVAILABLE_NATIVE_TESTS="2_function_arguments,3_callbacks,4_object_factory,5_function_factory,test_reference_double_free")
7878

7979
# The conformance addons are built as standalone SHARED lib<name>.so by Tests/NodeApi/CMakeLists.txt,
8080
# packaged by AGP into nativeLibraryDir, and dlopen'd in-process by node_lite_android. Both they and

0 commit comments

Comments
 (0)