Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bdaq53
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
silab
bdaq53
Commits
b8ed4dfd
Commit
b8ed4dfd
authored
4 years ago
by
DavidLP
Browse files
Options
Downloads
Patches
Plain Diff
ENH: make all meta scans work
parent
99c10923
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!418
Release v1.5.0
,
!387
Increase scan testing coverage
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bdaq53/tests/test_software/scans/test_meta_scans.py
+35
-3
35 additions, 3 deletions
bdaq53/tests/test_software/scans/test_meta_scans.py
with
35 additions
and
3 deletions
bdaq53/tests/test_software/scans/test_meta_scans.py
+
35
−
3
View file @
b8ed4dfd
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment