From fdb24f09bf386a2a6dc4be0b42aa32b9ad92acd3 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 13 Nov 2023 19:39:50 -0500 Subject: [PATCH 1/2] .gitignore: exclude files from profiling Signed-off-by: mulhern --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f4b92ce7..c01bd29d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ Cargo.lock *.bk *.swo *.swp + +*.profraw +*.profdata From 2f1aed03276adfb7f2ab6b0415d75ba844093737 Mon Sep 17 00:00:00 2001 From: mulhern Date: Mon, 13 Nov 2023 14:18:11 -0500 Subject: [PATCH 2/2] Add PROFILE_FLAGS to profileable targets Signed-off-by: mulhern --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4f0088e3..1d792d18 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +ifeq ($(origin PROFILE), undefined) +else + PROFILE_FLAGS = -C instrument-coverage +endif + ifeq ($(origin FEDORA_RELEASE), undefined) else FEDORA_RELEASE_ARGS = --release=${FEDORA_RELEASE} @@ -41,16 +46,16 @@ fmt-ci: cd devicemapper-rs-sys && cargo fmt -- --check build: - cargo ${BUILD} + RUSTLFLAGS="${PROFILE_FLAGS}" cargo ${BUILD} build-tests: - cargo ${TEST} --no-run + RUSTFLAGS="${PROFILE_FLAGS}" cargo ${TEST} --no-run test: - RUST_BACKTRACE=1 cargo test -- --skip sudo_ --skip loop_ + RUSTFLAGS="${PROFILE_FLAGS}" RUST_BACKTRACE=1 cargo ${TEST} -- --skip sudo_ --skip loop_ sudo_test: - RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test + RUSTFLAGS="${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo ${TEST} clippy: cargo clippy --all-features ${CLIPPY_OPTS}