lockbox

password manager
Log | Files | Refs | README | LICENSE

commit b0cfc269f2bf4f4e6d02dbf9e81f1f4c5d8f7c48
parent b3d7051d5ff33f60d8df47a73c82e22ef7917723
Author: Sean Enck <sean@ttypty.com>
Date:   Fri, 29 Sep 2023 21:14:49 -0400

simplify run all tests mode

Diffstat:
MMakefile | 2+-
Dtests/Makefile | 6------
Mtests/run.sh | 21+++++++++++++++++----
3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile @@ -20,7 +20,7 @@ unittests: check: unittests runs runs: $(TARGET) - $(VARS) make -C tests + cd tests && $(VARS) ./run.sh clean: @rm -rf $(BUILD) tests/bin diff --git a/tests/Makefile b/tests/Makefile @@ -1,6 +0,0 @@ -TESTS := password keyfile both - -all: $(TESTS) - -$(TESTS): - @./run.sh $@ diff --git a/tests/run.sh b/tests/run.sh @@ -6,6 +6,9 @@ CLIP_WAIT=1 CLIP_TRIES=3 CLIP_COPY="$DATA/clip.copy" CLIP_PASTE="$DATA/clip.paste" +PASS_TEST="password" +KEYF_TEST="keyfile" +BOTH_TEST="both" _execute() { local oldmode oldkey @@ -212,9 +215,19 @@ _evaluate() { exit "$state" } +_runall() { + local t code + code=0 + for t in "$PASS_TEST" "$KEYF_TEST" "$BOTH_TEST"; do + if ! "$0" "$t"; then + code=1 + fi + done + exit "$code" +} + if [ -z "$1" ]; then - echo "no test given" - exit 1 + _runall fi _unset @@ -233,11 +246,11 @@ find "$DATA" -type f -delete export LOCKBOX_KEYFILE="" export LOCKBOX_KEY="" VALID=0 -if [ "$1" == "password" ] || [ "$1" == "both" ]; then +if [ "$1" == "$PASS_TEST" ] || [ "$1" == "$BOTH_TEST" ]; then VALID=1 export LOCKBOX_KEY="testingkey" fi -if [ "$1" == "keyfile" ] || [ "$1" == "both" ]; then +if [ "$1" == "$KEYF_TEST" ] || [ "$1" == "$BOTH_TEST" ]; then VALID=1 KEYFILE="$DATA/test.key" echo "thisisatest" > "$KEYFILE"