Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix make-test-integration CLI producing files when running locally #3557

Merged
merged 7 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/integration/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tempfile = "3"
target-lexicon = "0.12.5"
tar = "0.4.38"
flate2 = "1.0.24"
dirs = "4.0.0"

[features]
default = ["webc_runner"]
Expand Down
45 changes: 34 additions & 11 deletions tests/integration/cli/tests/config.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
use std::path::Path;
use std::path::{Path, PathBuf};
use std::process::Command;
use wasmer_integration_tests_cli::get_wasmer_path;
use wasmer_integration_tests_cli::{get_repo_root_path, get_wasmer_path};

fn get_wasmer_dir() -> Result<PathBuf, anyhow::Error> {
if let Ok(s) = std::env::var("WASMER_DIR") {
Ok(Path::new(&s).to_path_buf())
} else if let Some(root_dir) = get_repo_root_path().and_then(|root| {
if root.join("package").exists() {
Some(root.join("package"))
} else {
None
}
}) {
Ok(root_dir)
} else {
let home_dir = dirs::home_dir()
.ok_or(anyhow::anyhow!("no home dir"))?
.join(".wasmer");
if home_dir.exists() {
Ok(home_dir)
} else {
Err(anyhow::anyhow!("no .wasmer home dir"))
}
}
}

#[test]
fn wasmer_config_multiget() -> anyhow::Result<()> {
let bin_path = Path::new(env!("WASMER_DIR")).join("bin");
let include_path = Path::new(env!("WASMER_DIR")).join("include");
let bin_path = get_wasmer_dir()?.join("bin");
let include_path = get_wasmer_dir()?.join("include");

let bin = format!("{}", bin_path.display());
let include = format!("-I{}", include_path.display());
Expand Down Expand Up @@ -66,7 +89,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--bindir")
.output()?;

let bin_path = Path::new(env!("WASMER_DIR")).join("bin");
let bin_path = get_wasmer_dir()?.join("bin");
assert_eq!(
String::from_utf8(bindir.stdout).unwrap(),
format!("{}\n", bin_path.display())
Expand All @@ -77,7 +100,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--cflags")
.output()?;

let include_path = Path::new(env!("WASMER_DIR")).join("include");
let include_path = get_wasmer_dir()?.join("include");
assert_eq!(
String::from_utf8(bindir.stdout).unwrap(),
format!("-I{}\n", include_path.display())
Expand All @@ -88,7 +111,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--includedir")
.output()?;

let include_path = Path::new(env!("WASMER_DIR")).join("include");
let include_path = get_wasmer_dir()?.join("include");
assert_eq!(
String::from_utf8(bindir.stdout).unwrap(),
format!("{}\n", include_path.display())
Expand All @@ -99,7 +122,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--libdir")
.output()?;

let lib_path = Path::new(env!("WASMER_DIR")).join("lib");
let lib_path = get_wasmer_dir()?.join("lib");
assert_eq!(
String::from_utf8(bindir.stdout).unwrap(),
format!("{}\n", lib_path.display())
Expand All @@ -110,7 +133,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--libs")
.output()?;

let lib_path = Path::new(env!("WASMER_DIR")).join("lib");
let lib_path = get_wasmer_dir()?.join("lib");
assert_eq!(
String::from_utf8(bindir.stdout).unwrap(),
format!("-L{} -lwasmer\n", lib_path.display())
Expand All @@ -121,7 +144,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--prefix")
.output()?;

let wasmer_dir = Path::new(env!("WASMER_DIR"));
let wasmer_dir = get_wasmer_dir()?;
assert_eq!(
String::from_utf8(bindir.stdout).unwrap(),
format!("{}\n", wasmer_dir.display())
Expand Down Expand Up @@ -163,7 +186,7 @@ fn config_works() -> anyhow::Result<()> {
.arg("--config-path")
.output()?;

let config_path = Path::new(env!("WASMER_DIR")).join("wasmer.toml");
let config_path = get_wasmer_dir()?.join("wasmer.toml");
assert_eq!(
String::from_utf8_lossy(&output.stdout),
format!("{}\n", config_path.display())
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/cli/tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> {
output.arg("-o");
output.arg(python_wasmer_path.clone());
output.arg(format!("--{c}"));
output.arg("--debug-dir");
output.arg(format!("{t}-{c}"));
theduke marked this conversation as resolved.
Show resolved Hide resolved
if std::env::var("GITHUB_TOKEN").is_ok() {
output.arg("--debug-dir");
output.arg(format!("{t}-{c}"));
}

if t.contains("x86_64") && *c == "singlepass" {
output.arg("-m");
Expand Down