aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-11-13 16:54:20 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-11-13 18:08:10 +0100
commitfaff3e3b4604519375e122c103b156ec13eef80f (patch)
treea92095f5d674d46b934a2122b4d076b716db2b28
parentd232e36abdb1a4f01787766a758051c16940b0c5 (diff)
downloadbitcoin-faff3e3b4604519375e122c103b156ec13eef80f.tar.xz
lint: Report all lint errors instead of early exit
-rwxr-xr-xci/lint/06_script.sh9
-rw-r--r--test/lint/test_runner/src/main.rs61
2 files changed, 58 insertions, 12 deletions
diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh
index af7a517930..318b2bb819 100755
--- a/ci/lint/06_script.sh
+++ b/ci/lint/06_script.sh
@@ -23,16 +23,7 @@ else
fi
export COMMIT_RANGE
-# This only checks that the trees are pure subtrees, it is not doing a full
-# check with -r to not have to fetch all the remotes.
-test/lint/git-subtree-check.sh src/crypto/ctaes
-test/lint/git-subtree-check.sh src/secp256k1
-test/lint/git-subtree-check.sh src/minisketch
-test/lint/git-subtree-check.sh src/leveldb
-test/lint/git-subtree-check.sh src/crc32c
RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner"
-test/lint/check-doc.py
-test/lint/all-lint.py
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then
# Sanity check only the last few commits to get notified of missing sigs,
diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs
index b7ec9ee3b2..ce94c3b628 100644
--- a/test/lint/test_runner/src/main.rs
+++ b/test/lint/test_runner/src/main.rs
@@ -7,7 +7,9 @@ use std::path::PathBuf;
use std::process::Command;
use std::process::ExitCode;
-use String as LintError;
+type LintError = String;
+type LintResult = Result<(), LintError>;
+type LintFn = fn() -> LintResult;
/// Return the git command
fn git() -> Command {
@@ -31,7 +33,31 @@ fn get_git_root() -> String {
check_output(git().args(["rev-parse", "--show-toplevel"])).unwrap()
}
-fn lint_std_filesystem() -> Result<(), LintError> {
+fn lint_subtree() -> LintResult {
+ // This only checks that the trees are pure subtrees, it is not doing a full
+ // check with -r to not have to fetch all the remotes.
+ let mut good = true;
+ for subtree in [
+ "src/crypto/ctaes",
+ "src/secp256k1",
+ "src/minisketch",
+ "src/leveldb",
+ "src/crc32c",
+ ] {
+ good &= Command::new("test/lint/git-subtree-check.sh")
+ .arg(subtree)
+ .status()
+ .expect("command_error")
+ .success();
+ }
+ if good {
+ Ok(())
+ } else {
+ Err("".to_string())
+ }
+}
+
+fn lint_std_filesystem() -> LintResult {
let found = git()
.args([
"grep",
@@ -55,8 +81,37 @@ fs:: namespace, which has unsafe filesystem functions marked as deleted.
}
}
+fn lint_doc() -> LintResult {
+ if Command::new("test/lint/check-doc.py")
+ .status()
+ .expect("command error")
+ .success()
+ {
+ Ok(())
+ } else {
+ Err("".to_string())
+ }
+}
+
+fn lint_all() -> LintResult {
+ if Command::new("test/lint/all-lint.py")
+ .status()
+ .expect("command error")
+ .success()
+ {
+ Ok(())
+ } else {
+ Err("".to_string())
+ }
+}
+
fn main() -> ExitCode {
- let test_list = [("std::filesystem check", lint_std_filesystem)];
+ let test_list: Vec<(&str, LintFn)> = vec![
+ ("subtree check", lint_subtree),
+ ("std::filesystem check", lint_std_filesystem),
+ ("-help=1 documentation check", lint_doc),
+ ("all-lint.py script", lint_all),
+ ];
let git_root = PathBuf::from(get_git_root());