From 9983d3707aab1041ad07c053a470914b375d8a97 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Thu, 3 Dec 2020 13:02:22 +1100 Subject: [PATCH] Move impure download code to tests --- validator_client/slashing_protection/Makefile | 2 +- validator_client/slashing_protection/build.rs | 7 ------- .../slashing_protection/tests/interop.rs | 12 ++++++++++++ 3 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 validator_client/slashing_protection/build.rs diff --git a/validator_client/slashing_protection/Makefile b/validator_client/slashing_protection/Makefile index 740ee54851b..79960ec5aa1 100644 --- a/validator_client/slashing_protection/Makefile +++ b/validator_client/slashing_protection/Makefile @@ -10,7 +10,7 @@ $(OUTPUT_DIR): $(TARBALL) tar --strip-components=1 -xzf $^ -C $@ $(TARBALL): - curl -L -o $@ $(ARCHIVE_URL) + curl --fail -L -o $@ $(ARCHIVE_URL) clean-test-files: rm -rf $(OUTPUT_DIR) diff --git a/validator_client/slashing_protection/build.rs b/validator_client/slashing_protection/build.rs deleted file mode 100644 index 03abb88b49c..00000000000 --- a/validator_client/slashing_protection/build.rs +++ /dev/null @@ -1,7 +0,0 @@ -fn main() { - let exit_status = std::process::Command::new("make") - .current_dir(std::env::var("CARGO_MANIFEST_DIR").unwrap()) - .status() - .unwrap(); - assert!(exit_status.success()); -} diff --git a/validator_client/slashing_protection/tests/interop.rs b/validator_client/slashing_protection/tests/interop.rs index 7f0afd6a77a..62cd03e251e 100644 --- a/validator_client/slashing_protection/tests/interop.rs +++ b/validator_client/slashing_protection/tests/interop.rs @@ -2,7 +2,19 @@ use slashing_protection::interchange_test::MultiTestCase; use std::fs::File; use std::path::PathBuf; +fn download_tests() { + let make_output = std::process::Command::new("make") + .current_dir(std::env::var("CARGO_MANIFEST_DIR").unwrap()) + .output() + .expect("need `make` to succeed to download and untar slashing protection tests"); + if !make_output.status.success() { + eprintln!("{}", String::from_utf8_lossy(&make_output.stderr)); + panic!("Running `make` for slashing protection tests failed, see above"); + } +} + fn test_root_dir() -> PathBuf { + download_tests(); PathBuf::from(env!("CARGO_MANIFEST_DIR")) .join("interchange-tests") .join("tests")