1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#!/bin/sh
set -u
# We need a special testbed that tells us where to find models we can use
if [ -z "${MODELS_DIR:-}" ]; then
echo "Environment variable MODELS_DIR not set, skipping tests."
exit 77
elif ! [ -d "$MODELS_DIR" ]; then
echo "Not a directory: $MODELS_DIR" >&2
exit 1
fi
if [ -z "${MODEL_NAMES:-}" ]; then
MODEL_NAMES="$(grep -Ev '^(#.*|[[:space:]]*)$' debian/tests/supported-models.non-free)"
fi
at_least_one=0
exitcode=
for model_name in $MODEL_NAMES; do
model_fullpath="$MODELS_DIR/$model_name"
if ! [ -f "$model_fullpath" ]; then
echo "Model $model_fullpath not found, skipping"
continue
fi
at_least_one=1
echo "Running tests using model: $model_fullpath"
llama-bench -m "$model_fullpath" || exitcode=1
echo "Finished running tests using model: $model_fullpath"
done
# If not a single test could be run, treat this as an overall skip
[ "$at_least_one" -ge 0 ] || exit 77
exit $exitcode
|