summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-09-08 12:23:48 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-06 12:08:24 +0300
commit746ddbc6e17d9ab8238cc4a8e3a348ccb44878b5 (patch)
tree404e18d59a99bcc516cc7f3f07d12a168967f165 /check
parent4819295206d7e1ef2f384dd8b66259434181a3d7 (diff)
downloaddebian-ansible-746ddbc6e17d9ab8238cc4a8e3a348ccb44878b5.tar.gz
test: add a subplot to verify the roles work
Diffstat (limited to 'check')
-rwxr-xr-xcheck43
1 files changed, 43 insertions, 0 deletions
diff --git a/check b/check
new file mode 100755
index 0000000..4d36e49
--- /dev/null
+++ b/check
@@ -0,0 +1,43 @@
+ #!/bin/bash
+#
+# Run the automated tests for the project.
+
+set -eu -o pipefail
+
+quiet=-q
+hideok=chronic
+if [ "$#" -gt 0 ]
+then
+ case "$1" in
+ verbose | -v | --verbose)
+ quiet=
+ hideok=
+ shift 1
+ ;;
+ esac
+fi
+
+dir="$(mktemp -d -p .)"
+
+trap 'rm -rf "$dir"' EXIT
+
+rm -f test.log test.py
+cp subplot.md "$dir"
+cat subplot.md roles/*/subplot.md > "$dir/subplot.md"
+cat subplot/*.py roles/*/subplot.py > "$dir/subplot.py"
+cat subplot/*.yaml roles/*/subplot.yaml > "$dir/subplot.yaml"
+
+(
+ set -eu -o pipefail
+ cd "$dir"
+ sp-docgen subplot.md -o ../subplot.pdf
+ sp-docgen subplot.md -o ../subplot.html
+ sp-codegen subplot.md -o ../test.py
+)
+
+# Fix private key permissions. git doesn't preserve them.
+chmod 0600 ssh/id
+
+$hideok python3 test.py --log test.log "$@"
+
+echo "Everything seems to be in order."