diff options
Diffstat (limited to 'check')
-rwxr-xr-x | check | 64 |
1 files changed, 45 insertions, 19 deletions
@@ -4,33 +4,59 @@ set -eu -quiet=-q hideok=chronic -if [ "$#" -gt 0 ] -then - case "$1" in +if ! command -v chronic >/dev/null; then + hideok= +fi + +if [ "$#" -gt 0 ]; then + case "$1" in verbose | -v | --verbose) - quiet= - hideok= - ;; - esac + hideok= + shift + ;; + esac fi -got_cargo_cmd() -{ - cargo --list | grep " $1 " > /dev/null +require_cmd() { + if ! command -v "$1" >/dev/null; then + echo "Need to have $1 installed, but can't find it" 1>&2 + return 1 + fi +} + +got_cargo_cmd() { + cargo "$1" --help >/dev/null } -cargo build --all-targets $quiet -got_cargo_cmd clippy && cargo clippy $quiet -got_cargo_cmd fmt && cargo fmt -- --check -$hideok cargo test $quiet +require_cmd rustc +require_cmd cc +require_cmd cargo +require_cmd python3 +require_cmd subplot +require_cmd summain +require_cmd pkg-config -sp-docgen obnam.md -o obnam.html -sp-docgen obnam.md -o obnam.pdf +# daemonize installation location changed from Debian 10 to 11. +require_cmd daemonize || require_cmd /usr/sbin/daemonize -sp-codegen obnam.md -o test.py +$hideok cargo --version +$hideok rustc --version + +got_cargo_cmd clippy && cargo clippy --all-targets -q +$hideok cargo build --all-targets +got_cargo_cmd fmt && $hideok cargo fmt -- --check +$hideok cargo test + +subplot docgen obnam.subplot -o obnam.html + +target="$(cargo metadata --format-version=1 | python3 -c 'import sys, json; o = json.load(sys.stdin); print(o["target_directory"])')" +subplot codegen obnam.subplot -o test.py rm -f test.log -$hideok python3 test.py --log test.log "$@" +if [ "$(id -un)" = root ]; then + echo Not running tests as root. +else + $hideok python3 test.py --log test.log --env "CARGO_TARGET_DIR=$target" "$@" +fi echo "Everything seems to be in order." |