fix error with first time run of dynamic tests and added stdout and stderr writes upon command failures
@@ -272,6 +272,7 @@ macro_rules! declare_types {
#[test]
fn cli_test() {
+ use std::io::Write;
use std::process::Command;
let cli_output = if cfg!(target_os = "windows") {
Command::new("cmd")
@@ -285,6 +286,10 @@ fn cli_test() {
.output()
.expect("failed to execute process")
};
+ if !cli_output.status.success() {
+ std::io::stdout().write_all(&cli_output.stdout).expect("error redirecting stdout");
+ std::io::stdout().write_all(&cli_output.stderr).expect("error redirecting stderr");
+ };
assert!(cli_output.status.success());
let cli_test_output = if cfg!(target_os = "windows") {
@@ -299,13 +304,18 @@ fn cli_test() {
.output()
.expect("failed to execute process")
};
+ if !cli_test_output.status.success() {
+ std::io::stdout().write_all(&cli_test_output.stdout).expect("error redirecting stdout");
+ std::io::stdout().write_all(&cli_test_output.stderr).expect("error redirecting stderr");
+ };
assert!(cli_test_output.status.success());
}
#[test]
fn static_test() {
use rustc_version::{version_meta, Channel};
- if version_meta().unwrap().channel != Channel::Nightly { return }
+ if version_meta().unwrap().channel != Channel::Nightly { return };
+ use std::io::Write;
use std::process::Command;
let static_output = if cfg!(target_os = "windows") {
Command::new("cmd")
@@ -319,11 +329,16 @@ fn static_test() {
.output()
.expect("failed to execute process")
};
+ if !static_output.status.success() {
+ std::io::stdout().write_all(&static_output.stdout).expect("error redirecting stdout");
+ std::io::stdout().write_all(&static_output.stderr).expect("error redirecting stderr");
+ };
assert!(static_output.status.success());
}
#[test]
fn dynamic_test() {
+ use std::io::Write;
use std::process::Command;
let dynamic_output = if cfg!(target_os = "windows") {
Command::new("cmd")
@@ -333,9 +348,13 @@ fn dynamic_test() {
} else {
Command::new("sh")
.arg("-c")
- .arg("cd test/dynamic && npm install && npm test")
+ .arg("cd cli && npm install && cd ../test/dynamic && npm install && npm test")
.output()
.expect("failed to execute process")
};
+ if !dynamic_output.status.success() {
+ std::io::stdout().write_all(&dynamic_output.stdout).expect("error redirecting stdout");
+ std::io::stdout().write_all(&dynamic_output.stderr).expect("error redirecting stderr");
+ };
assert!(dynamic_output.status.success());
}
