Skip to content

Commit f0131fb

Browse files
committed
Add a CI test for cargoless use of clippy-driver
1 parent b07f1b0 commit f0131fb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

ci/base-tests.sh

+25
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,31 @@ export CARGO_TARGET_DIR=`pwd`/target/
2525
./util/dev update_lints --check
2626
cargo +nightly fmt --all -- --check
2727

28+
# Check running clippy-driver without cargo
29+
(
30+
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
31+
32+
# Check sysroot handling
33+
sysroot=$(./target/debug/clippy-driver --print sysroot)
34+
test $sysroot = $(rustc --print sysroot)
35+
36+
sysroot=$(./target/debug/clippy-driver --sysroot /tmp --print sysroot)
37+
test $sysroot = /tmp
38+
39+
sysroot=$(SYSROOT=/tmp ./target/debug/clippy-driver --print sysroot)
40+
test $sysroot = /tmp
41+
42+
# Make sure this isn't set - clippy-driver should cope without it
43+
unset CARGO_MANIFEST_DIR
44+
45+
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
46+
# XXX How to match the clippy invocation in compile-test.rs?
47+
! ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr
48+
diff <(sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr) tests/ui/cstring.stderr
49+
50+
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR
51+
)
52+
2853
# make sure tests are formatted
2954

3055
# some lints are sensitive to formatting, exclude some files

0 commit comments

Comments
 (0)