]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | #!/bin/bash |
2 | ||
3 | set -ex | |
4 | ||
5 | # Check sysroot handling | |
6 | sysroot=$(./target/debug/clippy-driver --print sysroot) | |
7 | test "$sysroot" = "$(rustc --print sysroot)" | |
8 | ||
9 | if [[ ${OS} == "Windows" ]]; then | |
10 | desired_sysroot=C:/tmp | |
11 | else | |
12 | desired_sysroot=/tmp | |
13 | fi | |
14 | sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) | |
15 | test "$sysroot" = $desired_sysroot | |
16 | ||
17 | sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) | |
18 | test "$sysroot" = $desired_sysroot | |
19 | ||
20 | # Make sure this isn't set - clippy-driver should cope without it | |
21 | unset CARGO_MANIFEST_DIR | |
22 | ||
23 | # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 | |
24 | # FIXME: How to match the clippy invocation in compile-test.rs? | |
25 | ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/double_neg.rs 2>double_neg.stderr && exit 1 | |
26 | sed -e "s,tests/ui,\$DIR," -e "/= help/d" double_neg.stderr >normalized.stderr | |
27 | diff -u normalized.stderr tests/ui/double_neg.stderr | |
28 | ||
29 | # make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same | |
30 | SYSROOT=$(rustc --print sysroot) | |
31 | diff -u <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) | |
32 | ||
33 | echo "fn main() {}" >target/driver_test.rs | |
34 | # we can't run 2 rustcs on the same file at the same time | |
35 | CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) | |
36 | RUSTC=$(rustc ./target/driver_test.rs) | |
37 | diff -u <($CLIPPY) <($RUSTC) | |
38 | ||
39 | # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR |