Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions crates/perry-codegen/src/ext_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ const FFI_REGISTRY: &[(&str, OwnerKind)] = &[
("js_net_socket_address_get_family", OwnerKind::WellKnown("net")),
("js_net_socket_address_get_port", OwnerKind::WellKnown("net")),
("js_net_socket_address_get_flowlabel", OwnerKind::WellKnown("net")),
// #2013 — net validation rows whose runtime helpers live only in
// `perry-ext-net`. These calls can be emitted by native-table lowering,
// so they must independently flip the net well-known provider.
("js_net_get_default_auto_select_family", OwnerKind::WellKnown("net")),
("js_net_set_default_auto_select_family", OwnerKind::WellKnown("net")),
("js_net_get_default_auto_select_family_attempt_timeout", OwnerKind::WellKnown("net")),
("js_net_set_default_auto_select_family_attempt_timeout", OwnerKind::WellKnown("net")),
("js_net_socket_set_timeout", OwnerKind::WellKnown("net")),
// #1852 — chainable no-op option setters for Socket/Server.
("js_net_socket_noop_self", OwnerKind::WellKnown("net")),
("js_net_socket_get_type_of_service", OwnerKind::WellKnown("net")),
Expand Down Expand Up @@ -604,4 +612,26 @@ mod tests {
assert_symbol_routes_to(symbol, owner);
}
}

/// #2013 regression: net validation fixtures emit provider-only
/// `perry-ext-net` symbols through native-table lowering. Each one must
/// route to the net well-known archive so `PERRY_NO_AUTO_OPTIMIZE=1`
/// compiles the fixtures instead of linking unresolved `js_net_*` calls.
#[test]
fn emitted_net_validation_external_symbols_route_to_net() {
let _guard = PROVIDER_TEST_LOCK
.lock()
.expect("provider test lock poisoned");
for symbol in [
"js_net_create_server",
"js_net_server_listen",
"js_net_get_default_auto_select_family",
"js_net_set_default_auto_select_family",
"js_net_get_default_auto_select_family_attempt_timeout",
"js_net_set_default_auto_select_family_attempt_timeout",
"js_net_socket_set_timeout",
] {
assert_symbol_routes_to(symbol, OwnerKind::WellKnown("net"));
}
}
}
19 changes: 19 additions & 0 deletions run_parity_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,29 @@ if [[ -n "${PERRY_NO_AUTO_OPTIMIZE:-}" && "$TEST_SUITE" == "node-suite" ]]; then
;;
esac
fi
needs_ext_net=0
if [[ "$TEST_SUITE" == "node-suite" ]]; then
case "$MODULE_FILTER" in
""|net|net/*)
# node-suite/net commonly runs with PERRY_NO_AUTO_OPTIMIZE=1.
# That path links prebuilt well-known archives, so build ext-net
# once up front instead of failing on unresolved js_net_* symbols.
needs_ext_net=1
;;
esac
fi
if ! cargo build --release --quiet "${BUILD_PACKAGES[@]}" "${BUILD_FEATURES[@]}" 2>/dev/null; then
echo -e "${RED}Failed to build compiler/runtime archives${NC}"
exit 1
fi
if [[ "$needs_ext_net" -eq 1 ]]; then
echo "Building net extension (release)..."
ext_net_jobs="${CARGO_BUILD_JOBS:-1}"
if ! cargo build --release --quiet -p perry-ext-net -j "$ext_net_jobs" 2>/dev/null; then
echo -e "${RED}Failed to build net extension library${NC}"
exit 1
fi
fi
if [[ ! -x "$PERRY_BIN" ]]; then
echo -e "${RED}Expected $PERRY_BIN after release build${NC}"
exit 1
Expand Down