summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-12-03 08:44:53 +0200
committerLars Wirzenius <liw@liw.fi>2023-12-03 08:44:53 +0200
commit50f345288e4309d073fecdb0b44ff6c432645c82 (patch)
tree2284ca294a2b0e77c91335874c7909cf47521445
parentb191ac8a2a2f5697aaed29ddebe0f55e5dd47ee9 (diff)
downloadsummain-rs-50f345288e4309d073fecdb0b44ff6c432645c82.tar.gz
tests: allow tests to run in offline mode
Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
-rwxr-xr-xcheck17
-rwxr-xr-xdebian/rules7
2 files changed, 15 insertions, 9 deletions
diff --git a/check b/check
index 24b73fe..bc9da92 100755
--- a/check
+++ b/check
@@ -6,28 +6,35 @@ set -euo pipefail
quiet=-q
hideok=
+offline=
+
if command -v chronic >/dev/null; then
hideok=chronic
fi
-if [ "$#" -gt 0 ]; then
+while [ "$#" -gt 0 ]; do
case "$1" in
- verbose | -v | --verbose)
+ -v | --verbose)
quiet=
hideok=
+ shift
+ ;;
+ --offline)
+ offline=--offline
+ shift
;;
esac
-fi
+done
got_cargo_cmd() {
cargo --list | grep " $1 " >/dev/null
}
# shellcheck disable=2086
-cargo build --all-targets $quiet
+cargo build $offline --all-targets $quiet
# shellcheck disable=2086
-got_cargo_cmd clippy && cargo clippy $quiet
+got_cargo_cmd clippy && cargo clippy $offline $quiet
got_cargo_cmd fmt && cargo fmt -- --check
subplot docgen summain.subplot -o summain.html
diff --git a/debian/rules b/debian/rules
index ceff6bc..8f54ee9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,9 +7,8 @@ override_dh_auto_build:
true
override_dh_auto_install:
- cargo install --path=. --root=debian/summain
- rm -f debian/summain/.crates.toml
- rm -f debian/summain/.crates2.json
+ cargo install --offline --path=. --root=debian/summain
+ rm -f debian/*/.crates*
override_dh_auto_test:
- ./check
+ ./check --offline