Copy port from headless test server when using WASM_BINDGEN_TEST_ADDRESS (#3873)

This commit is contained in:
Lynn 2024-03-06 22:04:28 +01:00 committed by GitHub
parent f0f3a47716
commit ac462d586a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 22 deletions

View File

@ -1,6 +1,13 @@
# `wasm-bindgen` Change Log
--------------------------------------------------------------------------------
## Unreleased
### Fixed
* Copy port from headless test server when using `WASM_BINDGEN_TEST_ADDRESS`.
[#3873](https://github.com/rustwasm/wasm-bindgen/pull/3873)
## [0.2.92](https://github.com/rustwasm/wasm-bindgen/compare/0.2.91...0.2.92)
Released 2024-03-04
@ -249,7 +256,7 @@ Released 2023-11-01
It was also automatically changed for `IdbFileHandle`, which is deprecated.
[#3537](https://github.com/rustwasm/wasm-bindgen/pull/3537)
* Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and
* Changed behavior when compiling to `wasm32-wasi` to match `wasm32-emscripten` and
non-WASM targets, generating a stub that panics when called rather than a wasm-
bindgen placeholder.
[#3233](https://github.com/rustwasm/wasm-bindgen/pull/3233)

View File

@ -1768,25 +1768,6 @@ impl<'a> Context<'a> {
self.memview("Float64", memory)
}
fn memview_function(&mut self, t: VectorKind, memory: MemoryId) -> MemView {
match t {
VectorKind::String => self.expose_uint8_memory(memory),
VectorKind::I8 => self.expose_int8_memory(memory),
VectorKind::U8 => self.expose_uint8_memory(memory),
VectorKind::ClampedU8 => self.expose_clamped_uint8_memory(memory),
VectorKind::I16 => self.expose_int16_memory(memory),
VectorKind::U16 => self.expose_uint16_memory(memory),
VectorKind::I32 => self.expose_int32_memory(memory),
VectorKind::U32 => self.expose_uint32_memory(memory),
VectorKind::I64 => self.expose_int64_memory(memory),
VectorKind::U64 => self.expose_uint64_memory(memory),
VectorKind::F32 => self.expose_f32_memory(memory),
VectorKind::F64 => self.expose_f64_memory(memory),
VectorKind::Externref => self.expose_uint32_memory(memory),
VectorKind::NamedExternref(_) => self.expose_uint32_memory(memory),
}
}
fn memview(&mut self, kind: &'static str, memory: walrus::MemoryId) -> MemView {
let view = self.memview_memory(kind, memory);
if !self.should_write_global(view.name.clone()) {

View File

@ -121,8 +121,20 @@ pub fn run(server: &SocketAddr, shell: &Shell, timeout: u64) -> Result<(), Error
// Visit our local server to open up the page that runs tests, and then get
// some handles to objects on the page which we'll be scraping output from.
let url =
std::env::var("WASM_BINDGEN_TEST_ADDRESS").unwrap_or_else(|_| format!("http://{}", server));
//
// If WASM_BINDGEN_TEST_ADDRESS is set, use it as the local server URL,
// trying to inherit the port from the server if it isn't specified.
let url = match std::env::var("WASM_BINDGEN_TEST_ADDRESS") {
Ok(u) => {
let mut url = Url::parse(&u)?;
if url.port().is_none() {
url.set_port(Some(server.port())).unwrap();
}
url.to_string()
}
Err(_) => format!("http://{}", server),
};
shell.status(&format!("Visiting {}...", url));
client.goto(&id, &url)?;
shell.status("Loading page elements...");

View File

@ -63,6 +63,7 @@ struct Args {
flag_no_modules_global: Option<String>,
flag_remove_name_section: bool,
flag_remove_producers_section: bool,
#[allow(dead_code)]
flag_weak_refs: Option<bool>,
flag_reference_types: Option<bool>,
flag_keep_lld_exports: bool,