test: Remove all-lint.py script

This commit is contained in:
MarcoFalke 2024-01-11 14:30:28 +01:00
parent fadb06c361
commit fa2b95cf3f
No known key found for this signature in database
3 changed files with 24 additions and 43 deletions

View File

@ -16,7 +16,7 @@ result is cached and it prevents issues when the image changes.
test runner
===========
To run the checks in the test runner outside the docker, use:
To run all the lint checks in the test runner outside the docker, use:
```sh
( cd ./test/lint/test_runner/ && cargo fmt && cargo clippy && cargo run )
@ -46,12 +46,6 @@ Individual tests can be run by directly calling the test script, e.g.:
test/lint/lint-files.py
```
You can run all the shell-based lint tests by running:
```
test/lint/all-lint.py
```
check-doc.py
============
Check for missing documentation of command line options.
@ -89,7 +83,3 @@ To do so, add the upstream repository as remote:
```
git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git
```
all-lint.py
===========
Calls other scripts with the `lint-` prefix.

View File

@ -1,23 +0,0 @@
#!/usr/bin/env python3
#
# Copyright (c) 2017-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# This script runs all test/lint/lint-* files, and fails if any exit
# with a non-zero status code.
from glob import glob
from pathlib import Path
from subprocess import run
from sys import executable
exit_code = 0
mod_path = Path(__file__).parent
for lint in glob(f"{mod_path}/lint-*.py"):
result = run([executable, lint])
if result.returncode != 0:
print(f"^---- failure generated from {lint.split('/')[-1]}")
exit_code |= result.returncode
exit(exit_code)

View File

@ -3,6 +3,7 @@
// file COPYING or https://opensource.org/license/mit/.
use std::env;
use std::fs;
use std::path::PathBuf;
use std::process::Command;
use std::process::ExitCode;
@ -29,8 +30,8 @@ fn check_output(cmd: &mut std::process::Command) -> Result<String, LintError> {
}
/// Return the git root as utf8, or panic
fn get_git_root() -> String {
check_output(git().args(["rev-parse", "--show-toplevel"])).unwrap()
fn get_git_root() -> PathBuf {
PathBuf::from(check_output(git().args(["rev-parse", "--show-toplevel"])).unwrap())
}
fn lint_subtree() -> LintResult {
@ -94,11 +95,24 @@ fn lint_doc() -> LintResult {
}
fn lint_all() -> LintResult {
if Command::new("test/lint/all-lint.py")
.status()
.expect("command error")
.success()
{
let mut good = true;
let lint_dir = get_git_root().join("test/lint");
for entry in fs::read_dir(lint_dir).unwrap() {
let entry = entry.unwrap();
let entry_fn = entry.file_name().into_string().unwrap();
if entry_fn.starts_with("lint-")
&& entry_fn.ends_with(".py")
&& !Command::new("python3")
.arg(entry.path())
.status()
.expect("command error")
.success()
{
good = false;
println!("^---- failure generated from {}", entry_fn);
}
}
if good {
Ok(())
} else {
Err("".to_string())
@ -110,10 +124,10 @@ fn main() -> ExitCode {
("subtree check", lint_subtree),
("std::filesystem check", lint_std_filesystem),
("-help=1 documentation check", lint_doc),
("all-lint.py script", lint_all),
("lint-*.py scripts", lint_all),
];
let git_root = PathBuf::from(get_git_root());
let git_root = get_git_root();
let mut test_failed = false;
for (lint_name, lint_fn) in test_list {