From e0686a78346d2507fb7677a02cc2be1dabb34162 Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Thu, 20 Jul 2023 07:04:08 +0200 Subject: [PATCH] test: force-enable to accept none value 'none' value can be used in GHA workflow definition in the same matrix where Valgrind tools are specyfied: matrix: config: ['none', 'drd', 'pmemcheck', 'memcheck', 'helgrind'] 'none' value will disable all Valgrind tests execution. Signed-off-by: Tomasz Gromadzki --- src/test/README | 4 ++-- src/test/RUNTESTS.sh | 7 +++++-- src/test/unittest/configurator.py | 9 ++++++--- src/test/unittest/unittest.sh | 4 ++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/test/README b/src/test/README index 9041f2bf81a..22025b69890 100644 --- a/src/test/README +++ b/src/test/README @@ -65,7 +65,7 @@ RUNTESTS.sh takes options to limit what it runs. The usage is: RUNTESTS.sh [ -hnv ] [ -b build-type ] [ -t test-type ] [ -f fs-type ] [ -o timeout ] [ -s test-file ] [ -k skip-dir ] [[ -m memcheck ] [-p pmemcheck ] [ -e helgrind ] [ -d drd ] || - [ --force-enable memcheck|pmemcheck|helgrind|drd ]] [ -c ] + [ --force-enable memcheck|pmemcheck|helgrind|drd|none ]] [ -c ] [tests...] Build types are: debug, nondebug, static_debug, static_nondebug, all (default) @@ -77,7 +77,7 @@ RUNTESTS.sh takes options to limit what it runs. The usage is: Default value is 3 minutes. Test file is: a name of the particular test script (test case). all (default), TEST0, TEST1, ... - Memcheck, helgrind, drd and pmemcheck modes are: + memcheck, helgrind, drd and pmemcheck modes are: auto (default, enable/disable based on test requirements), force-enable (enable when test does not require given valgrind tool, but obey test's explicit tool disable) diff --git a/src/test/RUNTESTS.sh b/src/test/RUNTESTS.sh index e6cd7ebd8c7..ca40b1f815f 100755 --- a/src/test/RUNTESTS.sh +++ b/src/test/RUNTESTS.sh @@ -16,7 +16,7 @@ usage() Usage: $0 [ -hnv ] [ -b build-type ] [ -t test-type ] [ -f fs-type ] [ -o timeout ] [ -s test-file | -u test-sequence ] [-k skip-dir ] [[ -m memcheck ] [-p pmemcheck ] [ -e helgrind ] [ -d drd ] || - [ --force-enable memcheck|pmemcheck|helgrind|drd ]] + [ --force-enable memcheck|pmemcheck|helgrind|drd|none ]] [ -c ] [tests...] -h print this help message -n dry run @@ -53,7 +53,7 @@ Usage: $0 [ -hnv ] [ -b build-type ] [ -t test-type ] [ -f fs-type ] drd: auto (default, enable/disable based on test requirements), force-enable (enable when test does not require drd, but obey test's explicit drd disable) ---force-enable memcheck|pmemcheck|helgrind|drd +--force-enable memcheck|pmemcheck|helgrind|drd|none allows to force the use of a specific valgrind tool, but skips tests where the tool is explicitly disabled Can not be use with -m, -p, -e, -d. @@ -455,6 +455,9 @@ do case "$receivetype" in + none) + forcechecktype=$receivetype + ;; memcheck|pmemcheck|helgrind|drd) ;; *) diff --git a/src/test/unittest/configurator.py b/src/test/unittest/configurator.py index cad2fecbf25..04b58db46d0 100644 --- a/src/test/unittest/configurator.py +++ b/src/test/unittest/configurator.py @@ -136,7 +136,7 @@ def convert_internal(key, base): convert_internal('test_type', test_types._TestType) convert_internal('granularity', granularity.Granularity) - if config['force_enable'] is not None: + if config['force_enable'] is not None and config['force_enable'] != 'none': config['force_enable'] = next( t for t in vg.TOOLS if t.name.lower() == config['force_enable']) @@ -288,7 +288,10 @@ def ctx_choices(cls): tracers.add_argument('--cgdb', dest='tracer', action='store_const', const='cgdb --args', help='run cgdb as a tracer') - fe_choices = [str(t) for t in vg.TOOLS] - parser.add_argument('--force-enable', choices=fe_choices, default=None) + fe_choices = [str(t) for t in vg.TOOLS] + ['none'] + parser.add_argument('--force-enable', choices=fe_choices, default=None, + help='allows to force the use of a specific ' + 'valgrind tool, but skips tests where the tool is ' + 'explicitly disabled') return parser diff --git a/src/test/unittest/unittest.sh b/src/test/unittest/unittest.sh index eb06e241b85..2b1ade6b8e5 100644 --- a/src/test/unittest/unittest.sh +++ b/src/test/unittest/unittest.sh @@ -1441,6 +1441,10 @@ function valgrind_version_no_check() { # valgrind package is installed # function require_valgrind() { + if [ "$FORCE_CHECK_TYPE" == "none" ]; then + msg "$UNITTEST_NAME: SKIP valgrind test" + exit 0 + fi # bc is used inside valgrind_version_no_check require_command bc require_no_asan