Skip to content

Commit

Permalink
test: force-enable to accept none value
Browse files Browse the repository at this point in the history
'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 <[email protected]>
  • Loading branch information
grom72 committed Aug 18, 2023
1 parent 65ca2e9 commit e0686a7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/test/README
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions src/test/RUNTESTS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -455,6 +455,9 @@ do

case "$receivetype"
in
none)
forcechecktype=$receivetype
;;
memcheck|pmemcheck|helgrind|drd)
;;
*)
Expand Down
9 changes: 6 additions & 3 deletions src/test/unittest/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/test/unittest/unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e0686a7

Please sign in to comment.