# Verify that individual crates build with various feature combinations # # re: https://github.com/tikv/tikv/issues/9406 # # TiKV has several compile time features that are threaded through the # dependency tree. It is common that the features are not configured correctly, # causing individual crates to not build on their own. This script goes through # each individual crate and runs `cargo check -p` and `cargo test -p --no-run` # on them using their default feature sets. # # Requires Python 3.6+ import os import subprocess import sys components = [f for f in os.listdir("components") if os.path.isdir(f"components/{f}")] other_crates = [ ("cmd", "cmd"), ("tests", "tests"), ("tikv", "./"), ] components_with_dirs = [(x, f"components/{x}") for x in components] crates = components_with_dirs + other_crates errors = [] def cargo_check_default(): cargo_run_default("check", []) def cargo_test_default(): cargo_run_default("test", ["--no-run"]) def cargo_run_default(cmd, extra_args): for (crate, _) in crates: args = ["cargo", cmd, "-p", crate] args += extra_args run_and_collect_errors(args) def run_and_collect_errors(args): global errors joined_args = " ".join(args) print(f"running `{joined_args}`") res = subprocess.run(args) if res.returncode != 0: errors += [joined_args] print() cargo_check_default() cargo_test_default() if len(errors) == 0: sys.exit(0) print() print("errors:") for error in errors: print(f" {error}") print() sys.exit(1)