diff --git a/tests/docker.sh b/tests/docker.sh index dfbc01b..1b621de 100644 --- a/tests/docker.sh +++ b/tests/docker.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -cd ..; +set -o posix; + +cd "$(dirname "${0}")/.." || exit 1; echo "Running tests with bash:4.1"; echo "==========================="; diff --git a/tests/entry.sh b/tests/entry.sh index f68e343..a6395b1 100644 --- a/tests/entry.sh +++ b/tests/entry.sh @@ -1,8 +1,16 @@ #!/usr/bin/env bash -apk add jq curl perl; +set -o posix; -cd $(dirname "$0"); +echo "Setting up prerequisites..."; +apk -q add jq curl perl; + +echo "Installing ell..."; + +echo -e '#!/usr/bin/env bash\n\n/ell/ell ${@}' > /usr/local/bin/ell; +chmod +x /usr/local/bin/ell; + +cd "$(dirname "${0}")" || exit 1; echo "Running tests..."; diff --git a/tests/logging.sh b/tests/logging.sh index 9630ce2..f6678d0 100644 --- a/tests/logging.sh +++ b/tests/logging.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash +set -o posix; + export TO_TTY=true; -source $(dirname "$0")/../helpers/logging.sh; +source "$(dirname "${0}")/../helpers/logging.sh"; export ELL_LOG_LEVEL=5; echo "ELL_LOG_LEVEL=${ELL_LOG_LEVEL}"; diff --git a/tests/parse_output.sh b/tests/parse_output.sh index fbf85c8..cb8b9c8 100644 --- a/tests/parse_output.sh +++ b/tests/parse_output.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -o posix; + echo ""; echo "gemini stream mode to tty"; echo "========================="; @@ -10,14 +12,14 @@ export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == " export ELL_API_KEY=""; export ELL_TEMPLATE_PATH="${PWD}/../templates/"; export ELL_TEMPLATE="default-${ELL_API_STYLE}"; -bash ./../ell test; +ell test; echo ""; echo "gemini no-stream mode to tty"; echo "============================"; export ELL_API_STREAM=false; export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == "xtrue" ] && echo "" || echo "no-")stream.json#"; -bash ./../ell test; +ell test; export TO_TTY=false; @@ -31,11 +33,11 @@ export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == " export ELL_API_KEY=""; export ELL_TEMPLATE_PATH="${PWD}/../templates/"; export ELL_TEMPLATE="default-${ELL_API_STYLE}"; -bash ./../ell test; +ell test; echo ""; echo "openai no-stream mode to file"; echo "============================="; export ELL_API_STREAM=false; export ELL_API_URL="file://${PWD}/${ELL_API_STYLE}-$([ "x${ELL_API_STREAM}" == "xtrue" ] && echo "" || echo "no-")stream.json#"; -bash ./../ell test; \ No newline at end of file +ell test; \ No newline at end of file diff --git a/tests/piping.sh b/tests/piping.sh index e7fb0c9..5ec927e 100644 --- a/tests/piping.sh +++ b/tests/piping.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -o posix; + function inc() { while read -r -N 1 char; do echo -ne $(( (char + 1) % 10 )); @@ -8,7 +10,7 @@ function inc() { export -f inc; -source $(dirname "$0")/../helpers/piping.sh; +source "$(dirname "${0}")/../helpers/piping.sh"; head -c 256 < /dev/zero | tr '\0' '0' | piping inc inc inc inc inc inc inc inc inc inc inc inc; diff --git a/tests/templating.sh b/tests/templating.sh index 8fb85b4..a75b295 100644 --- a/tests/templating.sh +++ b/tests/templating.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +set -o posix; + +export ELL_TEMPLATE_PATH='/ell/templates/'; + +echo "openai template test"; ell --api-style ell_echo -m gpt-4o --api-stream false test; +echo "gemini template test"; ell --api-style ell_echo -t default-gemini test;