diff --git a/Makefile b/Makefile index aea4ecfb980..bfba0a733a1 100644 --- a/Makefile +++ b/Makefile @@ -215,7 +215,8 @@ docker-tag-with-git-tag: # Run tests under a variety of conditions. This should pass before # submitting pull requests. Note though that the CI system tests TiKV # through its own scripts and does not use this rule. -test: +.PHONY: run-test +run-test: # 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. # The special linux case below is testing the mem-profiling @@ -227,31 +228,15 @@ test: export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:${LOCAL_DIR}/lib" && \ export LOG_LEVEL=DEBUG && \ export RUST_BACKTRACE=1 && \ - cargo test --no-default-features --features "${ENABLE_FEATURES}" --all --exclude tests --exclude \ - cdc --exclude fuzz-targets --exclude fuzzer-honggfuzz --exclude fuzzer-afl --exclude fuzzer-libfuzzer \ - ${EXTRA_CARGO_ARGS} -- --nocapture && \ - cd tests && cargo test --features "${ENABLE_FEATURES}" ${EXTRA_CARGO_ARGS} -- --nocapture && cd .. && \ - cargo test --no-default-features --features "${ENABLE_FEATURES}" -p tests --bench misc ${EXTRA_CARGO_ARGS} -- --nocapture && \ - cd components/cdc && cargo test --no-default-features --features "${ENABLE_FEATURES}" -p cdc ${EXTRA_CARGO_ARGS} -- --nocapture && cd ../.. && \ - cd components/cdc && cargo test --no-default-features --features "${ENABLE_FEATURES}" ${EXTRA_CARGO_ARGS} -- --nocapture && cd ../.. && \ + cargo test --workspace --features "${ENABLE_FEATURES} mem-profiling" ${EXTRA_CARGO_ARGS} -- --nocapture && \ if [[ "`uname`" == "Linux" ]]; then \ export MALLOC_CONF=prof:true,prof_active:false && \ - cargo test --no-default-features --features "${ENABLE_FEATURES},mem-profiling" ${EXTRA_CARGO_ARGS} --bin tikv-server -- --nocapture --ignored; \ + cargo test --features "${ENABLE_FEATURES} mem-profiling" ${EXTRA_CARGO_ARGS} -p tikv_alloc -- --nocapture --ignored; \ fi - bash scripts/check-bins-for-jemalloc.sh - bash scripts/check-udeps.sh - -# This is used for CI test -ci_test: ci_doc_test - cargo test --no-default-features --features "${ENABLE_FEATURES}" --all --exclude tests --exclude cdc \ - --exclude fuzz-targets --exclude fuzzer-honggfuzz --exclude fuzzer-afl --exclude fuzzer-libfuzzer \ - --all-targets --no-run --message-format=json - cd tests && cargo test --no-default-features --features "${ENABLE_FEATURES}" --no-run --message-format=json - cd components/cdc && cargo test --no-default-features --features "${ENABLE_FEATURES}" --no-run --message-format=json -ci_doc_test: - cargo test --no-default-features --features "${ENABLE_FEATURES}" --all --exclude tests --exclude cdc \ - --exclude fuzz-targets --exclude fuzzer-honggfuzz --exclude fuzzer-afl --exclude fuzzer-libfuzzer --doc +.PHONY: test +test: run-test + bash scripts/check-bins-for-jemalloc.sh ## Static analysis ## --------------- @@ -308,6 +293,10 @@ pre-audit: audit: pre-audit cargo audit +.PHONY: check-udeps +check-udeps: + bash scripts/check-udeps.sh + FUZZER ?= Honggfuzz .PHONY: fuzz diff --git a/components/sst_importer/src/sst_importer.rs b/components/sst_importer/src/sst_importer.rs index 9faba0ecbc3..fb97e287698 100644 --- a/components/sst_importer/src/sst_importer.rs +++ b/components/sst_importer/src/sst_importer.rs @@ -917,8 +917,6 @@ mod tests { .unwrap() .unwrap(); - dbg!(&range); - assert_eq!(range.get_start(), b"t123_r01"); assert_eq!(range.get_end(), b"t123_r13"); diff --git a/components/tikv_alloc/src/jemalloc.rs b/components/tikv_alloc/src/jemalloc.rs index d87f0f573f1..5bfab8b4def 100644 --- a/components/tikv_alloc/src/jemalloc.rs +++ b/components/tikv_alloc/src/jemalloc.rs @@ -161,11 +161,11 @@ mod profiling { let os_path = dir.path().to_path_buf().join("test1.dump").into_os_string(); let path = os_path.into_string().unwrap(); - super::dump_prof(&path); + super::dump_prof(&path).unwrap(); let os_path = dir.path().to_path_buf().join("test2.dump").into_os_string(); let path = os_path.into_string().unwrap(); - super::dump_prof(&path); + super::dump_prof(&path).unwrap(); let files = fs::read_dir(dir.path()).unwrap().count(); assert_eq!(files, 2); diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 0cc0b75d222..048ff3ca70f 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -32,6 +32,7 @@ path = "benches/hierarchy/mod.rs" [[bench]] name = "misc" path = "benches/misc/mod.rs" +test = true [[bench]] name = "deadlock_detector" @@ -41,9 +42,10 @@ path = "benches/deadlock_detector/mod.rs" [[bench]] name = "channel" path = "benches/channel/mod.rs" +test = true [features] -default = ["failpoints", "testexport"] +default = ["failpoints", "testexport", "protobuf-codec"] failpoints = ["fail/failpoints", "tikv/failpoints"] testexport = ["raftstore/testexport", "tikv/testexport"] profiling = ["profiler/profiling"]