From 0b4ab32e65eddbb018df484d05c44d347c33dd4b Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Thu, 3 Oct 2024 15:21:59 +0300 Subject: [PATCH] test/e2e: omit long running tests by default. Skip tests matching *long*, *fuzz*, or *stress* by default. Run them with long_tests=yes set. Signed-off-by: Krisztian Litkey --- test/e2e/run_tests.sh | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/test/e2e/run_tests.sh b/test/e2e/run_tests.sh index 35bbd3772..62789ac10 100755 --- a/test/e2e/run_tests.sh +++ b/test/e2e/run_tests.sh @@ -1,6 +1,7 @@ #!/bin/bash TESTS_DIR="$1" +TESTS_RUN_LONG="${long_tests:-no}" RUN_SH="${0%/*}/run.sh" DEFAULT_DISTRO=${DEFAULT_DISTRO:-"generic/fedora37"} @@ -12,11 +13,12 @@ proxy=${proxy:=$HTTPS_PROXY} export proxy usage() { - echo "Usage: run_tests.sh TESTS_DIR" + echo "Usage: [long_tests=yes] run_tests.sh TESTS_DIR" echo "TESTS_DIR is expected to be structured as POLICY/TOPOLOGY/TEST with files:" echo "POLICY/nri-resource_policy.cfg: configuration of nri-resource_policy" echo "POLICY/TOPOLOGY/topology.var.json: contents of the topology variable for run.sh" echo "POLICY/TOPOLOGY/TEST/code.var.sh: contents of the code var (that is, test script)" + echo "long_tests=yes enables long-running tests (including fuzzing and stress tests)." } error() { @@ -116,10 +118,16 @@ export-and-source-dir() { source-source-files "$dir" } -if [ -z "$TESTS_DIR" ] || [ "$TESTS_DIR" == "help" ] || [ "$TESTS_DIR" == "--help" ]; then - usage - error "missing TESTS_DIR" -fi +case "$TESTS_DIR" in + "") + usage + error "missing TESTS_DIR" + ;; + "help"|"--help"|"-h") + usage + exit 0 + ;; +esac if ! [ -d "$TESTS_DIR" ]; then error "bad TESTS_DIR: \"$TESTS_DIR\"" @@ -152,6 +160,7 @@ echo " TESTS_ROOT_DIR=$TESTS_ROOT_DIR" echo " TESTS_POLICY_FILTER=$TESTS_POLICY_FILTER" echo " TESTS_TOPOLOGY_FILTER=$TESTS_TOPOLOGY_FILTER" echo " TESTS_TEST_FILTER=$TESTS_TEST_FILTER" +echo " run long tests: $TESTS_RUN_LONG" source "$TESTS_ROOT_DIR"/../lib/vm.bash @@ -221,6 +230,21 @@ for POLICY_DIR in "$TESTS_ROOT_DIR"/*; do if [ "$(basename "$TEST_DIR")" == "vm-files" ]; then continue fi + + if [ "$TESTS_RUN_LONG" = "no" ]; then + case $TEST_DIR in + *fuzz*) + continue + ;; + *long*) + continue + ;; + *stress*) + continue + ;; + esac + fi + ( export-and-source-dir "$TEST_DIR" export code="${source_libs}""