* cton-util: fix some clippy unnecessary pass-by-value warnings * clippy: ignore too many arguments / cyclomatic complexity in module since these functions are taking args coming from the command line, i dont think this is actually a valid lint, morally the arguments are all from one structure * cton-util: take care of remaining clippy warnings * cton-reader: fix all non-suspicious clippy warnings * cton-reader: disable clippy at site of suspicious lint * cton-frontend: disable clippy at the site of an invalid lint * cton-frontend: fix clippy warnings, or ignore benign ones * clippy: ignore the camelcase word WebAssembly in docs * cton-wasm: fix clippy complaints or ignore benign ones * cton-wasm tests: fix clippy complaints * cretonne: starting point turns off all clippy warnings * cretonne: clippy fixes, or lower allow() to source of problem * cretonne: more clippy fixes * cretonne: fix or disable needless_lifetimes lint this linter is buggy when the declared lifetime is used for another type constraint. * cretonne: fix clippy complaint about Pass::NoPass * rustfmt * fix prev minor api changes clippy suggested * add clippy to test-all * cton-filetests: clippy fixes * simplify clippy reporting in test-all * cretonne: document clippy allows better * cretonne: fix some more clippy lints * cretonne: fix clippy lints (mostly doc comments) * cretonne: allow all needless_lifetimes clippy warnings remove overrides at the false positives * rustfmt
67 lines
1.8 KiB
Bash
Executable File
67 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# This is the top-level test script:
|
|
#
|
|
# - Make a debug build.
|
|
# - Make a release build.
|
|
# - Run unit tests for all Rust crates (including the filetests)
|
|
# - Build API documentation.
|
|
#
|
|
# All tests run by this script should be passing at all times.
|
|
|
|
# Disable generation of .pyc files because they cause trouble for vendoring
|
|
# scripts, and this is a build step that isn't run very often anyway.
|
|
export PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Repository top-level directory.
|
|
cd $(dirname "$0")
|
|
topdir=$(pwd)
|
|
|
|
function banner() {
|
|
echo "====== $@ ======"
|
|
}
|
|
|
|
# Run rustfmt if we have it.
|
|
if $topdir/check-rustfmt.sh; then
|
|
banner "Rust formatting"
|
|
$topdir/format-all.sh --write-mode=diff
|
|
fi
|
|
|
|
# Check if any Python files have changed since we last checked them.
|
|
tsfile=$topdir/target/meta-checked
|
|
if [ -f $tsfile ]; then
|
|
needcheck=$(find $topdir/lib/cretonne/meta -name '*.py' -newer $tsfile)
|
|
else
|
|
needcheck=yes
|
|
fi
|
|
if [ -n "$needcheck" ]; then
|
|
banner "$(python --version 2>&1), $(python3 --version 2>&1)"
|
|
$topdir/lib/cretonne/meta/check.sh
|
|
touch $tsfile || echo no target directory
|
|
fi
|
|
|
|
# Make sure the code builds in debug mode.
|
|
banner "Rust debug build"
|
|
cargo build
|
|
|
|
# Make sure the code builds in release mode, and run the unit tests. We run
|
|
# these in release mode for speed, but note that the top-level Cargo.toml file
|
|
# does enable debug assertions in release builds.
|
|
banner "Rust release build and unit tests"
|
|
cargo test --all --release
|
|
|
|
# Make sure the documentation builds.
|
|
banner "Rust documentation: $topdir/target/doc/cretonne/index.html"
|
|
cargo doc
|
|
|
|
# Run clippy if we have it.
|
|
banner "Rust linter"
|
|
if $topdir/check-clippy.sh; then
|
|
$topdir/clippy-all.sh --write-mode=diff
|
|
else
|
|
echo "\`cargo +nightly install clippy\` for optional rust linting"
|
|
fi
|
|
|
|
banner "OK"
|