From 2c254a55ccbf8c9fc06d2e08ccb7487e854cc0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 30 Nov 2022 18:37:28 +0100 Subject: [PATCH] Fix compilation issue in create-exe function --- lib/cli/src/commands/create_exe.rs | 2 +- tests/integration/cli/tests/run.rs | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 34ccb8139..87623e8ba 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -439,7 +439,7 @@ impl CreateExe { .canonicalize() .unwrap_or_else(|_| target_file_path.clone()); let files = untar(tarball, target_file_path)?; - files.into_iter().find(|f| f.ends_with("libwasmer.a")).ok_or_else(|| { + files.iter().find(|f| f.ends_with("libwasmer.a")).cloned().ok_or_else(|| { anyhow!("Could not find libwasmer for {} target in the fetched release from Github: you can download it manually and specify its path with the --cross-compilation-library-path LIBRARY_PATH flag. (files = {files:#?}", target)})? } #[cfg(not(feature = "http"))] diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs index 4ae906a19..98435c036 100644 --- a/tests/integration/cli/tests/run.rs +++ b/tests/integration/cli/tests/run.rs @@ -33,11 +33,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { "x86_64-windows-gnu", ]; - let compilers = &[ - "cranelift", - "singlepass", - "llvm", - ]; + let compilers = &["cranelift", "singlepass", "llvm"]; for t in targets { for c in compilers { @@ -45,7 +41,7 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { let python_wasmer_path = temp_dir.path().join(format!("{t}-python")); let mut output = Command::new(get_wasmer_path()); - + output.arg("create-exe"); output.arg(wasi_test_python_path()); output.arg("--target"); @@ -54,20 +50,20 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> { output.arg(python_wasmer_path.clone()); output.arg(format!("--{c}")); let output = output.output()?; - + let stdout = std::str::from_utf8(&output.stdout) .expect("stdout is not utf8! need to handle arbitrary bytes"); - + let stderr = std::str::from_utf8(&output.stderr) .expect("stderr is not utf8! need to handle arbitrary bytes"); - + if !output.status.success() { bail!("linking failed with: stdout: {stdout}\n\nstderr: {stderr}"); } - + println!("stdout: {stdout}"); println!("stderr: {stderr}"); - + if !python_wasmer_path.exists() { let p = std::fs::read_dir(temp_dir.path()) .unwrap()