modified test-suite

This commit is contained in:
chonghe
2023-08-07 09:01:47 +08:00
committed by Tan Chee Keong
parent f99c03fef7
commit 2b42e2568f
3 changed files with 32 additions and 39 deletions

View File

@@ -387,3 +387,11 @@ jobs:
run: rustup override set beta
- name: Run make
run: make
cli-check:
name: cli-check
runs-on: ubuntu-latest
needs: cargo-fmt
steps:
- uses: actions/checkout@v3
- name: Run Makefile to trigger the bash script
run: make cli

View File

@@ -189,7 +189,7 @@ test: test-release
cli:
./lighthouse/scripts/cli.sh
# Runs the entire test suite, downloading test vectors if required.
test-full: cargo-fmt test-release test-debug test-ef test-exec-engine cli
test-full: cargo-fmt test-release test-debug test-ef test-exec-engine
# Lints the code for bad style and potentially unsafe arithmetic using Clippy.

View File

@@ -1,44 +1,29 @@
#! /bin/bash
# Check if a lighthouse binary exists in the current branch.
maxperf=./target/maxperf/lighthouse
release=./target/release/lighthouse
debug=./target/debug/lighthouse
#read version
read -p "Enter Lighthouse version: " version
if [[ -f "$maxperf" ]]; then
CMD="$maxperf"
elif [[ -f "$release" ]]; then
CMD="$release"
elif [[ -f "$debug" ]]; then
CMD="$debug"
else
# No binary exists, build it.
cargo build --locked
CMD="$debug"
fi
#download lighthouse binary
binary="curl -LO https://github.com/sigp/lighthouse/releases/download/v$version/lighthouse-v$version-x86_64-unknown-linux-gnu.tar.gz"
# Remove the existing help text file if it exists.
rm -f -- cli.txt
#download the binary to the present working directory
cd ./lighthouse/scripts
$binary
# Store all help strings in variables.
bn=$($CMD bn --help)
vc=$($CMD vc --help)
wallet=$($CMD a wallet --help)
#extract
tar xvf lighthouse-v$version-x86_64-unknown-linux-gnu.tar.gz
#remove
rm lighthouse-v$version-x86_64-unknown-linux-gnu.tar.gz
#outputs help text. the "&& echo >> cli.txt is to create a line space between the next output"
./lighthouse --help | tee cli.txt && echo >> cli.txt
# account manager, the -a option means append, i.e., append the output so that all outputs are in a single file
./lighthouse a --help | tee -a cli.txt && echo >> cli.txt
# subcommand under account
./lighthouse a validator --help | tee -a cli.txt && echo >> cli.txt
./lighthouse a validator modify --help | tee -a cli.txt && echo >> cli.txt
./lighthouse a validator slashing-protection --help | tee -a cli.txt && echo >> cli.txt
./lighthouse a wallet --help | tee -a cli.txt && echo >> cli.txt
# beacon node
./lighthouse bn --help | tee -a cli.txt && echo >> cli.txt
# boot-node
./lighthouse boot_node --help | tee -a cli.txt && echo >> cli.txt
# database manager
./lighthouse db --help | tee -a cli.txt && echo >> cli.txt
# validator client
./lighthouse vc --help | tee -a cli.txt && echo >> cli.txt
# remove binary file
rm lighthouse
# Print all help strings to the cli.txt file.
printf "%s\n\n" "$bn" "$vc" "$wallet" >> cli.txt