summaryrefslogtreecommitdiff
path: root/check
blob: 0fdede089406e6835f10092edeb0c495ad02fa0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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

# Create configuration for the test VMs used by the test suite.
cat > test.cfg <<EOF
name: debian-ansible-test
base_image: "$HOME/tmp/debian-10-openstack-amd64.qcow2"
username: debian
cpus: 2
memory: 1024
EOF

$hideok python3 test.py --log test.log "$@"

echo "Everything seems to be in order."