Skip to content

Commit

Permalink
Merge pull request #3499 from mulkieran/issue_project_451
Browse files Browse the repository at this point in the history
Add PROFILE_FLAGS to profileable targets
  • Loading branch information
mulkieran authored Apr 4, 2024
2 parents 7ca9385 + 8577c73 commit 922b85c
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
ifeq ($(origin PROFILE), undefined)
else
PROFILE_FLAGS = -C instrument-coverage
endif

ifeq ($(origin AUDITABLE), undefined)
BUILD = build
RUSTC = rustc
Expand Down Expand Up @@ -203,15 +208,15 @@ fmt-shell-ci:
## Build stratisd
build:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${BUILD} ${RELEASE_FLAG} \
--bin=stratisd \
${TARGET_ARGS}

## Build the stratisd test suite
build-tests:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo test --no-run ${RELEASE_FLAG} ${TARGET_ARGS}

## Build stratis-utils only
Expand All @@ -232,7 +237,7 @@ build-utils-no-systemd:
## Build stratisd-min and stratis-min for early userspace
build-min:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${BUILD} ${RELEASE_FLAG} \
--bin=stratis-min --bin=stratisd-min \
${SYSTEMD_FEATURES} ${TARGET_ARGS}
Expand All @@ -248,7 +253,7 @@ build-min-no-systemd:
## Build stratisd-min and stratis-min for early userspace
build-no-ipc:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${BUILD} ${RELEASE_FLAG} \
--bin=stratisd \
${NO_IPC_FEATURES} \
Expand All @@ -257,7 +262,7 @@ build-no-ipc:
## Build stratis-str-cmp binary
build-stratis-str-cmp:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${RUSTC} ${RELEASE_FLAG} \
--bin=stratis-str-cmp \
${UDEV_FEATURES} \
Expand All @@ -268,7 +273,7 @@ build-stratis-str-cmp:
## Build stratis-base32-decode binary
build-stratis-base32-decode:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${RUSTC} ${RELEASE_FLAG} \
--bin=stratis-base32-decode \
${UDEV_FEATURES} \
Expand All @@ -284,21 +289,21 @@ build-udev-utils: build-stratis-str-cmp build-stratis-base32-decode
## Build the stratisd-tools program
stratisd-tools:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${BUILD} ${RELEASE_FLAG} \
--bin=stratisd-tools ${EXTRAS_FEATURES} ${TARGET_ARGS}

## Build stratis-min for early userspace
stratis-min:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${BUILD} ${RELEASE_FLAG} \
--bin=stratis-min ${MIN_FEATURES} ${TARGET_ARGS}

## Build stratisd-min for early userspace
stratisd-min:
PKG_CONFIG_ALLOW_CROSS=1 \
RUSTFLAGS="${DENY}" \
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" \
cargo ${BUILD} ${RELEASE_FLAG} \
--bin=stratisd-min ${SYSTEMD_FEATURES} ${TARGET_ARGS}

Expand Down Expand Up @@ -419,55 +424,55 @@ clean: clean-cfg clean-ancillary clean-primary

## Tests with loop devices
test-loop:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test loop_ -- --skip clevis_loop_
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test loop_ -- --skip clevis_loop_

## Tests run under valgrind with loop devices
test-loop-valgrind:
RUST_TEST_THREADS=1 sudo -E valgrind --leak-check=full --num-callers=500 $(shell RUSTFLAGS="${DENY}" cargo test --no-run --all-features --message-format=json 2>/dev/null | jq -r 'select(.target.src_path == "'${PWD}/src/lib.rs'") | select(.executable != null) | .executable') loop_ --skip real_ --skip clevis_

## Tests with real devices
test-real:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test real_ -- --skip clevis_real_
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test real_ -- --skip clevis_real_

## Basic tests
test:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 cargo test --all-features -- --skip real_ --skip loop_ --skip clevis_ --skip test_stratis_min_ --skip test_stratisd_min_
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 cargo test --all-features -- --skip real_ --skip loop_ --skip clevis_ --skip test_stratis_min_ --skip test_stratisd_min_

## Basic tests run under valgrind
test-valgrind:
RUST_TEST_THREADS=1 valgrind --leak-check=full --num-callers=500 $(shell RUSTFLAGS="${DENY}" cargo test --no-run --all-features --message-format=json 2>/dev/null | jq -r 'select(.target.src_path == "'${PWD}/src/lib.rs'") | select(.executable != null) | .executable') --skip real_ --skip loop_ --skip clevis_

## Clevis tests with real devices
test-clevis-real:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_real_ -- --skip clevis_real_should_fail
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_real_ -- --skip clevis_real_should_fail

## Clevis real device tests that are expected to fail
test-clevis-real-should-fail:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_real_should_fail
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_real_should_fail

## Clevis tests with loop devices
test-clevis-loop:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_loop_ -- --skip clevis_loop_should_fail_
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_loop_ -- --skip clevis_loop_should_fail_

## Clevis tests with loop devices with valgrind
test-clevis-loop-valgrind:
RUST_TEST_THREADS=1 sudo -E valgrind --leak-check=full --num-callers=500 $(shell RUSTFLAGS="${DENY}" cargo test --no-run --all-features --message-format=json 2>/dev/null | jq -r 'select(.target.src_path == "'${PWD}/src/lib.rs'") | select(.executable != null) | .executable') clevis_loop_ --skip clevis_loop_should_fail_

## Clevis loop device tests that are expected to fail
test-clevis-loop-should-fail:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_loop_should_fail_
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test clevis_loop_should_fail_

## Clevis loop device tests that are expected to fail run under valgrind
test-clevis-loop-should-fail-valgrind:
RUST_TEST_THREADS=1 sudo -E valgrind --leak-check=full --num-callers=500 $(shell RUSTFLAGS="${DENY}" cargo test --no-run --all-features --message-format=json 2>/dev/null | jq -r 'select(.target.src_path == "'${PWD}/src/lib.rs'") | select(.executable != null) | .executable') clevis_loop_should_fail_

## Test stratisd-min CLI
test-stratisd-min:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --no-default-features --features "engine,min" test_stratisd_min
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --no-default-features --features "engine,min" test_stratisd_min

## Test stratis-min CLI
test-stratis-min:
RUSTFLAGS="${DENY}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --no-default-features --features "engine,min" test_stratis_min
RUSTFLAGS="${DENY} ${PROFILE_FLAGS}" RUST_BACKTRACE=1 RUST_TEST_THREADS=1 CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --no-default-features --features "engine,min" test_stratis_min

## Run yamllint on workflow files
yamllint:
Expand Down

0 comments on commit 922b85c

Please sign in to comment.