]>
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 | ||
f25598a0 FG |
20 | # Check that the --sysroot argument is only passed once (SYSROOT is ignored) |
21 | ( | |
22 | cd rustc_tools_util | |
23 | touch src/lib.rs | |
24 | SYSROOT=/tmp RUSTFLAGS="--sysroot=$(rustc --print sysroot)" ../target/debug/cargo-clippy clippy --verbose | |
25 | ) | |
26 | ||
f20569fa XL |
27 | # Make sure this isn't set - clippy-driver should cope without it |
28 | unset CARGO_MANIFEST_DIR | |
29 | ||
30 | # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 | |
31 | # FIXME: How to match the clippy invocation in compile-test.rs? | |
32 | ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/double_neg.rs 2>double_neg.stderr && exit 1 | |
33 | sed -e "s,tests/ui,\$DIR," -e "/= help/d" double_neg.stderr >normalized.stderr | |
34 | diff -u normalized.stderr tests/ui/double_neg.stderr | |
35 | ||
36 | # make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same | |
37 | SYSROOT=$(rustc --print sysroot) | |
38 | diff -u <(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver --rustc --version --verbose) <(rustc --version --verbose) | |
39 | ||
40 | echo "fn main() {}" >target/driver_test.rs | |
41 | # we can't run 2 rustcs on the same file at the same time | |
42 | CLIPPY=$(LD_LIBRARY_PATH=${SYSROOT}/lib ./target/debug/clippy-driver ./target/driver_test.rs --rustc) | |
43 | RUSTC=$(rustc ./target/driver_test.rs) | |
44 | diff -u <($CLIPPY) <($RUSTC) | |
45 | ||
46 | # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR |