]> git.lizzy.rs Git - rust.git/blob - ci/base-tests.sh
Add tests for lossy whole number float literals
[rust.git] / ci / base-tests.sh
1 #!/usr/bin/env bash
2 set -ex
3
4 echo "Running clippy base tests"
5
6 PATH=$PATH:./node_modules/.bin
7 if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
8   remark -f ./*.md -f doc/*.md > /dev/null
9 fi
10 # build clippy in debug mode and run tests
11 cargo build --features deny-warnings
12 cargo test --features deny-warnings
13
14 (cd clippy_lints && cargo test --features deny-warnings)
15 (cd rustc_tools_util && cargo test --features deny-warnings)
16 (cd clippy_dev && cargo test --features deny-warnings)
17
18 # make sure clippy can be called via ./path/to/cargo-clippy
19 (
20   cd clippy_workspace_tests
21   ../target/debug/cargo-clippy
22 )
23
24 # Perform various checks for lint registration
25 cargo dev update_lints --check
26 cargo dev --limit-stderr-length
27
28 # Check running clippy-driver without cargo
29 (
30   # Check sysroot handling
31   sysroot=$(./target/debug/clippy-driver --print sysroot)
32   test "$sysroot" = "$(rustc --print sysroot)"
33
34   if [[ -z "$OS_WINDOWS" ]]; then
35     desired_sysroot=/tmp
36   else
37     desired_sysroot=C:/tmp
38   fi
39   sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
40   test "$sysroot" = $desired_sysroot
41
42   sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
43   test "$sysroot" = $desired_sysroot
44
45   # Make sure this isn't set - clippy-driver should cope without it
46   unset CARGO_MANIFEST_DIR
47
48   # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
49   # FIXME: How to match the clippy invocation in compile-test.rs?
50   ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1
51   sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr
52   diff normalized.stderr tests/ui/cstring.stderr
53
54   # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR
55 )