Skip to content

Commit ae7bf7d

Browse files
committed
tests: move diagnostic output behind debug flag
This is adding unnecessary output to every run. Make it optional. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 1e94e70 commit ae7bf7d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/nvme_test.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def setUp(self):
7777
self.do_validate_pci_device = True
7878
self.default_nsid = 0x1
7979
self.flbas = 0
80+
self.debug = False
8081
self.config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'config.json')
8182

8283
self.load_config()
@@ -85,19 +86,19 @@ def setUp(self):
8586
self.ns_mgmt_supported = self.get_ns_mgmt_support()
8687
if self.ns_mgmt_supported:
8788
self.create_and_attach_default_ns()
88-
print(f"\nsetup: ctrl: {self.ctrl}, ns1: {self.ns1}, default_nsid: {self.default_nsid}, flbas: {self.flbas}\n")
89+
if self.debug:
90+
print(f"setup: ctrl: {self.ctrl}, ns1: {self.ns1}, default_nsid: {self.default_nsid}, flbas: {self.flbas}")
8991

9092
def tearDown(self):
9193
""" Post Section for TestNVMe. """
9294
if self.clear_log_dir is True:
9395
shutil.rmtree(self.log_dir, ignore_errors=True)
9496
if self.ns_mgmt_supported:
9597
self.create_and_attach_default_ns()
96-
print(f"\nteardown: ctrl: {self.ctrl}, ns1: {self.ns1}, default_nsid: {self.default_nsid}, flbas: {self.flbas}\n")
9798

9899
@classmethod
99100
def tearDownClass(cls):
100-
print("\n")
101+
pass
101102

102103
def create_and_attach_default_ns(self):
103104
""" Creates a default namespace with the full capacity of the ctrls NVM
@@ -147,7 +148,9 @@ def load_config(self):
147148
self.ns1 = config['ns1']
148149
self.log_dir = config['log_dir']
149150
self.nvme_bin = config.get('nvme_bin', self.nvme_bin)
150-
print(f"\nUsing nvme binary '{self.nvme_bin}'")
151+
self.debug = config.get('debug', False)
152+
if self.debug:
153+
print(f"Using nvme binary '{self.nvme_bin}'")
151154
self.do_validate_pci_device = config.get(
152155
'do_validate_pci_device', self.do_validate_pci_device)
153156
self.clear_log_dir = False

0 commit comments

Comments
 (0)