From 89bc15f77ed84a53d4c6c4abe707dd258011de66 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 15 Apr 2019 09:59:35 +1000 Subject: [PATCH 1/6] Move some long-running tests to release-only --- beacon_node/beacon_chain/test_harness/tests/chain.rs | 2 ++ eth2/fork_choice/tests/tests.rs | 1 + eth2/state_processing/tests/tests.rs | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/beacon_node/beacon_chain/test_harness/tests/chain.rs b/beacon_node/beacon_chain/test_harness/tests/chain.rs index e72c3a5aa5..d47de6889a 100644 --- a/beacon_node/beacon_chain/test_harness/tests/chain.rs +++ b/beacon_node/beacon_chain/test_harness/tests/chain.rs @@ -1,3 +1,5 @@ +#![cfg(not(debug_assertions))] + use env_logger::{Builder, Env}; use log::debug; use test_harness::BeaconChainHarness; diff --git a/eth2/fork_choice/tests/tests.rs b/eth2/fork_choice/tests/tests.rs index 3ce63eeb77..fb530ac434 100644 --- a/eth2/fork_choice/tests/tests.rs +++ b/eth2/fork_choice/tests/tests.rs @@ -1,3 +1,4 @@ +#![cfg(not(debug_assertions))] // Tests the available fork-choice algorithms extern crate beacon_chain; diff --git a/eth2/state_processing/tests/tests.rs b/eth2/state_processing/tests/tests.rs index 1359508dcd..25613f9a72 100644 --- a/eth2/state_processing/tests/tests.rs +++ b/eth2/state_processing/tests/tests.rs @@ -1,6 +1,7 @@ +#![cfg(not(debug_assertions))] + use serde_derive::Deserialize; use serde_yaml; -#[cfg(not(debug_assertions))] use state_processing::{ per_block_processing, per_block_processing_without_verifying_block_signature, per_slot_processing, @@ -63,7 +64,6 @@ fn test_read_yaml() { } #[test] -#[cfg(not(debug_assertions))] fn run_state_transition_tests_small() { // Test sanity-check_small-config_32-vals.yaml let mut file = { From 332795e8b7e14444871ff4bfc7f492cd0902f546 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 17 Apr 2019 18:00:14 +1000 Subject: [PATCH 2/6] Revert "questionable patch for TreeHashVector" This reverts commit 701cc00d08029343dd6b298e1f42f84d56934316. --- eth2/state_processing/tests/tests.rs | 2 +- eth2/types/src/tree_hash_vector.rs | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/eth2/state_processing/tests/tests.rs b/eth2/state_processing/tests/tests.rs index ccad198bb5..6491e255a8 100644 --- a/eth2/state_processing/tests/tests.rs +++ b/eth2/state_processing/tests/tests.rs @@ -27,7 +27,7 @@ impl ExpectedState { ($field_name:ident) => { if self.$field_name.as_ref().map_or(true, |$field_name| { println!(" > Checking {}", stringify!($field_name)); - &state.$field_name == $field_name + $field_name == &state.$field_name }) { vec![] } else { diff --git a/eth2/types/src/tree_hash_vector.rs b/eth2/types/src/tree_hash_vector.rs index 9b77e13dcd..1cc8e40a55 100644 --- a/eth2/types/src/tree_hash_vector.rs +++ b/eth2/types/src/tree_hash_vector.rs @@ -33,12 +33,6 @@ impl DerefMut for TreeHashVector { } } -impl PartialEq> for TreeHashVector { - fn eq(&self, other: &Vec) -> bool { - &self.0 == other - } -} - impl tree_hash::TreeHash for TreeHashVector where T: TreeHash, From b201c52140134ddefb7b19ad8597f4b6054ebc09 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 17 Apr 2019 18:07:28 +1000 Subject: [PATCH 3/6] state transition tests: use TreeHashVector --- eth2/state_processing/tests/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth2/state_processing/tests/tests.rs b/eth2/state_processing/tests/tests.rs index 6491e255a8..fcd0341584 100644 --- a/eth2/state_processing/tests/tests.rs +++ b/eth2/state_processing/tests/tests.rs @@ -16,7 +16,7 @@ pub struct ExpectedState { pub current_epoch_attestations: Option>, pub historical_roots: Option>, pub finalized_epoch: Option, - pub latest_block_roots: Option>, + pub latest_block_roots: Option>, } impl ExpectedState { From 7b853b33d54052c448020f4ffef3a630241f666b Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Wed, 17 Apr 2019 21:57:48 +1000 Subject: [PATCH 4/6] Add env vars to travis --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6233ea68b2..f75f9e6eac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,12 @@ before_install: - sudo mv protoc3/include/* /usr/local/include/ - sudo chown $USER /usr/local/bin/protoc - sudo chown -R $USER /usr/local/include/google +env: + - BUILD= + - BUILD=--release script: - - cargo build --verbose --all - - cargo build --verbose --release --all - - cargo test --verbose --all - - cargo test --verbose --release --all + - cargo build --verbose $BUILD --all + - cargo test --verbose $BUILD --all - cargo test --manifest-path eth2/state_processing/Cargo.toml --verbose --release --features fake_crypto - cargo fmt --all -- --check # No clippy until later... From 381388d9c2ee5f12035958f36e147ef8952da503 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 18 Apr 2019 06:45:25 +1000 Subject: [PATCH 5/6] Move state processing test into own build --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f75f9e6eac..7a08498947 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,12 @@ before_install: - sudo chown $USER /usr/local/bin/protoc - sudo chown -R $USER /usr/local/include/google env: - - BUILD= - - BUILD=--release + - BUILD=--all + - BUILD=--release --all + - BUILD= --manifest-path eth2/state_processing/Cargo.toml --release --features fake_crypto script: - - cargo build --verbose $BUILD --all - - cargo test --verbose $BUILD --all - - cargo test --manifest-path eth2/state_processing/Cargo.toml --verbose --release --features fake_crypto + - cargo build --verbose $BUILD + - cargo test --verbose $BUILD - cargo fmt --all -- --check # No clippy until later... #- cargo clippy From 2ee3b05bd382afcbeaf62934f390d8a17befd5e0 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 18 Apr 2019 19:10:13 +1000 Subject: [PATCH 6/6] Only build in debug for beta and nightly --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7a08498947..70b9d21333 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,15 @@ matrix: allow_failures: - rust: nightly fast_finish: true + exclude: + - rust: beta + env: BUILD=--release --all + - rust: beta + env: BUILD= --manifest-path eth2/state_processing/Cargo.toml --release --features fake_crypto + - rust: nightly + env: BUILD=--release --all + - rust: nightly + env: BUILD= --manifest-path eth2/state_processing/Cargo.toml --release --features fake_crypto install: - rustup component add rustfmt - rustup component add clippy