Optimise unit test "Webpages"

This commit optimises the unit test for checking for the existence of
webpages in the correct locations by merging the "OK" and "FAIL"
statuses with their respective formatting.
This commit is contained in:
inference 2024-05-12 00:37:09 +00:00
parent 2ee2279a48
commit c98fd4c4c3
Signed by: inference
SSH Key Fingerprint: SHA256:K/a677+eHm7chi3X4s77BIpLTE9Vge1tsv+jUL5gI+Y

View File

@ -4,7 +4,7 @@
# Inferencium - Website - Test - Webpages
# Copyright 2024 Jake Winters
# Version: 0.1.0
# Version: 0.2.0
# SPDX-License-Identifier: BSD-3-Clause
@ -16,8 +16,8 @@ doc="../documentation" # Website documentation directory
# Formatting
bold="\033[1m" # Bold
green="\033[0;32;1m" # Green + Bold
red="\033[0;31;1m" # Red + Bold
ok="\033[0;32;1mOK\033[0m" # Green + Bold
fail="\033[0;31;1mFAIL\033[0m" # Red + Bold
nof="\033[0m" # None
@ -28,166 +28,166 @@ echo ""
echo "${bold}Root${nof}"
if [ -f $root/about.xhtml ]; then
echo "about.xhtml ${green}${bold}OK${nof}"
echo "about.xhtml ${ok}"
else
echo "about.xhtml ${red}FAIL${nof}"
echo "about.xhtml ${fail}"
fi
if [ -f $root/ads.txt ]; then
echo "ads.txt ${green}OK${nof}"
echo "ads.txt ${ok}"
else
echo "ads.txt ${red}FAIL${nof}"
echo "ads.txt ${fail}"
fi
if [ -f $root/app-ads.txt ]; then
echo "app-ads.txt ${green}OK${nof}"
echo "app-ads.txt ${ok}"
else
echo "app-ads.txt ${red}FAIL${nof}"
echo "app-ads.txt ${fail}"
fi
if [ -f $root/blog.xhtml ]; then
echo "blog.xhtml ${green}OK${nof}"
echo "blog.xhtml ${ok}"
else
echo "blog.xhtml ${red}FAIL${nof}"
echo "blog.xhtml ${fail}"
fi
if [ -f $root/changelog.xhtml ]; then
echo "changelog.xhtml ${green}OK${nof}"
echo "changelog.xhtml ${ok}"
else
echo "changelog.xhtml ${red}FAIL${nof}"
echo "changelog.xhtml ${fail}"
fi
if [ -f $root/contact.xhtml ]; then
echo "contact.xhtml ${green}OK${nof}"
echo "contact.xhtml ${ok}"
else
echo "contact.xhtml ${red}FAIL${nof}"
echo "contact.xhtml ${fail}"
fi
if [ -f $root/directory.xhtml ]; then
echo "directory.xhtml ${green}OK${nof}"
echo "directory.xhtml ${ok}"
else
echo "directory.xhtml ${red}FAIL${nof}"
echo "directory.xhtml ${fail}"
fi
if [ -f $root/documentation.xhtml ]; then
echo "documentation.xhtml ${green}OK${nof}"
echo "documentation.xhtml ${ok}"
else
echo "documentation.xhtml ${red}FAIL${nof}"
echo "documentation.xhtml ${fail}"
fi
if [ -f $root/humans.txt ]; then
echo "humans.txt ${green}OK${nof}"
echo "humans.txt ${ok}"
else
echo "humans.txt ${red}FAIL${nof}"
echo "humans.txt ${fail}"
fi
if [ -f $root/index.xhtml ]; then
echo "index.xhtml ${green}OK${nof}"
echo "index.xhtml ${ok}"
else
echo "index.xhtml ${red}FAIL${nof}"
echo "index.xhtml ${fail}"
fi
if [ -f $root/key.xhtml ]; then
echo "key.xhtml ${green}OK${nof}"
echo "key.xhtml ${ok}"
else
echo "key.xhtml ${red}FAIL${nof}"
echo "key.xhtml ${fail}"
fi
if [ -f $root/music.xhtml ]; then
echo "music.xhtml ${green}OK${nof}"
echo "music.xhtml ${ok}"
else
echo "music.xhtml ${red}FAIL${nof}"
echo "music.xhtml ${fail}"
fi
if [ -f $root/news.xhtml ]; then
echo "news.xhtml ${green}OK${nof}"
echo "news.xhtml ${ok}"
else
echo "news.xhtml ${red}FAIL${nof}"
echo "news.xhtml ${fail}"
fi
if [ -f $root/robots.txt ]; then
echo "robots.txt ${green}OK${nof}"
echo "robots.txt ${ok}"
else
echo "robots.txt ${red}FAIL${nof}"
echo "robots.txt ${fail}"
fi
if [ -f $root/sitemap.xhtml ]; then
echo "sitemap.xhtml ${green}OK${nof}"
echo "sitemap.xhtml ${ok}"
else
echo "sitemap.xhtml ${red}FAIL${nof}"
echo "sitemap.xhtml ${fail}"
fi
if [ -f $root/sitemap.xml ]; then
echo "sitemap.xml ${green}OK${nof}"
echo "sitemap.xml ${ok}"
else
echo "sitemap.xml ${red}FAIL${nof}"
echo "sitemap.xml ${fail}"
fi
if [ -f $root/source.xhtml ]; then
echo "source.xhtml ${green}OK${nof}"
echo "source.xhtml ${ok}"
else
echo "source.xhtml ${red}FAIL${nof}"
echo "source.xhtml ${fail}"
fi
echo ""
echo "${bold}Blog${nof}"
if [ -f $blog/foss_is_working_against_itself.xhtml ]; then
echo "foss_is_working_against_itself.xhtml ${green}OK${nof}"
echo "foss_is_working_against_itself.xhtml ${ok}"
else
echo "foss_is_working_against_itself.xhtml ${red}FAIL${nof}"
echo "foss_is_working_against_itself.xhtml ${fail}"
fi
if [ -f $blog/systemd_insecurity.xhtml ]; then
echo "systemd_insecurity.xhtml ${green}OK${nof}"
echo "systemd_insecurity.xhtml ${ok}"
else
echo "systemd_insecurity.xhtml ${red}FAIL${nof}"
echo "systemd_insecurity.xhtml ${fail}"
fi
if [ -f $blog/the_chromium_monopoly.xhtml ]; then
echo "the_chromium_monopoly.xhtml ${green}OK${nof}"
echo "the_chromium_monopoly.xhtml ${ok}"
else
echo "the_chromium_monopoly.xhtml ${red}FAIL${nof}"
echo "the_chromium_monopoly.xhtml ${fail}"
fi
if [ -f $blog/untrusted_the_issue_with_decentralisation.xhtml ]; then
echo "untrusted_the_issue_with_decentralisation.xhtml ${green}OK${nof}"
echo "untrusted_the_issue_with_decentralisation.xhtml ${ok}"
else
echo "untrusted_the_issue_with_decentralisation.xhtml ${red}FAIL${nof}"
echo "untrusted_the_issue_with_decentralisation.xhtml ${fail}"
fi
echo ""
echo "${bold}Changelog${nof}"
if [ -f $clog/firmware-aa000-0.xhtml ]; then
echo "firmware-aa000-0.xhtml ${green}OK${nof}"
echo "firmware-aa000-0.xhtml ${ok}"
else
echo "firmware-aa000-0.xhtml ${red}FAIL${nof}"
echo "firmware-aa000-0.xhtml ${fail}"
fi
if [ -f $clog/firmware-xa000-0.xhtml ]; then
echo "firmware-xa000-0.xhtml ${green}OK${nof}"
echo "firmware-xa000-0.xhtml ${ok}"
else
echo "firmware-xa000-0.xhtml ${red}FAIL${nof}"
echo "firmware-xa000-0.xhtml ${fail}"
fi
if [ -f $clog/firmware-xb000-0.xhtml ]; then
echo "firmware-xb000-0.xhtml ${green}OK${nof}"
echo "firmware-xb000-0.xhtml ${ok}"
else
echo "firmware-xb000-0.xhtml ${red}FAIL${nof}"
echo "firmware-xb000-0.xhtml ${fail}"
fi
echo ""
echo "${bold}Documentation${nof}"
if [ -f $doc/hardened_malloc.xhtml ]; then
echo "hardened_malloc.xhtml ${green}OK${nof}"
echo "hardened_malloc.xhtml ${ok}"
else
echo "hardened_malloc.xhtml ${red}FAIL${nof}"
echo "hardened_malloc.xhtml ${fail}"
fi
if [ -f $doc/openssl_selfsigned_certificate_chain.xhtml ]; then
echo "openssl_selfsigned_certificate_chain.xhtml ${green}OK${nof}"
echo "openssl_selfsigned_certificate_chain.xhtml ${ok}"
else
echo "openssl_selfsigned_certificate_chain.xhtml ${red}FAIL${nof}"
echo "openssl_selfsigned_certificate_chain.xhtml ${fail}"
fi