Skip to content

Commit de8f439

Browse files
author
wuhesheng
committed
Generate dwarf for debug test
1 parent c35cc93 commit de8f439

File tree

1 file changed

+7
-4
lines changed
  • crates/cli/src/bin/wasm-bindgen-test-runner

1 file changed

+7
-4
lines changed

crates/cli/src/bin/wasm-bindgen-test-runner/main.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,17 @@ fn main() -> anyhow::Result<()> {
117117
.map(Path::new)
118118
.context("file to test is not a valid file, can't extract file name")?;
119119

120+
let debug = env::var("WASM_BINDGEN_NO_DEBUG").is_err();
121+
120122
// Collect all tests that the test harness is supposed to run. We assume
121123
// that any exported function with the prefix `__wbg_test` is a test we need
122124
// to execute.
123125
let wasm = fs::read(&cli.file).context("failed to read Wasm file")?;
124-
let mut wasm =
125-
walrus::Module::from_buffer(&wasm).context("failed to deserialize Wasm module")?;
126+
let mut wasm = walrus::ModuleConfig::new()
127+
// generate dwarf for debug
128+
.generate_dwarf(debug)
129+
.parse(&wasm)
130+
.context("failed to deserialize Wasm module")?;
126131
let mut tests = Tests::new();
127132

128133
'outer: for export in wasm.exports.iter() {
@@ -233,7 +238,6 @@ fn main() -> anyhow::Result<()> {
233238
};
234239

235240
let headless = env::var("NO_HEADLESS").is_err();
236-
let debug = env::var("WASM_BINDGEN_NO_DEBUG").is_err();
237241

238242
// Gracefully handle requests to execute only node or only web tests.
239243
let node = matches!(test_mode, TestMode::Node { .. });
@@ -306,7 +310,6 @@ fn main() -> anyhow::Result<()> {
306310

307311
b.debug(debug)
308312
.input_module(module, wasm)
309-
.keep_debug(false)
310313
.emit_start(false)
311314
.generate(&tmpdir)
312315
.context("executing `wasm-bindgen` over the Wasm file")?;

0 commit comments

Comments
 (0)