mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
Allow downloading of large tests from EF github and fix issues with serde
This commit is contained in:
15
eth2/state_processing/yaml_utils/Cargo.toml
Normal file
15
eth2/state_processing/yaml_utils/Cargo.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "yaml-utils"
|
||||
version = "0.1.0"
|
||||
authors = ["Kirk Baird <baird.k@outlook.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[build-dependencies]
|
||||
reqwest = "0.9"
|
||||
tempdir = "0.3"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[lib]
|
||||
name = "yaml_utils"
|
||||
path = "src/lib.rs"
|
||||
28
eth2/state_processing/yaml_utils/build.rs
Normal file
28
eth2/state_processing/yaml_utils/build.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
extern crate reqwest;
|
||||
extern crate tempdir;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::copy;
|
||||
|
||||
fn main() {
|
||||
// These test files are not to be stored in the lighthouse repo as they are quite large (32MB).
|
||||
// They will be downloaded at build time by yaml-utils crate (in build.rs)
|
||||
let git_path = "https://raw.githubusercontent.com/ethereum/eth2.0-tests/master/state/";
|
||||
let test_names = vec![
|
||||
"sanity-check_default-config_100-vals.yaml",
|
||||
"sanity-check_small-config_32-vals.yaml",
|
||||
];
|
||||
|
||||
for test in test_names {
|
||||
let mut target = String::from(git_path);
|
||||
target.push_str(test);
|
||||
let mut response = reqwest::get(target.as_str()).unwrap();
|
||||
|
||||
let mut dest = {
|
||||
let mut file_name = String::from("specs/");
|
||||
file_name.push_str(test);
|
||||
File::create(file_name).unwrap()
|
||||
};
|
||||
copy(&mut response, &mut dest).unwrap();
|
||||
}
|
||||
}
|
||||
1
eth2/state_processing/yaml_utils/src/lib.rs
Normal file
1
eth2/state_processing/yaml_utils/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
// This is a place holder such that yaml-utils is now a crate hence build.rs will be run when 'cargo test' is called
|
||||
Reference in New Issue
Block a user