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
27463fa5
Commit
27463fa5
authored
May 16, 2012
by
Matthieu Cattin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test01: Modify test for compatibility with common modules.
Add proper exception handling. Add test time measurement.
parent
818e600f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
test01.py
test/fmcadc100m14b4cha/python/test01.py
+14
-17
No files found.
test/fmcadc100m14b4cha/python/test01.py
View file @
27463fa5
...
...
@@ -12,7 +12,7 @@ import sys
import
time
import
os
# Add common modules
location tp
path
# Add common modules
and libraries location to
path
sys
.
path
.
append
(
'../../../'
)
sys
.
path
.
append
(
'../../../gnurabbit/python/'
)
sys
.
path
.
append
(
'../../../common/'
)
...
...
@@ -35,12 +35,13 @@ Note: Requires test00.py to run first to load the firmware!
def
main
(
default_directory
=
'.'
):
# Constants declaration
TEST_NB
=
1
EXPECTED_BITSTREAM_TYPE
=
0x1
start_test_time
=
time
.
time
()
print
"================================================================================"
print
"Test
01 start
\n
"
print
"Test
%02
d start
\n
"
%
TEST_NB
# SPEC object declaration
print
"Loading hardware access library and opening device.
\n
"
...
...
@@ -58,22 +59,18 @@ def main (default_directory='.'):
except
FmcAdc100mOperationError
as
e
:
raise
PtsCritical
(
"Mezzanine init failed, test stopped:
%
s"
%
e
)
# Read unique ID and print to log
unique_id
=
fmc
.
get_unique_id
()
if
(
unique_id
==
-
1
):
raise
PtsError
(
"Can't read DS18D20 1-wire thermometer."
)
else
:
print
(
'Unique ID:
%.12
X'
)
%
unique_id
# Read temperatur and print to log
temp
=
fmc
.
get_temp
()
print
(
'FMC temperature:
%3.3
f°C'
)
%
temp
if
((
unique_id
&
0xFF
)
!=
FAMILY_CODE
):
family_code
=
unique_id
&
0xFF
print
(
'family code: 0x
%.8
X'
)
%
family_code
raise
PtsError
(
"1-wire thermometer has the wrong family code:0x.2X expected:0x
%.2
X"
%
family_code
,
FAMILY_CODE
)
# Print mezzanine unique ID and temperature to log
try
:
fmc
.
print_unique_id
()
fmc
.
print_temp
()
except
FmcAdc100mOperationError
as
e
:
raise
PtsError
(
"Mezzanine onewire test failed: "
%
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