Pretty-print EIP-3076 tests (#1977)
## Proposed Changes * Pretty-print the EIP-3076 tests to match https://github.com/eth2-clients/slashing-protection-interchange-tests/pull/4 * Move the `curl` invocation that downloads the tests to the test executor, removing the build script (closes #1982)
This commit is contained in:
parent
e1353088e0
commit
686b605112
@ -1,4 +1,4 @@
|
|||||||
TESTS_TAG := b8413ca42dc92308019d0d4db52c87e9e125c4e9
|
TESTS_TAG := f495032df9c26c678536cd2b7854e836ea94c217
|
||||||
GENERATE_DIR := generated-tests
|
GENERATE_DIR := generated-tests
|
||||||
OUTPUT_DIR := interchange-tests
|
OUTPUT_DIR := interchange-tests
|
||||||
TARBALL := $(OUTPUT_DIR)-$(TESTS_TAG).tar.gz
|
TARBALL := $(OUTPUT_DIR)-$(TESTS_TAG).tar.gz
|
||||||
@ -10,7 +10,7 @@ $(OUTPUT_DIR): $(TARBALL)
|
|||||||
tar --strip-components=1 -xzf $^ -C $@
|
tar --strip-components=1 -xzf $^ -C $@
|
||||||
|
|
||||||
$(TARBALL):
|
$(TARBALL):
|
||||||
curl -L -o $@ $(ARCHIVE_URL)
|
curl --fail -L -o $@ $(ARCHIVE_URL)
|
||||||
|
|
||||||
clean-test-files:
|
clean-test-files:
|
||||||
rm -rf $(OUTPUT_DIR)
|
rm -rf $(OUTPUT_DIR)
|
||||||
|
@ -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());
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ use slashing_protection::interchange_test::{MultiTestCase, TestCase};
|
|||||||
use slashing_protection::test_utils::{pubkey, DEFAULT_GENESIS_VALIDATORS_ROOT};
|
use slashing_protection::test_utils::{pubkey, DEFAULT_GENESIS_VALIDATORS_ROOT};
|
||||||
use slashing_protection::SUPPORTED_INTERCHANGE_FORMAT_VERSION;
|
use slashing_protection::SUPPORTED_INTERCHANGE_FORMAT_VERSION;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use types::{Epoch, Hash256, Slot};
|
use types::{Epoch, Hash256, Slot};
|
||||||
|
|
||||||
@ -346,6 +347,7 @@ fn main() {
|
|||||||
for test in tests {
|
for test in tests {
|
||||||
test.run();
|
test.run();
|
||||||
let f = File::create(output_dir.join(format!("{}.json", test.name))).unwrap();
|
let f = File::create(output_dir.join(format!("{}.json", test.name))).unwrap();
|
||||||
serde_json::to_writer(f, &test).unwrap();
|
serde_json::to_writer_pretty(&f, &test).unwrap();
|
||||||
|
writeln!(&f).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,19 @@ use slashing_protection::interchange_test::MultiTestCase;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::PathBuf;
|
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 {
|
fn test_root_dir() -> PathBuf {
|
||||||
|
download_tests();
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
.join("interchange-tests")
|
.join("interchange-tests")
|
||||||
.join("tests")
|
.join("tests")
|
||||||
|
Loading…
Reference in New Issue
Block a user