continuwuity/tests/cargo_smoke.sh
Jade Ellis 67e5e11a97
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Successful in 1m24s
Checks / Prek / Check changed files (pull_request) Successful in 8s
Update flake hashes / update-flake-hashes (pull_request) Successful in 1m26s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m53s
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 16s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 8m43s
refactor: Rename all remaining conduwuit references to Continuwuity
Also adds an alias for the old binary name to the dockerfile

Supersedes !1485
Closes #1536
Closes #2277
2026-10-05 00:58:24 +01:00

63 lines
1.6 KiB
Shell
Executable file

#!/bin/bash
export CARGO_TARGET_DIR="target/smokes"
run () {
RUN_COMMAND=$@
echo -ne "\033[1;33mTEST\033[0m $RUN_COMMAND"
ERRORS=$($RUN_COMMAND 2>&1>/tmp/uwu_smoketest.out)
RESULT=$?
echo
if test $RESULT -ne 0; then
cat /tmp/uwu_smoketest.out
echo -e "$ERRORS"
echo -e "\033[1;5;41;37mFAIL\033[0m exit ($RESULT): $RUN_COMMAND"
exit $RESULT
else
echo -ne "\033[1F"
echo -e "\033[1;32mPASS\033[0m $RUN_COMMAND"
fi
}
continuwuity () {
UWU_OPTS=$@
rm -rf /tmp/uwu_smoketest.db
echo -e "[global]\nserver_name = \"localhost\"\ndatabase_path = \"/tmp/uwu_smoketest.db\"" > /tmp/uwu_smoketest.toml
cargo $UWU_OPTS -- -c /tmp/uwu_smoketest.toml &
sleep 15s
kill -QUIT %1
wait %1
return $?
}
element () {
TOOLCHAIN=$1; shift
ELEMENT_OPTS=$@
run cargo "$TOOLCHAIN" check $ELEMENT_OPTS --all-targets
run cargo "$TOOLCHAIN" clippy $ELEMENT_OPTS --all-targets -- -D warnings
if [ "$BUILD" != "check" ]; then
run cargo "$TOOLCHAIN" build $ELEMENT_OPTS --all-targets
run cargo "$TOOLCHAIN" test $ELEMENT_OPTS --all-targets
run cargo "$TOOLCHAIN" bench $ELEMENT_OPTS --all-targets
run cargo "$TOOLCHAIN" run $ELEMENT_OPTS --bin continuwuity -- -V
run continuwuity "$TOOLCHAIN" run $ELEMENT_OPTS --bin continuwuity
fi
}
vector () {
TOOLCHAIN=$1; shift
VECTOR_OPTS=$@
element "$TOOLCHAIN" $VECTOR_OPTS --no-default-features
element "$TOOLCHAIN" $VECTOR_OPTS --features=default
element "$TOOLCHAIN" $VECTOR_OPTS --features full
}
matrix () {
run cargo +nightly fmt --all --check
vector "" --profile=dev
vector "" --profile=release
vector +nightly --profile=dev
vector +nightly --profile=release
}
BUILD=${1:-build}
matrix && exit 0