Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.toolbox
Commits
777befa0
Commit
777befa0
authored
Oct 09, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a16a4e1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
26 deletions
+59
-26
slapos/test/promise/plugin/test_check_cpri_lock.py
slapos/test/promise/plugin/test_check_cpri_lock.py
+59
-26
No files found.
slapos/test/promise/plugin/test_check_cpri_lock.py
View file @
777befa0
...
...
@@ -42,45 +42,78 @@ class TestCheckCpriLock(TestPromisePluginMixin):
def
setUp
(
self
):
super
(
TestCheckCpriLock
,
self
).
setUp
()
rf_info
=
\
"""
TRX SDR driver 2023-09-07, API v15/18
PCIe CPRI /dev/sdr2@1:
Hardware ID: 0x4b12
DNA: [0x0048248a334a7054]
Serial: ''
FPGA revision: 2023-06-23 10:05:24
FPGA vccint: 0.98 V
FPGA vccaux: 1.76 V
FPGA vccbram: 0.98 V
FPGA temperature: 71.9 °C
Clock tune: 0.0 ppm
NUMA: 0
CPRI_option: '5' (x8) lock=no
DMA0: TX fifo: 66.67us Usage=16/32768 (0%)
DMA0: RX fifo: 66.67us Usage=16/32768 (0%)
DMA0 Underflows: 0
DMA0 Overflows: 0
PCIe CPRI /dev/sdr3@1:
Hardware ID: 0x4b12
DNA: [0x0048248a334a7054]
Serial: ''
FPGA revision: 2023-06-23 10:05:24
FPGA vccint: 0.98 V
FPGA vccaux: 1.77 V
FPGA vccbram: 0.98 V
FPGA temperature: 71.7 °C
Clock tune: 0.0 ppm
NUMA: 0
CPRI_option: '5' (x8) lock=HW+SW rx/tx=46.606us
Port #0: T14=46.606us
DMA0: TX fifo: 66.67us Usage=16/32768 (0%)
DMA0: RX fifo: 66.67us Usage=16/32768 (0%)
DMA0 Underflows: 0
DMA0 Overflows: 0
"""
data
=
{
'message'
:
'rf'
,
'rf_info'
:
rf_info
}
self
.
amarisoft_rf_info_log
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'amarisoft_rf_info.json.log'
)
with
open
(
self
.
amarisoft_rf_info_log
,
'w'
)
as
f
:
f
.
write
(
"""
{"time": "%s", "log_level": "INFO", "message": "RF info", "data": %s}
"""
%
((
datetime
.
now
()
-
timedelta
(
seconds
=
5
)).
strftime
(
"%Y-%m-%d %H:%M:%S"
)[:
-
3
],
data
))
def
writePromise
(
self
,
**
kw
):
kw
.
update
({
'amarisoft-rf-info-log'
:
self
.
amarisoft_rf_info_log
})
super
(
TestCheckCpriLock
,
self
).
writePromise
(
self
.
promise_name
,
"from %s import %s
\
n
extra_config_dict = %r
\
n
"
%
(
RunPromise
.
__module__
,
RunPromise
.
__name__
,
kw
))
def
test_promise_success
(
self
):
self
.
amarisoft_rf_info_log
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'amarisoft_rf_info.json.log'
)
if
os
.
path
.
exists
(
self
.
amarisoft_rf_info_log
):
os
.
remove
(
self
.
amarisoft_rf_info_log
)
with
open
(
self
.
amarisoft_rf_info_log
,
'w+'
)
as
f
:
f
.
write
(
"""
{"time": "%s", "log_level": "INFO", "message": "RF info", "data": {'rf_info': "CPRI: x16 HW SW"}}
"""
%
((
datetime
.
now
()
-
timedelta
(
seconds
=
5
)).
strftime
(
"%Y-%m-%d %H:%M:%S"
)[:
-
3
],))
self
.
writePromise
(
**
{
'amarisoft-rf-info-log'
:
self
.
amarisoft_rf_info_log
,
# 'stats-period': 100,
})
def
test_locked_ok
(
self
):
self
.
writePromise
(
sdr_dev
=
'3'
,
sfp_port
=
'1'
)
self
.
configureLauncher
()
self
.
launcher
.
run
()
def
test_no_lock
(
self
):
self
.
writePromise
(
sdr_dev
=
'2'
,
sfp_port
=
'1'
)
self
.
configureLauncher
()
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
# XXX check output
def
test_promise_fail
(
self
):
self
.
amarisoft_rf_info_log
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'amarisoft_rf_info.json.log'
)
if
os
.
path
.
exists
(
self
.
amarisoft_rf_info_log
):
os
.
remove
(
self
.
amarisoft_rf_info_log
)
with
open
(
self
.
amarisoft_rf_info_log
,
'w'
)
as
f
:
f
.
write
(
"""
{"time": "%s", "log_level": "INFO", "message": "RF info", "data": {'rf_info': "CPRI: x16
\
\
n"}}
"""
%
((
datetime
.
now
()
-
timedelta
(
seconds
=
5
)).
strftime
(
"%Y-%m-%d %H:%M:%S"
)[:
-
3
],))
self
.
writePromise
(
**
{
'amarisoft-rf-info-log'
:
self
.
amarisoft_rf_info_log
,
# 'stats-period': 100,
})
def
test_no_cpri
(
self
):
self
.
writePromise
(
sdr_dev
=
'1'
,
sfp_port
=
'0'
)
self
.
configureLauncher
()
with
self
.
assertRaises
(
PromiseError
):
self
.
launcher
.
run
()
# XXX check output
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment