-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: organize for faster and more flexible dev workflows (tikv#8777
- Loading branch information
Greg Weber
authored
Oct 15, 2020
1 parent
e6d5b6d
commit 4dc97df
Showing
7 changed files
with
157 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
# This script runs clippy with the most common configurations. | ||
# Arguments given will be passed through to "cargo clippy" | ||
# This runs in the Makefile environment via "make run" | ||
|
||
set -euo pipefail | ||
|
||
# Run from the Makefile environment | ||
MAKEFILE_RUN=${MAKEFILE_RUN:-""} | ||
if [[ -z $MAKEFILE_RUN ]] ; then | ||
COMMAND="$0 $*" exec make run | ||
fi | ||
|
||
ALLOWED_CLIPPY_LINTS=(-A clippy::module_inception -A clippy::needless_pass_by_value -A clippy::cognitive_complexity \ | ||
-A clippy::unreadable_literal -A clippy::should_implement_trait -A clippy::verbose_bit_mask \ | ||
-A clippy::implicit_hasher -A clippy::large_enum_variant -A clippy::new_without_default \ | ||
-A clippy::neg_cmp_op_on_partial_ord -A clippy::too_many_arguments \ | ||
-A clippy::excessive_precision -A clippy::collapsible_if -A clippy::blacklisted_name \ | ||
-A clippy::needless_range_loop -A clippy::redundant_closure \ | ||
-A clippy::match_wild_err_arm -A clippy::blacklisted_name -A clippy::redundant_closure_call \ | ||
-A clippy::useless_conversion -A clippy::new_ret_no_self -A clippy::unnecessary_sort_by) | ||
|
||
if [[ "${TIKV_ENABLE_FEATURES}" == *prost-codec* ]] ; then | ||
cargo clippy --workspace --all-targets --no-default-features \ | ||
--exclude cdc --exclude backup --exclude tests --exclude cmd \ | ||
--exclude fuzz-targets --exclude fuzzer-honggfuzz --exclude fuzzer-afl --exclude fuzzer-libfuzzer \ | ||
--features "${TIKV_ENABLE_FEATURES}" -- "${ALLOWED_CLIPPY_LINTS[@]}" | ||
for pkg in "components/cdc" "components/backup" "cmd" "tests"; do | ||
cd $pkg | ||
cargo clippy --all-targets --no-default-features \ | ||
--features "${TIKV_ENABLE_FEATURES}" -- "${ALLOWED_CLIPPY_LINTS[@]}" | ||
cd - >/dev/null | ||
done | ||
for pkg in "fuzz"; do | ||
cd $pkg | ||
cargo clippy --all-targets -- "${ALLOWED_CLIPPY_LINTS[@]}" | ||
cd - >/dev/null | ||
done | ||
else | ||
cargo clippy --workspace \ | ||
--exclude fuzzer-honggfuzz --exclude fuzzer-afl --exclude fuzzer-libfuzzer \ | ||
--features "${TIKV_ENABLE_FEATURES}" -- "${ALLOWED_CLIPPY_LINTS[@]}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
# This script runs the arguments given in the environment setup by the Makefile | ||
|
||
set -euo pipefail | ||
COMMAND="$*" exec make run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
# This script runs cargo test with the most common testing configurations. | ||
# Arguments given will be passed through to "cargo test" | ||
# This runs in the Makefile environment via "make run" | ||
|
||
set -euo pipefail | ||
|
||
# Run from the Makefile environment | ||
MAKEFILE_RUN=${MAKEFILE_RUN:-""} | ||
if [[ -z $MAKEFILE_RUN ]] ; then | ||
COMMAND="$0 $*" exec make run | ||
fi | ||
SHELL_DEBUG=${SHELL_DEBUG:-""} | ||
if [[ -n "$SHELL_DEBUG" ]] ; then | ||
set -x | ||
fi | ||
|
||
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:-""} | ||
LOCAL_DIR=${LOCAL_DIR:-""} | ||
TIKV_ENABLE_FEATURES=${TIKV_ENABLE_FEATURES:-""} | ||
# EXTRA_CARGO_ARGS is unecessary now: this can just be given as arguments to ./scripts/test-all or ./scripts/test | ||
EXTRA_CARGO_ARGS=${EXTRA_CARGO_ARGS:-""} | ||
|
||
# When SIP is enabled, DYLD_LIBRARY_PATH will not work in subshell, so we have to set it | ||
# again here. LOCAL_DIR is defined in .travis.yml. | ||
export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${LOCAL_DIR}/lib" | ||
export LOG_LEVEL=DEBUG | ||
export RUST_BACKTRACE=1 | ||
|
||
cargo -Zpackage-features test --workspace \ | ||
--exclude fuzzer-honggfuzz --exclude fuzzer-afl --exclude fuzzer-libfuzzer \ | ||
--features "${TIKV_ENABLE_FEATURES}" ${EXTRA_CARGO_ARGS} "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
# This script runs all the tests under a variety of conditions. | ||
# This should pass before submitting pull requests. | ||
# Arguments given will be passed through to "cargo test" | ||
# This runs in the Makefile environment via "make run" | ||
|
||
set -euo pipefail | ||
|
||
# Run from the Makefile environment | ||
MAKEFILE_RUN=${MAKEFILE_RUN:-""} | ||
if [[ -z $MAKEFILE_RUN ]] ; then | ||
COMMAND="$0 $*" exec make run | ||
fi | ||
|
||
./scripts/test "$@" -- --nocapture | ||
# The special Linux case below is testing the mem-profiling | ||
# features in tikv_alloc, which are marked #[ignore] since | ||
# they require special compile-time and run-time setup | ||
# Fortunately rebuilding with the mem-profiling feature will only | ||
# rebuild starting at jemalloc-sys. | ||
if [[ "$(uname)" == "Linux" ]]; then | ||
export MALLOC_CONF=prof:true,prof_active:false | ||
./scripts/test -p tikv -p tikv_alloc --lib "$@" -- --nocapture --ignored | ||
fi | ||
|
||
if [[ "$(uname)" = "Linux" ]]; then | ||
EXTRA_CARGO_ARGS="" ./scripts/test --message-format=json-render-diagnostics -q --no-run -- --nocapture | | ||
python scripts/check-bins.py --features "${TIKV_ENABLE_FEATURES}" --check-tests | ||
fi |