-
Notifications
You must be signed in to change notification settings - Fork 170
/
Makefile
69 lines (58 loc) · 2.18 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Most of these targets just exist so we can avoid running clippy and rustfmt on the vendored
# fuser crate. If those tools ever get stabilized `ignore` features, or we stop vendoring, this can
# go away.
CRATES = mountpoint-s3-crt-sys mountpoint-s3-crt mountpoint-s3-client mountpoint-s3
RUST_FEATURES ?= fuse_tests
.PHONY: all
all:
cargo build --all-targets
.PHONY: release
release:
cargo build --release --all-targets
.PHONY: check
check:
cargo check --all-targets --all-features
.PHONY: test
test:
@packages=`echo "$(CRATES)" | sed -E 's/(^| )/ -p /g'`; \
cargo test $$packages
# Run a test that we know should fail if ASan is enabled
.PHONY: test-asan-working
test-asan-working:
@packages=`echo "$(CRATES)" | sed -E 's/(^| )/ -p /g'`; \
RUSTFLAGS="-Zsanitizer=address" \
RUSTC_BOOTSTRAP=1 \
cargo test -Z build-std --target `rustc -vV | grep 'host:' | cut -f2 -d' '` --features $(RUST_FEATURES) $$packages -- --ignored test_asan_working 2>&1 \
| tee /dev/stderr \
| grep "heap-use-after-free" \
&& echo "ASan is working" || (echo "ASan did not find the use-after-free; something's wrong"; exit 1)
.PHONY: test-asan
test-asan:
@packages=`echo "$(CRATES)" | sed -E 's/(^| )/ -p /g'`; \
LSAN_OPTIONS=suppressions="$$(pwd)/lsan-suppressions.txt" \
RUSTFLAGS="-Zsanitizer=address" \
RUSTC_BOOTSTRAP=1 \
cargo test -Z build-std --target `rustc -vV | grep 'host:' | cut -f2 -d' '` --features $(RUST_FEATURES) $$packages -- \
--skip reftest_ \
--skip proptest_ \
--skip fork_test \
--skip sequential_read_large
.PHONY: fmt
fmt:
@for crate in $(CRATES); do \
cargo fmt --manifest-path $$crate/Cargo.toml; \
done
.PHONY: fmt-check
fmt-check:
@fail=0; \
for crate in $(CRATES); do \
cargo fmt --manifest-path $$crate/Cargo.toml -- --check || fail=1; \
done; \
exit $$fail
DISABLED_LINTS =
DISABLED_LINTS += -A clippy::items-after-test-module # https://github.com/rust-lang/rust-clippy/issues/11153
DISABLED_LINTS += -A clippy::arc-with-non-send-sync # https://github.com/proptest-rs/proptest/issues/364
.PHONY: clippy
clippy:
@packages=`echo "$(CRATES)" | sed -E 's/(^| )/ -p /g'`; \
cargo clippy $$packages --no-deps --all-targets --all-features -- -D warnings -D clippy::all $(DISABLED_LINTS)