Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Production Test Suite
Commits
95dc686a
Commit
95dc686a
authored
May 29, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test03: Uses common modules, added exception handling.
parent
23ce73e7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
76 deletions
+107
-76
test03.py
test/fmcadc100m14b4cha/python/test03.py
+107
-76
No files found.
test/fmcadc100m14b4cha/python/test03.py
View file @
95dc686a
...
...
@@ -5,15 +5,25 @@
# Author: Matthieu Cattin <matthieu.cattin@cern.ch>
# Licence: GPL v2 or later.
# Website: http://www.ohwr.org
# Last modifications: 29/5/2012
# Import system modules
import
sys
import
rr
import
time
import
os
# Add common modules and libraries location to path
sys
.
path
.
append
(
'../../../'
)
sys
.
path
.
append
(
'../../../gnurabbit/python/'
)
sys
.
path
.
append
(
'../../../common/'
)
# Import common modules
from
ptsexcept
import
*
import
rr
import
fmc_adc
# Import specific modules
from
fmc_adc_spec
import
*
from
fmc_adc
import
*
"""
...
...
@@ -25,22 +35,34 @@ Note: Requires test00.py to run first to load the firmware!
def
main
(
default_directory
=
'.'
):
"""
path_fpga_loader = '../../../gnurabbit/user/fpga_loader';
path_firmware = '../firmwares/spec_fmcadc100m14b4cha.bin';
# Constants declaration
TEST_NB
=
3
EXPECTED_BITSTREAM_TYPE
=
0x1
start_test_time
=
time
.
time
()
print
"================================================================================"
print
"Test
%02
d start
\n
"
%
TEST_NB
# SPEC object declaration
print
"Loading hardware access library and opening device.
\n
"
spec
=
rr
.
Gennum
()
firmware_loader = os.path.join(default_directory, path_fpga_loader)
bitstream = os.path.join(default_directory, path_firmware)
print firmware_loader + ' ' + bitstream
os.system( firmware_loader + ' ' + bitstream )
# Carrier object declaration (SPEC board specific part)
# Used to check that the firmware is loaded.
try
:
carrier
=
CFmcAdc100mSpec
(
spec
,
EXPECTED_BITSTREAM_TYPE
)
except
FmcAdc100mSpecOperationError
as
e
:
raise
PtsCritical
(
"Carrier init failed, test stopped:
%
s"
%
e
)
time.sleep(2);
"""
# Mezzanine object declaration (FmcAdc100m14b4cha board specific part)
try
:
fmc
=
CFmcAdc100m
(
spec
)
except
FmcAdc100mOperationError
as
e
:
raise
PtsCritical
(
"Mezzanine init failed, test stopped:
%
s"
%
e
)
# Objects declaration
spec
=
rr
.
Gennum
()
# bind to the SPEC board
fmc
=
fmc_adc
.
CFmcAdc100Ms
(
spec
)
try
:
# Standard in/out temporary redirection
tmp_stdout
=
sys
.
stdout
;
sys
.
stdout
=
sys
.
__stdout__
;
...
...
@@ -49,10 +71,10 @@ def main (default_directory='.'):
# Initialize error variable, disable triggers and make sure no acquisition is running
error
=
[
0
,
0
]
fmc
.
set_trig_config
(
1
,
0
,
0
,
0
,
0
,
0
,
0
)
fmc
.
set_trig_config
(
1
,
0
,
0
,
0
,
1
,
0
,
0
)
fmc
.
stop_acq
()
############################################################################
#==================================================
# Test LEDs ON
fmc
.
trig_led
(
1
)
fmc
.
acq_led
(
1
)
...
...
@@ -69,7 +91,7 @@ def main (default_directory='.'):
# LED ON fail
error
[
0
]
+=
1
############################################################################
#==================================================
# Test LEDs OFF
fmc
.
trig_led
(
0
)
fmc
.
acq_led
(
0
)
...
...
@@ -84,9 +106,9 @@ def main (default_directory='.'):
if
(
ask
==
"N"
):
# LED OFF fail
error
[
0
]
+=
1
error
[
1
]
+=
1
# Standard in/out redirection
# Restore standard in/out
sys
.
stdout
=
tmp_stdout
;
sys
.
stdin
=
tmp_stdin
;
...
...
@@ -100,6 +122,15 @@ def main (default_directory='.'):
else
:
print
(
'LEDs are working ok.'
)
except
FmcAdc100mOperationError
as
e
:
raise
PtsError
(
"Test failed:
%
s"
%
e
)
print
""
print
"==> End of test
%02
d"
%
TEST_NB
print
"================================================================================"
end_test_time
=
time
.
time
()
print
"Test
%02
d elapsed time:
%.2
f seconds
\n
"
%
(
TEST_NB
,
end_test_time
-
start_test_time
)
if
__name__
==
'__main__'
:
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