Files
cgroups-rs/Makefile
Xuewei Niu c774e9e123 manager: Add unit test cases
The tests cover the methods of `conv` mod, `FsManager`, and
`SystemdManager`. Since we have to manipulate the cgroups during testing,
the tests related to this part are set to be run in sequence.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2025-07-18 15:17:12 +08:00

66 lines
1.3 KiB
Makefile

all: debug fmt test
#
# Build
#
.PHONY: debug
debug:
RUSTFLAGS="--deny warnings" cargo build
.PHONY: release
release:
cargo build --release
.PHONY: build
build: debug
#
# Tests and linters
#
# Tests that manipulate cgroups should run in sequence, so that
# `--test-threads=1` is used.
test: test-systemd test-fs-manager test-systemd-manager
cargo test --all-features -- --color always \
--nocapture \
--skip systemd::dbus::client::tests \
--skip manager::fs::tests \
--skip manager::systemd::tests
.PHONY: test-systemd
# Tests that manipulate cgroups should run in sequence, so that
# `--test-threads=1` is used.
test-systemd:
cargo test --package cgroups-rs --lib \
-- systemd::dbus::client::tests \
--color always --nocapture \
--test-threads=1
.PHONY: test-fs-manager
# See test-systemd
test-fs-manager:
cargo test --all-features --package cgroups-rs \
--lib -- manager::fs::tests \
--color always --nocapture --test-threads=1
.PHONY: test-systemd-manager
# See test-systemd
test-systemd-manager:
cargo test --all-features --package cgroups-rs \
--lib -- manager::systemd::tests \
--color always --nocapture --test-threads=1
.PHONY: check
check: fmt clippy
.PHONY: fmt
fmt:
cargo fmt --all -- --check
.PHONY: clippy
clippy:
cargo clippy --all-targets --all-features -- -D warnings