diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /docs/bin/testing_formatter.sh | |
parent | Initial commit. (diff) | |
download | ansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/bin/testing_formatter.sh')
-rwxr-xr-x | docs/bin/testing_formatter.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/bin/testing_formatter.sh b/docs/bin/testing_formatter.sh new file mode 100755 index 0000000..f3a41e1 --- /dev/null +++ b/docs/bin/testing_formatter.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +set -eux + +FILENAME=../docsite/rst/dev_guide/testing/sanity/index.rst + +cat <<- EOF >$FILENAME.new +.. _all_sanity_tests: + +Sanity Tests +============ + +The following sanity tests are available as \`\`--test\`\` options for \`\`ansible-test sanity\`\`. +This list is also available using \`\`ansible-test sanity --list-tests --allow-disabled\`\`. + +For information on how to run these tests, see :ref:\`sanity testing guide <testing_sanity>\`. + +.. toctree:: + :maxdepth: 1 + +$(for test in $(../../bin/ansible-test sanity --list-tests --allow-disabled); do echo " ${test}"; done) + +EOF + +# By default use sha1sum which exists on Linux, if not present select the correct binary +# based on platform defaults +SHA_CMD="sha1sum" +if ! command -v ${SHA_CMD} > /dev/null 2>&1; then + if command -v sha1 > /dev/null 2>&1; then + SHA_CMD="sha1" + elif command -v shasum > /dev/null 2>&1; then + SHA_CMD="shasum" + else + # exit early with an error if no hashing binary can be found since it is required later + exit 1 + fi +fi + +# Put file into place if it has changed +if [ ! -f "${FILENAME}" ] || [ "$(${SHA_CMD} <$FILENAME)" != "$(${SHA_CMD} <$FILENAME.new)" ]; then + mv -f $FILENAME.new $FILENAME +fi |