From 7ccf78bebe74eb9eca3e2b2390c6f367f3991523 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 5 May 2023 09:24:02 +0300 Subject: tests: simplify scripts, put back document formatting Drop attempts to use Subplot. It's not happening now, maybe later. Sponsored-by: author --- check | 41 ++++++++++------------------------------- check-all | 15 ++++++++++++--- format.sh | 25 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 34 deletions(-) create mode 100755 format.sh diff --git a/check b/check index 992f7cc..8dd8cd6 100755 --- a/check +++ b/check @@ -2,20 +2,11 @@ set -euo pipefail -hideok=chronic -if ! command -v chronic >/dev/null; then - hideok= -fi -if [ "$#" -gt 0 ] && [ "$1" = -v ]; then - hideok= - shift -fi - -$hideok echo Running unit tests ============================================ -$hideok python3 -m CoverageTestRunner --ignore-missing-from=without-tests yarns vmdb -$hideok echo +echo Running unit tests ============================================ +python3 -m CoverageTestRunner --ignore-missing-from=without-tests yarns vmdb +echo -$hideok echo Checking every plugin looks OK ============================================ +echo Checking every plugin looks OK ============================================ for file in vmdb/plugins/*.py; do case "$file" in *_plugin.py) ;; @@ -29,27 +20,15 @@ for file in vmdb/plugins/*.py; do exit 1 fi done -$hideok echo - -if command -v sp-codegen >/dev/null; then - $hideok echo Running Subplot ============================================ - $hideok sp-codegen vmdb2.md -o test.py --run - $hideok echo -fi +echo -$hideok echo Running yarn tests ======================================== -if python3 -c 'import yarnutils' 2>/dev/null; then - $hideok yarn \ - --shell=python3 \ - --shell-arg '' \ - --shell-library yarns/lib.py \ - --env "PYTHONPATH=$(pwd)/yarns" \ - --cd-datadir \ - yarns/*.yarn "$@" - $hideok echo +if false && command -v subplot >/dev/null; then + echo Running Subplot ============================================ + subplot vmdb2.md -o test.py --run + echo fi -$hideok echo Formatting docs ======================================== +echo Formatting docs ======================================== ./format.sh plugindocs() { diff --git a/check-all b/check-all index 4e766c2..3f4c776 100755 --- a/check-all +++ b/check-all @@ -2,11 +2,20 @@ set -euo pipefail +hideok=chronic +if ! command -v chronic >/dev/null; then + hideok= +fi +if [ "$#" -gt 0 ] && [ "$1" = -v ]; then + hideok= + shift +fi + cachedir="$1" cd "$(dirname "$0")" -./check -./check-images "$cachedir" -./check-external "$cachedir" +$hideok ./check +$hideok ./check-images "$cachedir" +$hideok ./check-external "$cachedir" echo "All tests PASS" diff --git a/format.sh b/format.sh new file mode 100755 index 0000000..2a52b33 --- /dev/null +++ b/format.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +set -eu + +cleanup() { + rm -f tmp.md +} + +trap cleanup EXIT + +( + cat vmdb2.md + for x in vmdb/plugins/*.mdwn; do + cat "$x" + echo + done +) >tmp.md +pandoc \ + --self-contained \ + --standalone \ + --css vmdb2.css \ + --toc \ + --number-sections \ + -o vmdb2.html \ + tmp.md -- cgit v1.2.1