mirror of
https://github.com/clearlinux/graphene.git
synced 2026-04-28 19:23:39 +00:00
Running a subset of regression tests, or a single test, is currently rather annoying, as you cannot simply run 'pytest': you need to override PYTHONPATH and specify several environment variables. Instead, move the whole boilerplate to a wrapper script that allows running pytest with any command line options. Use it in Makefiles as well, so that it doesn't go out of sync with CI.
32 lines
877 B
Bash
Executable File
32 lines
877 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# A wrapper for running pytest, either manually or through a Makefile.
|
|
# Usage:
|
|
# PAL_HOST=Linux .../run-pytest
|
|
# PAL_HOST=Linux-SGX .../run-pytest
|
|
# SGX=1 .../run-pytest
|
|
|
|
PROJECT_ROOT=$(realpath "$(dirname "$0")/..")
|
|
|
|
# Determine PAL_HOST if we're not being run from inside Makefile.
|
|
if [[ "$PAL_HOST" == "" ]]; then
|
|
if [[ "$SGX" == "1" ]]; then
|
|
export PAL_HOST="Linux-SGX"
|
|
else
|
|
export PAL_HOST="Linux"
|
|
fi
|
|
echo "Running pytest for PAL_HOST = $PAL_HOST"
|
|
fi
|
|
|
|
# Add path to regression.py common library.
|
|
export PYTHONPATH="$PROJECT_ROOT/Scripts:$PYTHONPATH"
|
|
|
|
# Environment variables needed by regression.py
|
|
export PAL_LOADER="$PROJECT_ROOT/Runtime/pal-$PAL_HOST"
|
|
export LIBPAL_PATH="$PROJECT_ROOT/Runtime/libpal-$PAL_HOST.so"
|
|
export HOST_PAL_PATH="$PROJECT_ROOT/Pal/src/host/$PAL_HOST"
|
|
|
|
exec python3 -m pytest "$@"
|