Skip to content
Snippets Groups Projects
Commit b8ed4dfd authored by DavidLP's avatar DavidLP
Browse files

ENH: make all meta scans work

parent 99c10923
No related branches found
No related tags found
2 merge requests!418Release v1.5.0,!387Increase scan testing coverage
...@@ -37,7 +37,7 @@ def _run_meta_scan(script): ...@@ -37,7 +37,7 @@ def _run_meta_scan(script):
def _scan_loggers(names): def _scan_loggers(names):
loggers = [] loggers = []
# Catch scan output to check for errors reported # Catch scan output to check for reported errors
for name in names: for name in names:
scan_logger = logging.getLogger(name) scan_logger = logging.getLogger(name)
scan_log_handler = utils.MockLoggingHandler(level='DEBUG') scan_log_handler = utils.MockLoggingHandler(level='DEBUG')
...@@ -66,6 +66,8 @@ class TestMetaScans(unittest.TestCase): ...@@ -66,6 +66,8 @@ class TestMetaScans(unittest.TestCase):
# Use hardware mocks to be able to test without hardware # Use hardware mocks to be able to test without hardware
cls.bhm = bdaq_mock.BdaqMock(n_chips=2) cls.bhm = bdaq_mock.BdaqMock(n_chips=2)
# Speed up testing time drastically, by not calling mask shifting
cls.bhm.patch_function('bdaq53.chips.rd53a.RD53AMaskObject.update')
cls.bhm.start() cls.bhm.start()
shutil.copyfile(bench_config, bench_config + '~') # store original shutil.copyfile(bench_config, bench_config + '~') # store original
...@@ -85,13 +87,13 @@ class TestMetaScans(unittest.TestCase): ...@@ -85,13 +87,13 @@ class TestMetaScans(unittest.TestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
cls.bhm.stop() cls.bhm.stop()
shutil.move(bench_config + '~', bench_config) # restore original
@classmethod @classmethod
def tearDown(cls): def tearDown(cls):
# Reset messages after each test # Reset messages after each test
cls.analysis_log_handler.reset() cls.analysis_log_handler.reset()
shutil.rmtree('output_data', ignore_errors=True) # always delete output from previous scan shutil.rmtree('output_data', ignore_errors=True) # always delete output from previous scan
shutil.move(bench_config + '~', bench_config) # restore original
def check_scan_success(self, scan_log_messages): def check_scan_success(self, scan_log_messages):
''' Check the log output if scan was successfull ''' ''' Check the log output if scan was successfull '''
...@@ -102,7 +104,7 @@ class TestMetaScans(unittest.TestCase): ...@@ -102,7 +104,7 @@ class TestMetaScans(unittest.TestCase):
return True return True
def test_meta_threshold_tuning(self): def test_meta_threshold_tuning(self):
script = os.path.join(bdaq53_path, 'scans', 'scan_digital.py') # meta_tune_threshold.py script = os.path.join(bdaq53_path, 'scans', 'meta_tune_threshold.py')
loggers = _scan_loggers(names=['GDACTuning', 'TDACTuning', 'NoiseOccScan', 'StuckPixelScan', 'NoiseOccScan', 'ThresholdScan']) loggers = _scan_loggers(names=['GDACTuning', 'TDACTuning', 'NoiseOccScan', 'StuckPixelScan', 'NoiseOccScan', 'ThresholdScan'])
_run_meta_scan(script) _run_meta_scan(script)
...@@ -110,6 +112,36 @@ class TestMetaScans(unittest.TestCase): ...@@ -110,6 +112,36 @@ class TestMetaScans(unittest.TestCase):
print(scan_log_messages['info']) print(scan_log_messages['info'])
self.assertTrue(self.check_scan_success(scan_log_messages)) self.assertTrue(self.check_scan_success(scan_log_messages))
def test_meta_tot_and_threshold_tuning(self):
script = os.path.join(bdaq53_path, 'scans', 'meta_tune_tot_and_threshold.py')
loggers = _scan_loggers(names=['GDACTuning', 'TDACTuning', 'TotTuning', 'NoiseOccScan', 'StuckPixelScan', 'NoiseOccScan', 'ThresholdScan'])
_run_meta_scan(script)
for scan_log_messages in loggers:
print(scan_log_messages['info'])
self.assertTrue(self.check_scan_success(scan_log_messages))
def test_meta_merged_bumps(self):
script = os.path.join(bdaq53_path, 'scans', 'meta_scan_merged_bumps.py')
loggers = _scan_loggers(names=['GDACTuning', 'TDACTuning', 'MergedBumpsScan'])
_run_meta_scan(script)
for scan_log_messages in loggers:
self.assertTrue(self.check_scan_success(scan_log_messages))
def test_meta_disconnected_bumps_threshold(self):
script = os.path.join(bdaq53_path, 'scans', 'meta_scan_disconnected_bumps_threshold.py')
loggers = _scan_loggers(names=['GDACTuning', 'TDACTuning', 'BumpConnThrShScan'])
with self.assertRaises(Exception): # no periphery defined
_run_meta_scan(script)
for i, scan_log_messages in enumerate(loggers):
if i < 2:
self.assertTrue(self.check_scan_success(scan_log_messages))
else: # BumpConnThrShScan logger
self.assertTrue('Scan failed!' in scan_log_messages['error'])
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment