1#!/bin/sh
2
3FILENAME=../docsite/rst/dev_guide/testing/sanity/index.rst
4
5cat <<- EOF >$FILENAME.new
6.. _all_sanity_tests:
7
8Sanity Tests
9============
10
11The following sanity tests are available as \`\`--test\`\` options for \`\`ansible-test sanity\`\`.
12This list is also available using \`\`ansible-test sanity --list-tests --allow-disabled\`\`.
13
14For information on how to run these tests, see :ref:\`sanity testing guide <testing_sanity>\`.
15
16.. toctree::
17   :maxdepth: 1
18
19$(for test in $(../../bin/ansible-test sanity --list-tests --allow-disabled); do echo "   ${test}"; done)
20
21EOF
22
23# By default use sha1sum which exists on Linux, if not present select the correct binary
24# based on platform defaults
25SHA_CMD="sha1sum"
26if ! which ${SHA_CMD} > /dev/null 2>&1; then
27    if which sha1 > /dev/null 2>&1; then
28        SHA_CMD="sha1"
29    elif which shasum > /dev/null 2>&1; then
30        SHA_CMD="shasum"
31    else
32        # exit early with an error if no hashing binary can be found since it is required later
33        exit 1
34    fi
35fi
36
37# Put file into place if it has changed
38if [ "$(${SHA_CMD} <$FILENAME)" != "$(${SHA_CMD} <$FILENAME.new)" ]; then
39    mv -f $FILENAME.new $FILENAME
40fi
41