Add support for marking tests long-running
Tests such as vcpu_state.concurrent_save_restore run for a long
period of time in the hope that they will catch an issue which does
not manifest deterministically. This patch adds a property to the
hftest JSON indicating that the test requires a longer time limit.
To aid development, hftest.py will skip such tests when the
environment contains HAFNIUM_SKIP_LONG_RUNNING_TESTS=true (default for
local builds). 'SKIP <test_name>' is printed to inform the user that
a test was skipped.
Change-Id: I2f1b8c36f5aa7df30ac964d6c1bc11f0d82e727d
diff --git a/build/run_in_container.sh b/build/run_in_container.sh
index ae0850e..cfb8629 100755
--- a/build/run_in_container.sh
+++ b/build/run_in_container.sh
@@ -81,6 +81,21 @@
echo "WARNING: Docker seccomp profile is disabled!" 1>&2
ARGS+=(--cap-add=SYS_PTRACE --security-opt seccomp=unconfined)
fi
+# Propagate "HAFNIUM_*" environment variables.
+# Note: Cannot use `env | while` because the loop would run inside a child
+# process and would not have any effect on variables in the parent.
+while read -r ENV_LINE
+do
+ VAR_NAME="$(echo ${ENV_LINE} | cut -d= -f1)"
+ case "${VAR_NAME}" in
+ HAFNIUM_HERMETIC_BUILD)
+ # Skip this one. It will be overridden below.
+ ;;
+ HAFNIUM_*)
+ ARGS+=(-e "${ENV_LINE}")
+ ;;
+ esac
+done <<< "$(env)"
# Set environment variable informing the build that we are running inside
# a container.
ARGS+=(-e HAFNIUM_HERMETIC_BUILD=inside)