process_lfs.sh: better verbosity handling

This commit is contained in:
Ștefan Talpalaru 2019-08-24 03:54:04 +02:00
parent a19734e47f
commit 5dc6f60b08
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
2 changed files with 7 additions and 2 deletions

View File

@ -63,7 +63,7 @@ p2pd: | go-checks
DISABLE_LFS_SCRIPT := 0 DISABLE_LFS_SCRIPT := 0
test: | build deps nat-libs p2pd test: | build deps nat-libs p2pd
ifeq ($(DISABLE_LFS_SCRIPT), 0) ifeq ($(DISABLE_LFS_SCRIPT), 0)
scripts/process_lfs.sh $(HANDLE_OUTPUT) V=$(V) scripts/process_lfs.sh
endif endif
$(ENV_SCRIPT) nim test $(NIM_PARAMS) beacon_chain.nims && rm -f 0000-*.json $(ENV_SCRIPT) nim test $(NIM_PARAMS) beacon_chain.nims && rm -f 0000-*.json

View File

@ -13,6 +13,9 @@ ARCHIVE_NAME="json_tests.tar.xz"
TMP_CACHE_DIR="tmpcache" TMP_CACHE_DIR="tmpcache"
SUBREPO_DIR="tests/official/fixtures" SUBREPO_DIR="tests/official/fixtures"
LFS_DIR="json_tests" LFS_DIR="json_tests"
# verbosity level
[[ -z "$V" ]] && V=0
[[ -z "$BUILD_MSG" ]] && BUILD_MSG="Downloading LFS files"
CACHE_DIR="$1" # optional parameter pointing to a CI cache dir. Without it, we just download the LFS files for a local `make test`. CACHE_DIR="$1" # optional parameter pointing to a CI cache dir. Without it, we just download the LFS files for a local `make test`.
[[ -d "${SUBREPO_DIR}" ]] || { echo "This script should be run from the \"nim-beacon-chain\" repo top dir."; exit 1; } [[ -d "${SUBREPO_DIR}" ]] || { echo "This script should be run from the \"nim-beacon-chain\" repo top dir."; exit 1; }
@ -33,7 +36,9 @@ which 7z &>/dev/null && { DECOMPRESS_XZ="7z e -txz -bd -so"; COMPRESS_XZ="7z a -
which xz &>/dev/null && { DECOMPRESS_XZ="xz -d -c -T 0"; COMPRESS_XZ="xz -c -T 0"; } which xz &>/dev/null && { DECOMPRESS_XZ="xz -d -c -T 0"; COMPRESS_XZ="xz -c -T 0"; }
download_lfs_files() { download_lfs_files() {
echo "Downloading LFS files." echo -e "$BUILD_MSG"
[[ "$V" == "0" ]] && exec &>/dev/null
pushd "${SUBREPO_DIR}" pushd "${SUBREPO_DIR}"
git lfs install # redundant after running it once per repo, but fast enough not to worry about detecting whether it ran before git lfs install # redundant after running it once per repo, but fast enough not to worry about detecting whether it ran before
git lfs pull -I "${LFS_DIR}" # we just care about test fixtures converted from YAML to JSON git lfs pull -I "${LFS_DIR}" # we just care about test fixtures converted from YAML to JSON