mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 13:18:20 +00:00
Add integration test, use different spinner library to fix #3346
This commit is contained in:
76
Cargo.lock
generated
76
Cargo.lock
generated
@@ -46,12 +46,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi_term"
|
|
||||||
version = "0.7.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "30275ad0ad84ec1c06dde3b3f7d23c6006b7d76d61a85e7060b426b747eff70d"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "any_ascii"
|
name = "any_ascii"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
@@ -878,16 +872,6 @@ dependencies = [
|
|||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dirs"
|
|
||||||
version = "2.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 0.1.10",
|
|
||||||
"dirs-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dirs"
|
name = "dirs"
|
||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
@@ -1879,6 +1863,12 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maplit"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@@ -2309,7 +2299,7 @@ dependencies = [
|
|||||||
"csv",
|
"csv",
|
||||||
"encode_unicode 1.0.0",
|
"encode_unicode 1.0.0",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"term 0.7.0",
|
"term",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3098,13 +3088,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spinner"
|
name = "spinoff"
|
||||||
version = "0.5.0"
|
version = "0.5.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6e3a7cd01625b7e43e62815677d692cb59b221c2fdc2853d1eb86a260ee0c272"
|
checksum = "812db6f40551bdcdb10e1d2070ec33f69805d2bfb7e59426c7d14e7e1b4194dd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"colored 2.0.0",
|
||||||
"term 0.6.1",
|
"maplit",
|
||||||
|
"once_cell",
|
||||||
|
"strum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3177,6 +3169,28 @@ version = "0.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strum"
|
||||||
|
version = "0.24.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
|
||||||
|
dependencies = [
|
||||||
|
"strum_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strum_macros"
|
||||||
|
version = "0.24.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
|
||||||
|
dependencies = [
|
||||||
|
"heck 0.4.0",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"rustversion",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
version = "2.4.1"
|
version = "2.4.1"
|
||||||
@@ -3241,16 +3255,6 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "term"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5"
|
|
||||||
dependencies = [
|
|
||||||
"dirs 2.0.2",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "term"
|
name = "term"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -3316,7 +3320,7 @@ dependencies = [
|
|||||||
"getopts",
|
"getopts",
|
||||||
"libc",
|
"libc",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"term 0.7.0",
|
"term",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4019,7 +4023,7 @@ dependencies = [
|
|||||||
"clap 3.2.23",
|
"clap 3.2.23",
|
||||||
"colored 2.0.0",
|
"colored 2.0.0",
|
||||||
"dialoguer",
|
"dialoguer",
|
||||||
"dirs 4.0.0",
|
"dirs",
|
||||||
"distance",
|
"distance",
|
||||||
"fern",
|
"fern",
|
||||||
"http_req",
|
"http_req",
|
||||||
@@ -4032,7 +4036,7 @@ dependencies = [
|
|||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"spinner",
|
"spinoff",
|
||||||
"target-lexicon 0.12.5",
|
"target-lexicon 0.12.5",
|
||||||
"tempdir",
|
"tempdir",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
@@ -4260,7 +4264,7 @@ name = "wasmer-registry"
|
|||||||
version = "3.0.1"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dirs 4.0.0",
|
"dirs",
|
||||||
"flate2",
|
"flate2",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"graphql_client",
|
"graphql_client",
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ wasmer-vfs = { version = "=3.0.1", path = "../vfs", default-features = false, f
|
|||||||
atty = "0.2"
|
atty = "0.2"
|
||||||
colored = "2.0"
|
colored = "2.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
spinner = "0.5.0"
|
spinoff = "0.5.4"
|
||||||
clap = { version = "3.2.22", features = ["derive", "env"] }
|
clap = { version = "3.2.22", features = ["derive", "env"] }
|
||||||
# For the function names autosuggestion
|
# For the function names autosuggestion
|
||||||
distance = "0.4"
|
distance = "0.4"
|
||||||
@@ -166,6 +166,9 @@ http = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
|
colored = "2.0.0"
|
||||||
|
|
||||||
[package.metadata.binstall]
|
[package.metadata.binstall]
|
||||||
pkg-fmt = "tgz"
|
pkg-fmt = "tgz"
|
||||||
|
|
||||||
|
|||||||
@@ -645,17 +645,20 @@ impl Run {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_spinner(msg: String) -> Option<spinner::SpinnerHandle> {
|
fn start_spinner(msg: String) -> Option<spinoff::Spinner> {
|
||||||
if !isatty::stdout_isatty() {
|
if !isatty::stdout_isatty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Some(
|
#[cfg(target_os = "windows")]
|
||||||
spinner::SpinnerBuilder::new(msg)
|
{
|
||||||
.spinner(vec![
|
use colored::control;
|
||||||
"⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷", " ", "⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈",
|
let _ = control::enable_virtual_terminal(true);
|
||||||
])
|
}
|
||||||
.start(),
|
Some(spinoff::Spinner::new(
|
||||||
)
|
spinoff::Spinners::Dots,
|
||||||
|
msg,
|
||||||
|
spinoff::Color::White,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Before looking up a command from the registry, try to see if we have
|
/// Before looking up a command from the registry, try to see if we have
|
||||||
@@ -706,8 +709,7 @@ pub(crate) fn try_autoinstall_package(
|
|||||||
force_install,
|
force_install,
|
||||||
);
|
);
|
||||||
if let Some(sp) = sp.take() {
|
if let Some(sp) = sp.take() {
|
||||||
sp.close();
|
sp.clear();
|
||||||
print!("\r");
|
|
||||||
}
|
}
|
||||||
let _ = std::io::stdout().flush();
|
let _ = std::io::stdout().flush();
|
||||||
let (_, package_dir) = match result {
|
let (_, package_dir) = match result {
|
||||||
@@ -765,8 +767,8 @@ fn try_lookup_command(sv: &mut SplitVersion) -> Result<PackageDownloadInfo, anyh
|
|||||||
|
|
||||||
for registry in wasmer_registry::get_all_available_registries().unwrap_or_default() {
|
for registry in wasmer_registry::get_all_available_registries().unwrap_or_default() {
|
||||||
let result = wasmer_registry::query_command_from_registry(®istry, &sv.package);
|
let result = wasmer_registry::query_command_from_registry(®istry, &sv.package);
|
||||||
if sp.is_some() {
|
if let Some(s) = sp.take() {
|
||||||
print!("\r");
|
s.clear();
|
||||||
}
|
}
|
||||||
let _ = std::io::stdout().flush();
|
let _ = std::io::stdout().flush();
|
||||||
let command = sv.package.clone();
|
let command = sv.package.clone();
|
||||||
@@ -779,8 +781,7 @@ fn try_lookup_command(sv: &mut SplitVersion) -> Result<PackageDownloadInfo, anyh
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(sp) = sp.take() {
|
if let Some(sp) = sp.take() {
|
||||||
sp.close();
|
sp.clear();
|
||||||
print!("\r");
|
|
||||||
}
|
}
|
||||||
let _ = std::io::stdout().flush();
|
let _ = std::io::stdout().flush();
|
||||||
Err(anyhow::anyhow!("command {sv} not found"))
|
Err(anyhow::anyhow!("command {sv} not found"))
|
||||||
@@ -944,7 +945,7 @@ fn try_run_url(
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
if let Some(sp) = sp {
|
if let Some(sp) = sp {
|
||||||
sp.close();
|
sp.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ pub fn query_package_from_registry(
|
|||||||
|
|
||||||
let v = response.package_version.as_ref().ok_or_else(|| {
|
let v = response.package_version.as_ref().ok_or_else(|| {
|
||||||
QueryPackageError::ErrorSendingQuery(format!(
|
QueryPackageError::ErrorSendingQuery(format!(
|
||||||
"Invalid response for crate {name:?}: no manifest"
|
"Invalid response for crate {name:?}: no package version: {response:#?}"
|
||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|||||||
@@ -547,14 +547,10 @@ fn run_no_start_wasm_report_error() -> anyhow::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Test that changes to wapm run don't break wasmer run
|
// Test that changes to wapm run don't break wasmer run
|
||||||
#[test]
|
#[test]
|
||||||
fn test_wapm_run_works() -> anyhow::Result<()> {
|
fn test_wapm_run_works() -> anyhow::Result<()> {
|
||||||
let output = Command::new("wapm")
|
let output = Command::new("wapm").arg("install").arg("cowsay").output()?;
|
||||||
.arg("install")
|
|
||||||
.arg("cowsay")
|
|
||||||
.output()?;
|
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
bail!(
|
bail!(
|
||||||
@@ -570,7 +566,10 @@ fn test_wapm_run_works() -> anyhow::Result<()> {
|
|||||||
.arg("run")
|
.arg("run")
|
||||||
.arg("cowsay")
|
.arg("cowsay")
|
||||||
.arg("hello")
|
.arg("hello")
|
||||||
.env("WAPM_RUNTIME".to_string(), format!("{}", get_wasmer_path().display()))
|
.env(
|
||||||
|
"WAPM_RUNTIME".to_string(),
|
||||||
|
format!("{}", get_wasmer_path().display()),
|
||||||
|
)
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
|
|||||||
Reference in New Issue
Block a user