Replace EF tests submodule with a makefile
This commit is contained in:
parent
9b062e0523
commit
9461b5063b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "tests/ef_tests/eth2.0-spec-tests"]
|
||||
path = tests/ef_tests/eth2.0-spec-tests
|
||||
url = https://github.com/ethereum/eth2.0-spec-tests
|
31
Makefile
Normal file
31
Makefile
Normal file
@ -0,0 +1,31 @@
|
||||
TESTS_TAG := v0.8.3
|
||||
TESTS = general minimal mainnet
|
||||
|
||||
TESTS_BASE_DIR := ./tests/ef_tests
|
||||
REPO_NAME := eth2.0-spec-tests
|
||||
OUTPUT_DIR := $(TESTS_BASE_DIR)/$(REPO_NAME)
|
||||
|
||||
BASE_URL := https://github.com/ethereum/$(REPO_NAME)/releases/download/$(SPEC_VERSION)
|
||||
|
||||
release:
|
||||
cargo build --all --release
|
||||
|
||||
clean_ef_tests:
|
||||
rm -r $(OUTPUT_DIR)
|
||||
|
||||
ef_tests: download_tests extract_tests
|
||||
mkdir $(OUTPUT_DIR)
|
||||
for test in $(TESTS); do \
|
||||
tar -C $(OUTPUT_DIR) -xvf $(TESTS_BASE_DIR)/$$test.tar ;\
|
||||
rm $(TESTS_BASE_DIR)/$$test.tar ;\
|
||||
done
|
||||
|
||||
extract_tests:
|
||||
for test in $(TESTS); do \
|
||||
gzip -df $(TESTS_BASE_DIR)/$$test.tar.gz ;\
|
||||
done
|
||||
|
||||
download_tests:
|
||||
for test in $(TESTS); do \
|
||||
wget -P $(TESTS_BASE_DIR) $(BASE_URL)/$$test.tar.gz; \
|
||||
done
|
@ -9,11 +9,8 @@ See the [Quick instructions](#quick-instructions) for a summary or the
|
||||
|
||||
1. Install Rust + Cargo with [rustup](https://rustup.rs/).
|
||||
1. Install build dependencies using your package manager.
|
||||
- `$ <package-manager> clang protobuf libssl-dev cmake git-lfs`
|
||||
- Ensure [git-lfs](https://git-lfs.github.com/) is installed with `git lfs
|
||||
install`.
|
||||
1. Clone the [sigp/lighthouse](https://github.com/sigp/lighthouse), ensuring to
|
||||
**initialize submodules**.
|
||||
- `$ <package-manager> clang protobuf libssl-dev cmake`
|
||||
1. Clone the [sigp/lighthouse](https://github.com/sigp/lighthouse).
|
||||
1. In the root of the repo, run the tests with `cargo test --all --release`.
|
||||
1. Then, build the binaries with `cargo build --all --release`.
|
||||
1. Lighthouse is now fully built and tested.
|
||||
@ -37,13 +34,8 @@ steps:
|
||||
- `protobuf`: required for protobuf serialization (gRPC)
|
||||
- `libssl-dev`: also gRPC
|
||||
- `cmake`: required for building protobuf
|
||||
- `git-lfs`: The Git extension for [Large File
|
||||
Support](https://git-lfs.github.com/) (required for Ethereum Foundation
|
||||
test vectors).
|
||||
1. Clone the repository with submodules: `git clone --recursive
|
||||
https://github.com/sigp/lighthouse`. If you're already cloned the repo,
|
||||
ensure testing submodules are present: `$ git submodule init; git
|
||||
submodule update`
|
||||
1. Clone the repository with submodules: `git clone
|
||||
https://github.com/sigp/lighthouse`.
|
||||
1. Change directory to the root of the repository.
|
||||
1. Run the test suite with `cargo test --all --release`. The build and test
|
||||
process can take several minutes. If you experience any failures on
|
||||
@ -63,3 +55,27 @@ Perl](http://strawberryperl.com/), or alternatively use a choco install command
|
||||
Additionally, the dependency `protoc-grpcio v0.3.1` is reported to have issues
|
||||
compiling in Windows. You can specify a known working version by editing
|
||||
version in `protos/Cargo.toml` section to `protoc-grpcio = "<=0.3.0"`.
|
||||
|
||||
## eth2.0-spec-tests
|
||||
|
||||
The
|
||||
[ethereum/eth2.0-spec-tests](https://github.com/ethereum/eth2.0-spec-tests/)
|
||||
repository contains a large set of tests that verify Lighthouse behaviour
|
||||
against the Ethereum Foundation specifications.
|
||||
|
||||
The `tests/ef_tests` crate runs these tests and it has some interesting
|
||||
behaviours:
|
||||
|
||||
- If the `tests/ef_tests/eth2.0-spec-tests` directory is not present, all tests
|
||||
indicate a `pass` when they did not actually run.
|
||||
- If that directory _is_ present, the tests are executed faithfully, failing if
|
||||
a discrepancy is found.
|
||||
|
||||
The `tests/ef_tests/eth2.0-spec-tests` directory is not present by default. To
|
||||
obtain it, use the Makefile in the root of the repository:
|
||||
|
||||
```
|
||||
make ef_tests
|
||||
```
|
||||
|
||||
_Note: this will download 100+ MB of test files from the [ethereum/eth2.0-spec-tests](https://github.com/ethereum/eth2.0-spec-tests/)._
|
||||
|
1
tests/ef_tests/.gitignore
vendored
Normal file
1
tests/ef_tests/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/eth2.0-spec-tests
|
@ -1 +0,0 @@
|
||||
Subproject commit ae6dd9011df05fab8c7e651c09cf9c940973bf81
|
@ -31,6 +31,11 @@ pub trait Handler {
|
||||
.join(Self::runner_name())
|
||||
.join(Self::handler_name());
|
||||
|
||||
// If the directory containing the tests does not exist, just let all tests pass.
|
||||
if !handler_path.exists() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate through test suites
|
||||
let test_cases = fs::read_dir(&handler_path)
|
||||
.expect("handler dir exists")
|
||||
|
Loading…
Reference in New Issue
Block a user