Skip to content

Commit

Permalink
test: introduce fault_injection test label (Python)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Michalski <jan.michalski@intel.com>
  • Loading branch information
janekmi committed Jul 25, 2023
1 parent 2afe530 commit 4ceb80b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/test/RUNTESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def run_tests(self):
if tc.test_type not in self.config.test_type:
continue

if self.config.test_label != '' and \
self.config.test_label not in tc.labels:
continue

if not tc.enabled:
continue

Expand Down
3 changes: 2 additions & 1 deletion src/test/obj_critnib/TESTS.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!../env.py
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2020, Intel Corporation
# Copyright 2020-2023, Intel Corporation
#

import testframework as t
Expand All @@ -10,6 +10,7 @@
@g.no_testdir()
class TEST0(t.Test):
test_type = t.Medium
labels = ['fault_injection']

def run(self, ctx):
ctx.exec('obj_critnib')
3 changes: 2 additions & 1 deletion src/test/pmem2_config/TESTS.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!../env.py
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2019-2020, Intel Corporation
# Copyright 2019-2023, Intel Corporation
#


Expand Down Expand Up @@ -32,6 +32,7 @@ class TEST0(Pmem2ConfigNoDir):

class TEST1(Pmem2ConfigNoDir):
"""allocation of pmem2_config in case of missing memory in system"""
labels = ['fault_injection']
test_case = "test_alloc_cfg_enomem"


Expand Down
1 change: 1 addition & 0 deletions src/test/pmem2_map_from_existing/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class TEST2(Pmem2_from_existing):

class TEST3(Pmem2_from_existing):
"""inject enomem in to allocation of map object"""
labels = ['fault_injection']
test_case = "test_map_allocation_enomem"


Expand Down
1 change: 1 addition & 0 deletions src/test/pmem2_source/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class TEST3(PMEM2_SOURCE):

class TEST4(PMEM2_SOURCE):
"""allocation of pmem2_source in case of missing memory in system"""
labels = ['fault_injection']
test_case = "test_alloc_src_enomem"


Expand Down
2 changes: 2 additions & 0 deletions src/test/pmem2_vm_reservation/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,13 @@ class TEST13(PMEM2_VM_RESERVATION_DEVDAX):

class TEST14(PMEM2_VM_RESERVATION):
"""create a vm reservation with with error injection"""
labels = ['fault_injection']
test_case = "test_vm_reserv_new_alloc_enomem"


class TEST15(PMEM2_VM_RESERVATION_DEVDAX):
"""DevDax create a vm reservation with with error injection"""
labels = ['fault_injection']
test_case = "test_vm_reserv_new_alloc_enomem"


Expand Down
3 changes: 3 additions & 0 deletions src/test/scope/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,19 @@ def run(self, ctx):

class TEST2(Common):
"""Check scope of libpmem library (*nix)"""
labels = ['fault_injection']
checked_lib = 'libpmem'


class TEST5(Common):
"""Check scope of libpmemobj library (*nix)"""
labels = ['fault_injection']
checked_lib = 'libpmemobj'


class TEST6(Common):
"""Check scope of libpmempool library (*nix)"""
labels = ['fault_injection']
checked_lib = 'libpmempool'


Expand Down
1 change: 1 addition & 0 deletions src/test/unittest/basetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class BaseTest(metaclass=_TestCase):
"""
enabled = True
force_disabled = False
labels = []

def __init__(self):
self.ctx = None
Expand Down
3 changes: 3 additions & 0 deletions src/test/unittest/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ def ctx_choices(cls):
parser.add_argument('--fail-on-skip', dest='fail_on_skip',
action='store_const', const=True,
help='Skipping tests also fail')
parser.add_argument('--test-label', dest='test_label', default='',
action='store',
help='Run only tests marked with the label')

tracers = parser.add_mutually_exclusive_group()
tracers.add_argument('--tracer', dest='tracer', help='run C binary '
Expand Down

0 comments on commit 4ceb80b

Please sign in to comment.