aboutsummaryrefslogtreecommitdiff
path: root/ci/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/test.sh')
-rwxr-xr-xci/test.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/ci/test.sh b/ci/test.sh
new file mode 100755
index 0000000..8e8a3a4
--- /dev/null
+++ b/ci/test.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Host-verifiable checks: pinned source checksum, Go formatting, vet, and tests
+# (including the real-rsync-through-rsh end-to-end). Needs Go and rsync; no
+# Android toolchain. This is what runs on every push.
+set -eu
+
+root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+. "$root/versions"
+
+if [ -f "$root/rsync/rsync-${RSYNC_VERSION}.tar.gz" ]; then
+ echo "ci: verifying pinned rsync checksum"
+ ( cd "$root/rsync" && sha256sum -c "rsync-${RSYNC_VERSION}.tar.gz.sha256" )
+fi
+
+echo "ci: gofmt"
+unformatted=$(gofmt -l "$root/rsh")
+if [ -n "$unformatted" ]; then
+ echo "ci: gofmt needed for:" >&2
+ echo "$unformatted" >&2
+ exit 1
+fi
+
+echo "ci: go vet"
+( cd "$root/rsh" && go vet ./... )
+
+echo "ci: go test"
+( cd "$root/rsh" && go test ./... )
+
+echo "ci: ok"