aboutsummaryrefslogtreecommitdiff
path: root/tests/rt_generic.sh
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-07-20 11:46:29 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-07-20 11:46:29 -0400
commit14a4a198d55713280648344f8b2a01d6e65092f1 (patch)
tree04cce26181be7bae8bacb0d08731c55709f94d33 /tests/rt_generic.sh
parent07dc44efdc5c2fbc2b34c969e623d3b0bc0df15a (diff)
downloadstasis-14a4a198d55713280648344f8b2a01d6e65092f1.tar.gz
Found too many bugs
* Implements a regression test * Moves and completely refactors the envctl code * Allows the user to keep @STR@ values in output files (if you want full control over where external packages comes from post-build) * Fixes wording in a few places * envctl redaction is not implemented yet. The original redaction code hasn't been modified.
Diffstat (limited to 'tests/rt_generic.sh')
-rw-r--r--tests/rt_generic.sh87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/rt_generic.sh b/tests/rt_generic.sh
new file mode 100644
index 0000000..63e921c
--- /dev/null
+++ b/tests/rt_generic.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+set -x
+unset STASIS_SYSCONFDIR
+if [ -n "$GITHUB_TOKEN" ] && [ -z "$STASIS_GH_TOKEN"]; then
+ export STASIS_GH_TOKEN="$GITHUB_TOKEN"
+else
+ export STASIS_GH_TOKEN="anonymous"
+fi
+
+topdir=$(pwd)
+
+ws="rt_workspace"
+mkdir -p "$ws"
+ws="$(realpath $ws)"
+
+prefix="$ws"/local
+mkdir -p "$prefix"
+
+bdir="$ws"/build
+mkdir -p "$bdir"
+
+pushd "$bdir"
+cmake -DCMAKE_INSTALL_PREFIX="$prefix" "${topdir}"/../..
+make install
+export PATH="$prefix/bin:$PATH"
+popd
+
+pushd "$ws"
+ type -P stasis
+ type -P stasis_indexer
+
+ stasis --no-docker --no-artifactory --unbuffered -v "$topdir"/bare_minimum.ini
+ retcode=$?
+
+ set +x
+
+ echo "#### Files ####"
+ find stasis/*/output | sort
+ echo
+
+ echo "#### Contents ####"
+ files=$(find stasis/*/output -type f \( -name '*.yml' -o -name '*.md' -o -name '*.stasis' \) | sort)
+ for x in $files; do
+ echo
+ echo "FILENAME: $x"
+ echo
+ cat "$x"
+ echo "[EOF]"
+ echo
+
+ fail_on_main=(
+ "(null)"
+ )
+ for cond in "${fail_on_main[@]}"; do
+ if grep --color -H -n "$cond" "$x" >&2; then
+ echo "ERROR DETECTED IN $x!" >&2
+ retcode=2
+ fi
+ done
+ done
+
+ # Something above failed, so drop out. Don't bother indexing.
+ # Don't clean up either.
+ (( retcode )) && exit $retcode
+
+ fail_on_indexer=(
+ "(null)"
+ )
+ logfile="stasis_indexer.log"
+ set -x
+ stasis_indexer --web --unbuffered -v stasis/* 2>&1 | tee "$logfile"
+
+ set +x
+ find output
+
+ for cond in "${fail_on_indexer[@]}"; do
+ if grep --color -H -n "$cond" "$logfile" >&2; then
+ echo "ERROR DETECTED IN INDEX OPERATION!" >&2
+ exit 1
+ fi
+ done
+
+popd
+
+rm -rf "$ws"
+
+exit $retcode \ No newline at end of file