move testfiles to "lintcheck" and fix more paths

This commit is contained in:
Matthias Krüger 2021-03-09 14:40:59 +01:00
parent c760150989
commit fac6da1cfb
4 changed files with 14 additions and 60 deletions

View File

@ -1,7 +1,7 @@
[alias]
uitest = "test --test compile-test"
dev = "run --target-dir clippy_dev/target --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
dev-lintcheck = "run --target-dir lintcheck/target --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
lintcheck = "run --target-dir lintcheck/target --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
[build]
rustflags = ["-Zunstable-options"]

View File

@ -1,35 +0,0 @@
[crates]
# some of these are from cargotest
cargo = {name = "cargo", versions = ['0.49.0']}
iron = {name = "iron", versions = ['0.6.1']}
ripgrep = {name = "ripgrep", versions = ['12.1.1']}
xsv = {name = "xsv", versions = ['0.13.0']}
# commented out because of 173K clippy::match_same_arms msgs in language_type.rs
#tokei = { name = "tokei", versions = ['12.0.4']}
rayon = {name = "rayon", versions = ['1.5.0']}
serde = {name = "serde", versions = ['1.0.118']}
# top 10 crates.io dls
bitflags = {name = "bitflags", versions = ['1.2.1']}
# crash = {name = "clippy_crash", path = "/tmp/clippy_crash"}
libc = {name = "libc", versions = ['0.2.81']}
log = {name = "log", versions = ['0.4.11']}
proc-macro2 = {name = "proc-macro2", versions = ['1.0.24']}
quote = {name = "quote", versions = ['1.0.7']}
rand = {name = "rand", versions = ['0.7.3']}
rand_core = {name = "rand_core", versions = ['0.6.0']}
regex = {name = "regex", versions = ['1.3.2']}
syn = {name = "syn", versions = ['1.0.54']}
unicode-xid = {name = "unicode-xid", versions = ['0.2.1']}
# some more of dtolnays crates
anyhow = {name = "anyhow", versions = ['1.0.38']}
async-trait = {name = "async-trait", versions = ['0.1.42']}
cxx = {name = "cxx", versions = ['1.0.32']}
ryu = {name = "ryu", version = ['1.0.5']}
serde_yaml = {name = "serde_yaml", versions = ['0.8.17']}
thiserror = {name = "thiserror", versions = ['1.0.24']}
# some embark crates, there are other interesting crates but
# unfortunately adding them increases lintcheck runtime drastically
cfg-expr = {name = "cfg-expr", versions = ['0.7.1']}
puffin = {name = "puffin", git_url = "https://github.com/EmbarkStudios/puffin", git_hash = "02dd4a3"}
rpmalloc = {name = "rpmalloc", versions = ['0.2.0']}
tame-oidc = {name = "tame-oidc", versions = ['0.1.0']}

View File

@ -16,7 +16,7 @@ use std::{
path::{Path, PathBuf},
};
use clap::{App, Arg, ArgMatches, SubCommand};
use clap::{App, Arg, ArgMatches};
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use serde_json::Value;
@ -337,12 +337,12 @@ impl LintcheckConfig {
fn from_clap(clap_config: &ArgMatches) -> Self {
// first, check if we got anything passed via the LINTCHECK_TOML env var,
// if not, ask clap if we got any value for --crates-toml <foo>
// if not, use the default "clippy_dev/lintcheck_crates.toml"
// if not, use the default "lintcheck/lintcheck_crates.toml"
let sources_toml = env::var("LINTCHECK_TOML").unwrap_or_else(|_| {
clap_config
.value_of("crates-toml")
.clone()
.unwrap_or("clippy_dev/lintcheck_crates.toml")
.unwrap_or("lintcheck/lintcheck_crates.toml")
.to_string()
});
@ -576,7 +576,7 @@ fn is_in_clippy_root() -> bool {
pub fn main() {
// assert that we launch lintcheck from the repo root (via cargo dev-lintcheck)
if !is_in_clippy_root() {
eprintln!("lintcheck needs to be run from clippys repo root!\nUse `cargo dev-lintcheck` alternatively.");
eprintln!("lintcheck needs to be run from clippys repo root!\nUse `cargo lintcheck` alternatively.");
std::process::exit(3);
}
@ -638,7 +638,7 @@ pub fn main() {
name == only_one_crate
}) {
eprintln!(
"ERROR: could not find crate '{}' in clippy_dev/lintcheck_crates.toml",
"ERROR: could not find crate '{}' in lintcheck/lintcheck_crates.toml",
only_one_crate
);
std::process::exit(1);
@ -818,7 +818,7 @@ fn create_dirs(krate_download_dir: &Path, extract_dir: &Path) {
}
fn get_clap_config<'a>() -> ArgMatches<'a> {
let lintcheck_sbcmd = SubCommand::with_name("lintcheck")
App::new("lintcheck")
.about("run clippy on a set of crates and check output")
.arg(
Arg::with_name("only")
@ -842,13 +842,8 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
.long("jobs")
.help("number of threads to use, 0 automatic choice"),
)
.arg(Arg::with_name("fix").help("runs cargo clippy --fix and checks if all suggestions apply"));
let app = App::new("Clippy developer tooling");
let app = app.subcommand(lintcheck_sbcmd);
app.get_matches()
.arg(Arg::with_name("fix").help("runs cargo clippy --fix and checks if all suggestions apply"))
.get_matches()
}
/// Returns the path to the Clippy project directory
@ -881,24 +876,18 @@ fn lintcheck_test() {
let args = [
"run",
"--target-dir",
"clippy_dev/target",
"--package",
"clippy_dev",
"--bin",
"clippy_dev",
"lintcheck/target",
"--manifest-path",
"clippy_dev/Cargo.toml",
"--features",
"lintcheck",
"./lintcheck/Cargo.toml",
"--",
"lintcheck",
"--crates-toml",
"clippy_dev/test_sources.toml",
"lintcheck/test_sources.toml",
];
let status = std::process::Command::new("cargo")
.args(&args)
.current_dir("../" /* repo root */)
.current_dir("..") // repo root
.status();
//.output();
assert!(status.unwrap().success());
}