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
e52ac237
Commit
e52ac237
authored
Aug 01, 2011
by
Samuel Iglesias Gonsalvez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tps: change tps for pts (Production Test Suite). Added license
parent
f78c441c
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
149 additions
and
97 deletions
+149
-97
LICENSE
LICENSE
+15
-0
README
README
+4
-2
pts.py
pts.py
+19
-19
pts.sh
pts.sh
+2
-2
ptsdefault.cfg
ptsdefault.cfg
+0
-0
ptsexcept.py
test/example/python/ptsexcept.py
+8
-8
test00.py
test/example/python/test00.py
+1
-1
ptsexcept.py
test/spec/python/ptsexcept.py
+35
-0
test00.py
test/spec/python/test00.py
+7
-7
test01.py
test/spec/python/test01.py
+6
-6
test02.py
test/spec/python/test02.py
+2
-2
test03.py
test/spec/python/test03.py
+3
-3
test04.py
test/spec/python/test04.py
+2
-2
test05.py
test/spec/python/test05.py
+9
-9
test06.py
test/spec/python/test06.py
+5
-5
test07.py
test/spec/python/test07.py
+3
-3
test08.py
test/spec/python/test08.py
+2
-2
test09.py
test/spec/python/test09.py
+1
-1
test10.py
test/spec/python/test10.py
+3
-3
test12.py
test/spec/python/test12.py
+7
-7
test12_rollback.py
test/spec/python/test12_rollback.py
+7
-7
tpsexcept.py
tpsexcept.py
+8
-8
No files found.
LICENSE
0 → 100644
View file @
e52ac237
Production Test Suite, automatized tests for OHWR boards.
Copyright (C) 2011 CERN
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
README
View file @
e52ac237
This is the infamous Test Production Suite facility,
This is Production Test Suite project.
aka TPS of "Office Space" fame.
Supporting automated hardware testing at BE/CO/HT
Supporting automated hardware testing at BE/CO/HT
since 2011 or even less
since 2011 or even less
License: GPL v2 or later
tp
s.py
→
pt
s.py
View file @
e52ac237
...
@@ -21,18 +21,18 @@ import string
...
@@ -21,18 +21,18 @@ import string
from
ConfigParser
import
ConfigParser
,
NoOptionError
from
ConfigParser
import
ConfigParser
,
NoOptionError
from
optparse
import
OptionParser
from
optparse
import
OptionParser
from
sha
import
sha
as
sha160
from
sha
import
sha
as
sha160
from
tp
sexcept
import
*
from
pt
sexcept
import
*
default_config_file
=
'
tp
sdefault.cfg'
default_config_file
=
'
pt
sdefault.cfg'
default_log_pattern
=
'
tp
s_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_pattern
=
'
pt
s_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_name
=
'
tp
s_run_{runid}_{timestamp}_{board}_{serial}.txt'
default_log_name
=
'
pt
s_run_{runid}_{timestamp}_{board}_{serial}.txt'
default_zip_name
=
'zip_run_{runid}_{timestamp}_{board}_{serial}.zip'
default_zip_name
=
'zip_run_{runid}_{timestamp}_{board}_{serial}.zip'
default_test_pattern
=
r'test[0-9][0-9]'
default_test_pattern
=
r'test[0-9][0-9]'
default_test_syntax
=
r'(test)?(\d\d)'
default_test_syntax
=
r'(test)?(\d\d)'
original_raw_input
=
raw_input
original_raw_input
=
raw_input
def
tp
s_raw_input
(
msg
,
default
=
'y'
):
def
pt
s_raw_input
(
msg
,
default
=
'y'
):
try
:
try
:
ret
=
original_raw_input
(
msg
)
ret
=
original_raw_input
(
msg
)
except
EOFError
:
except
EOFError
:
...
@@ -55,7 +55,7 @@ def run_test(testname, logname, yes=False):
...
@@ -55,7 +55,7 @@ def run_test(testname, logname, yes=False):
if
yes
:
if
yes
:
tmpin
=
sys
.
stdin
tmpin
=
sys
.
stdin
sys
.
stdin
=
open
(
'/dev/null'
)
sys
.
stdin
=
open
(
'/dev/null'
)
__builtins__
.
raw_input
=
tp
s_raw_input
__builtins__
.
raw_input
=
pt
s_raw_input
mod
=
__import__
(
testname
,
globals
(),
locals
(),
[])
mod
=
__import__
(
testname
,
globals
(),
locals
(),
[])
mod
.
main
(
default_directory
=
'./test/spec/python'
)
mod
.
main
(
default_directory
=
'./test/spec/python'
)
finally
:
finally
:
...
@@ -93,7 +93,7 @@ class Suite(object):
...
@@ -93,7 +93,7 @@ class Suite(object):
except
IOError
:
except
IOError
:
errmsg
=
'could not read configuration file {0}'
errmsg
=
'could not read configuration file {0}'
errmsg
=
errmsg
.
format
(
self
.
config
)
errmsg
=
errmsg
.
format
(
self
.
config
)
raise
Tp
sCritical
(
errmsg
)
raise
Pt
sCritical
(
errmsg
)
config
=
ConfigParser
(
cfg
)
config
=
ConfigParser
(
cfg
)
try
:
try
:
...
@@ -131,10 +131,10 @@ class Suite(object):
...
@@ -131,10 +131,10 @@ class Suite(object):
if
not
self
.
board
:
if
not
self
.
board
:
msg
=
'invalid board name [{0}]'
.
format
(
self
.
board
)
msg
=
'invalid board name [{0}]'
.
format
(
self
.
board
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
if
not
self
.
serial
:
if
not
self
.
serial
:
msg
=
'invalid serial number [{0}]'
.
format
(
self
.
serial
)
msg
=
'invalid serial number [{0}]'
.
format
(
self
.
serial
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
# self.serial = self.serial.strip(',')
# self.serial = self.serial.strip(',')
if
not
self
.
extra_serial
:
if
not
self
.
extra_serial
:
self
.
extra_serial
=
'0000'
self
.
extra_serial
=
'0000'
...
@@ -150,7 +150,7 @@ class Suite(object):
...
@@ -150,7 +150,7 @@ class Suite(object):
pass
pass
except
IOError
:
except
IOError
:
msg
=
'invalid test path [{0}]'
.
format
(
self
.
test_path
)
msg
=
'invalid test path [{0}]'
.
format
(
self
.
test_path
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
try
:
try
:
tmp
=
os
.
tempnam
(
self
.
log_path
)
tmp
=
os
.
tempnam
(
self
.
log_path
)
...
@@ -160,7 +160,7 @@ class Suite(object):
...
@@ -160,7 +160,7 @@ class Suite(object):
pass
pass
except
:
except
:
msg
=
'invalid log path [{0}]'
.
format
(
self
.
log_path
)
msg
=
'invalid log path [{0}]'
.
format
(
self
.
log_path
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
if
not
self
.
repeat
:
if
not
self
.
repeat
:
self
.
repeat
=
1
self
.
repeat
=
1
...
@@ -169,17 +169,17 @@ class Suite(object):
...
@@ -169,17 +169,17 @@ class Suite(object):
self
.
repeat
=
int
(
self
.
repeat
)
self
.
repeat
=
int
(
self
.
repeat
)
except
ValueError
:
except
ValueError
:
msg
=
'invalid repeat factor [{0}]'
.
format
(
self
.
repeat
)
msg
=
'invalid repeat factor [{0}]'
.
format
(
self
.
repeat
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
if
not
self
.
sequence
:
if
not
self
.
sequence
:
raise
Tp
sNoBatch
(
'null test sequence'
)
raise
Pt
sNoBatch
(
'null test sequence'
)
run
=
[]
run
=
[]
for
testno
in
self
.
sequence
:
for
testno
in
self
.
sequence
:
test_glob
=
os
.
path
.
join
(
self
.
test_path
,
'test'
+
testno
+
'.py'
)
test_glob
=
os
.
path
.
join
(
self
.
test_path
,
'test'
+
testno
+
'.py'
)
files
=
glob
.
glob
(
test_glob
)
files
=
glob
.
glob
(
test_glob
)
if
not
files
:
if
not
files
:
print
files
,
test_glob
print
files
,
test_glob
raise
Tp
sBadTestNo
(
'no test number [
%
s], aborting'
%
testno
)
raise
Pt
sBadTestNo
(
'no test number [
%
s], aborting'
%
testno
)
run
.
append
(
files
[
0
])
run
.
append
(
files
[
0
])
if
self
.
randomize
:
if
self
.
randomize
:
...
@@ -252,17 +252,17 @@ class Suite(object):
...
@@ -252,17 +252,17 @@ class Suite(object):
log
.
write
(
'running test {0} = {1}
\n
'
.
format
(
shortname
,
test
))
log
.
write
(
'running test {0} = {1}
\n
'
.
format
(
shortname
,
test
))
print
'running test '
+
shortname
print
'running test '
+
shortname
run_test
(
testname
,
logname
,
yes
=
self
.
yes
)
run_test
(
testname
,
logname
,
yes
=
self
.
yes
)
except
Tp
sCritical
,
e
:
except
Pt
sCritical
,
e
:
print
'test [
%
s]: critical error, aborting: [
%
s]'
%
(
shortname
,
e
)
print
'test [
%
s]: critical error, aborting: [
%
s]'
%
(
shortname
,
e
)
log
.
write
(
' critical error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
log
.
write
(
' critical error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
log
.
write
(
' cannot continue, aborting test suite'
)
log
.
write
(
' cannot continue, aborting test suite'
)
failures
.
append
((
shortname
,
e
,
))
failures
.
append
((
shortname
,
e
,
))
break
break
except
Tp
sError
,
e
:
except
Pt
sError
,
e
:
print
'test [
%
s]: error, continuing: [
%
s]'
%
(
shortname
,
e
)
print
'test [
%
s]: error, continuing: [
%
s]'
%
(
shortname
,
e
)
log
.
write
(
' error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
log
.
write
(
' error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
failures
.
append
((
shortname
,
e
,
))
failures
.
append
((
shortname
,
e
,
))
except
Tp
sUser
,
e
:
except
Pt
sUser
,
e
:
print
'test [
%
s]: user error, user intervention required: [
%
s]'
%
(
shortname
,
e
)
print
'test [
%
s]: user error, user intervention required: [
%
s]'
%
(
shortname
,
e
)
log
.
write
(
' error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
log
.
write
(
' error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
failures
.
append
((
shortname
,
e
,
))
failures
.
append
((
shortname
,
e
,
))
...
@@ -280,7 +280,7 @@ class Suite(object):
...
@@ -280,7 +280,7 @@ class Suite(object):
elif
ans
==
'c'
:
elif
ans
==
'c'
:
log
.
write
(
' user intervention: continue
\n
'
)
log
.
write
(
' user intervention: continue
\n
'
)
continue
continue
except
Tp
sWarning
,
e
:
except
Pt
sWarning
,
e
:
print
'test [
%
s]: warning: [
%
s]'
%
(
shortname
,
e
)
print
'test [
%
s]: warning: [
%
s]'
%
(
shortname
,
e
)
log
.
write
(
' warning in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
log
.
write
(
' warning in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
failures
.
append
((
shortname
,
e
,
))
failures
.
append
((
shortname
,
e
,
))
...
@@ -477,7 +477,7 @@ def main():
...
@@ -477,7 +477,7 @@ def main():
s
.
sequence
=
valid
s
.
sequence
=
valid
try
:
try
:
s
.
validate_and_compute_run
()
s
.
validate_and_compute_run
()
except
Tp
sInvalid
,
e
:
except
Pt
sInvalid
,
e
:
print
'bad parameters:'
,
e
print
'bad parameters:'
,
e
return
return
...
...
tp
s.sh
→
pt
s.sh
View file @
e52ac237
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
LOGDIR
=
./log
LOGDIR
=
./log
mkdir
-p
$LOGDIR
mkdir
-p
$LOGDIR
sudo rm
-fr
$LOGDIR
/
tp
s
*
sudo rm
-fr
$LOGDIR
/
pt
s
*
serial
=
$1
serial
=
$1
if
[
x
$1
=
x
""
]
;
then
if
[
x
$1
=
x
""
]
;
then
...
@@ -28,7 +28,7 @@ echo -n "Press enter to continue...\n"
...
@@ -28,7 +28,7 @@ echo -n "Press enter to continue...\n"
read
tmp
read
tmp
echo
-n
"--------------------------------------------------------------
\n
"
echo
-n
"--------------------------------------------------------------
\n
"
sudo
./
tp
s.py
-b
SPEC
-s
$serial
-e
$extra_serial
-t
./test/spec/python
-l
$LOGDIR
00 01 02 03 04 05 06 07 08 09 10 12
sudo
./
pt
s.py
-b
SPEC
-s
$serial
-e
$extra_serial
-t
./test/spec/python
-l
$LOGDIR
00 01 02 03 04 05 06 07 08 09 10 12
echo
-n
"Press enter to exit... "
echo
-n
"Press enter to exit... "
...
...
tp
sdefault.cfg
→
pt
sdefault.cfg
View file @
e52ac237
File moved
test/
spec/python/tp
sexcept.py
→
test/
example/python/pt
sexcept.py
View file @
e52ac237
#! /usr/bin/env python
#! /usr/bin/env python
# coding: utf8
# coding: utf8
class
Tp
sException
(
Exception
):
class
Pt
sException
(
Exception
):
pass
pass
class
TpsCritical
(
Tp
sException
):
class
PtsCritical
(
Pt
sException
):
"""critical error, abort the whole test suite"""
"""critical error, abort the whole test suite"""
pass
pass
class
TpsError
(
Tp
sException
):
class
PtsError
(
Pt
sException
):
"""error, continue remaining tests in test suite"""
"""error, continue remaining tests in test suite"""
pass
pass
class
TpsUser
(
Tp
sException
):
class
PtsUser
(
Pt
sException
):
"""error, user intervention required"""
"""error, user intervention required"""
pass
pass
class
TpsWarning
(
Tp
sException
):
class
PtsWarning
(
Pt
sException
):
"""warning, a cautionary message should be displayed"""
"""warning, a cautionary message should be displayed"""
pass
pass
class
TpsInvalid
(
Tp
sException
):
class
PtsInvalid
(
Pt
sException
):
"""reserved: invalid parameters"""
"""reserved: invalid parameters"""
class
TpsNoBatch
(
Tp
sInvalid
):
class
PtsNoBatch
(
Pt
sInvalid
):
"""reserved: a suite was created without batch of tests to run"""
"""reserved: a suite was created without batch of tests to run"""
pass
pass
class
TpsBadTestNo
(
Tp
sInvalid
):
class
PtsBadTestNo
(
Pt
sInvalid
):
"""reserved: a bad test number was given"""
"""reserved: a bad test number was given"""
pass
pass
...
...
test/example/python/test00.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
# Needed for accessing the rawrabbit driver
import
rr
# Needed for accessing the rawrabbit driver
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
# Declaration of Exceptions
from
pt
sexcept
import
*
# Declaration of Exceptions
"""
"""
test00: example test which prints 'hello <name>'
test00: example test which prints 'hello <name>'
...
...
test/spec/python/ptsexcept.py
0 → 100644
View file @
e52ac237
#! /usr/bin/env python
# coding: utf8
class
PtsException
(
Exception
):
pass
class
PtsCritical
(
PtsException
):
"""critical error, abort the whole test suite"""
pass
class
PtsError
(
PtsException
):
"""error, continue remaining tests in test suite"""
pass
class
PtsUser
(
PtsException
):
"""error, user intervention required"""
pass
class
PtsWarning
(
PtsException
):
"""warning, a cautionary message should be displayed"""
pass
class
PtsInvalid
(
PtsException
):
"""reserved: invalid parameters"""
class
PtsNoBatch
(
PtsInvalid
):
"""reserved: a suite was created without batch of tests to run"""
pass
class
PtsBadTestNo
(
PtsInvalid
):
"""reserved: a bad test number was given"""
pass
if
__name__
==
'__main__'
:
pass
test/spec/python/test00.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test02: checks the EEPROM of the GENNUM chip.
test02: checks the EEPROM of the GENNUM chip.
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if
tmp
&
0x1
:
if
tmp
&
0x1
:
break
break
elif
tmp
&
0xC
:
elif
tmp
&
0xC
:
raise
Tp
sError
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
raise
Pt
sError
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
sys
.
exit
()
sys
.
exit
()
i
-=
1
i
-=
1
if
i
==
0
:
if
i
==
0
:
raise
Tp
sError
(
'ERROR, completion status not detected!!'
)
raise
Pt
sError
(
'ERROR, completion status not detected!!'
)
sys
.
exit
()
sys
.
exit
()
# Change to read mode
# Change to read mode
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j
-=
1
j
-=
1
if
j
==
0
:
if
j
==
0
:
error_flag
=
1
error_flag
=
1
raise
Tp
sWarning
(
'ERROR, completion status not detected!!'
)
raise
Pt
sWarning
(
'ERROR, completion status not detected!!'
)
# Read data from fifo
# Read data from fifo
while
transfer_len
>
0
:
while
transfer_len
>
0
:
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
#print 'TR_SIZE=%d' % tmp
break
break
elif
tmp
&
0xC
:
elif
tmp
&
0xC
:
raise
Tp
sWarning
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
raise
Pt
sWarning
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
tmp
=
self
.
gennum
.
iread
(
4
,
0x914
,
4
)
tmp
=
self
.
gennum
.
iread
(
4
,
0x914
,
4
)
return
total_transfer
return
total_transfer
i
-=
1
i
-=
1
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if
written
==
len
(
file_data
):
if
written
==
len
(
file_data
):
print
'EEPROM written with '
+
file_name
+
' content!'
print
'EEPROM written with '
+
file_name
+
' content!'
else
:
else
:
raise
Tp
sError
(
"ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file."
)
raise
Pt
sError
(
"ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file."
)
return
0
return
0
def
compare_eeprom_with_file
(
self
,
file_name
):
def
compare_eeprom_with_file
(
self
,
file_name
):
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
else
:
else
:
raise
Tp
sError
(
'EEPROM=
%.2
X, FILE=
%.2
X => ERROR'
%
(
eeprom_data
[
i
],
file_data
[
i
]))
raise
Pt
sError
(
'EEPROM=
%.2
X, FILE=
%.2
X => ERROR'
%
(
eeprom_data
[
i
],
file_data
[
i
]))
def
file_dump_to_gennum
(
self
,
file_name
):
def
file_dump_to_gennum
(
self
,
file_name
):
if
file_name
==
""
:
if
file_name
==
""
:
...
...
test/spec/python/test01.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test00: checks voltage of the power pins in FMC connector.
test00: checks voltage of the power pins in FMC connector.
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
self
.
wait_busy
()
self
.
wait_busy
()
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Tp
sError
(
'Failed I2C communication. No ACK upon address (device 0x
%
x not connected?)'
%
addr
)
raise
Pt
sError
(
'Failed I2C communication. No ACK upon address (device 0x
%
x not connected?)'
%
addr
)
def
write
(
self
,
data
,
last
):
def
write
(
self
,
data
,
last
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
self
.
wr_reg
(
self
.
R_TXR
,
data
);
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
self
.
wait_busy
();
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Tp
sError
(
'Failed I2C communication. No ACK upon write'
)
raise
Pt
sError
(
'Failed I2C communication. No ACK upon write'
)
def
read
(
self
,
last
):
def
read
(
self
,
last
):
cmd
=
self
.
CR_RD
;
cmd
=
self
.
CR_RD
;
...
@@ -172,15 +172,15 @@ def main (default_directory='.'):
...
@@ -172,15 +172,15 @@ def main (default_directory='.'):
# Check the values of the ADC.
# Check the values of the ADC.
if
(
float
(
value8
)
<
1.58
)
or
(
float
(
value8
)
>
1.75
)
:
if
(
float
(
value8
)
<
1.58
)
or
(
float
(
value8
)
>
1.75
)
:
raise
Tp
sError
(
"Error in VS_VADJ (2.5V) measured "
+
adc_convert_to_real_value
(
8
,
value8
)
+
"V."
)
raise
Pt
sError
(
"Error in VS_VADJ (2.5V) measured "
+
adc_convert_to_real_value
(
8
,
value8
)
+
"V."
)
print
"VS_VADJ = "
+
adc_convert_to_real_value
(
8
,
value8
)
print
"VS_VADJ = "
+
adc_convert_to_real_value
(
8
,
value8
)
if
(
float
(
value7
)
<
1.88
)
or
(
float
(
value7
)
>
2.13
):
if
(
float
(
value7
)
<
1.88
)
or
(
float
(
value7
)
>
2.13
):
raise
Tp
sError
(
"Error in VS_P12V_x (12V) measured "
+
adc_convert_to_real_value
(
7
,
value7
)
+
"V."
)
raise
Pt
sError
(
"Error in VS_P12V_x (12V) measured "
+
adc_convert_to_real_value
(
7
,
value7
)
+
"V."
)
print
"VS_P12V_x = "
+
adc_convert_to_real_value
(
7
,
value7
)
print
"VS_P12V_x = "
+
adc_convert_to_real_value
(
7
,
value7
)
if
(
float
(
value6
)
<
1.64
)
or
(
float
(
value6
)
>
1.82
):
if
(
float
(
value6
)
<
1.64
)
or
(
float
(
value6
)
>
1.82
):
raise
Tp
sError
(
"Error in VS_P3V3_x (3.3V) measured "
+
adc_convert_to_real_value
(
6
,
value6
)
+
"V."
)
raise
Pt
sError
(
"Error in VS_P3V3_x (3.3V) measured "
+
adc_convert_to_real_value
(
6
,
value6
)
+
"V."
)
print
"VS_P3V3_x = "
+
adc_convert_to_real_value
(
6
,
value6
)
print
"VS_P3V3_x = "
+
adc_convert_to_real_value
(
6
,
value6
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
test/spec/python/test02.py
View file @
e52ac237
...
@@ -13,7 +13,7 @@ import time
...
@@ -13,7 +13,7 @@ import time
import
os
import
os
import
errno
import
errno
from
tp
sexcept
import
*
# jdgc
from
pt
sexcept
import
*
# jdgc
"""
"""
test01: checks the low speed pins of FMC connector (low count connector).
test01: checks the low speed pins of FMC connector (low count connector).
...
@@ -1104,7 +1104,7 @@ def summary_results(testStatus):
...
@@ -1104,7 +1104,7 @@ def summary_results(testStatus):
for
i
in
sorted
(
testStatus
.
keys
()):
for
i
in
sorted
(
testStatus
.
keys
()):
if
testStatus
[
i
]
==
'Fail'
:
if
testStatus
[
i
]
==
'Fail'
:
raise
Tp
sError
(
"FMC connector failure"
)
raise
Pt
sError
(
"FMC connector failure"
)
print
string
print
string
...
...
test/spec/python/test03.py
View file @
e52ac237
...
@@ -12,7 +12,7 @@ import time
...
@@ -12,7 +12,7 @@ import time
import
os
import
os
import
os.path
import
os.path
from
ctypes
import
*
from
ctypes
import
*
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test03: loads a firmware file to Flash memory and boots from it. The FW just blinks the leds.
test03: loads a firmware file to Flash memory and boots from it. The FW just blinks the leds.
...
@@ -40,7 +40,7 @@ def main (default_directory='.'):
...
@@ -40,7 +40,7 @@ def main (default_directory='.'):
flash
.
lib
.
gpio_bootselect
(
flash
.
GENNUM_FLASH
);
flash
.
lib
.
gpio_bootselect
(
flash
.
GENNUM_FLASH
);
version
=
hex
(
flash
.
lib
.
flash_read_id
());
version
=
hex
(
flash
.
lib
.
flash_read_id
());
if
(
version
!=
"0x202016"
):
if
(
version
!=
"0x202016"
):
raise
Tp
sError
(
'Error: version of the flash is not correct: '
+
version
);
raise
Pt
sError
(
'Error: version of the flash is not correct: '
+
version
);
# Load a new firmware to the Flash memory.
# Load a new firmware to the Flash memory.
print
"Starting the process to load a FW into Flash memory"
print
"Starting the process to load a FW into Flash memory"
...
@@ -74,7 +74,7 @@ def main (default_directory='.'):
...
@@ -74,7 +74,7 @@ def main (default_directory='.'):
sys
.
stdout
=
tmp_stdout
;
sys
.
stdout
=
tmp_stdout
;
sys
.
stdin
=
tmp_stdin
;
sys
.
stdin
=
tmp_stdin
;
if
(
ask
==
"N"
)
:
if
(
ask
==
"N"
)
:
raise
Tp
sError
(
"Error loading FW through the Flash memory or there is a problem with the LEDs"
);
raise
Pt
sError
(
"Error loading FW through the Flash memory or there is a problem with the LEDs"
);
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
();
main
();
test/spec/python/test04.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test00: checks the presence of the SFP connector and reads the type of connector
test00: checks the presence of the SFP connector and reads the type of connector
...
@@ -146,7 +146,7 @@ def main (default_directory='.'):
...
@@ -146,7 +146,7 @@ def main (default_directory='.'):
if
(
type
==
3
)
:
if
(
type
==
3
)
:
print
"Type is correct"
print
"Type is correct"
else
:
else
:
raise
Tp
sError
(
"Wrong type of connector. It should be 0x3"
)
raise
Pt
sError
(
"Wrong type of connector. It should be 0x3"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
();
main
();
...
...
test/spec/python/test05.py
View file @
e52ac237
...
@@ -13,7 +13,7 @@ import sys
...
@@ -13,7 +13,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test05: check SATA ports and high speed pins on FMC connector (low count connector).
test05: check SATA ports and high speed pins on FMC connector (low count connector).
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
self
.
wait_busy
()
self
.
wait_busy
()
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Tp
sError
(
'No ACK upon address (device 0x
%
x not connected?)'
%
(
addr
>>
1
))
raise
Pt
sError
(
'No ACK upon address (device 0x
%
x not connected?)'
%
(
addr
>>
1
))
def
write
(
self
,
data
,
last
):
def
write
(
self
,
data
,
last
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
self
.
wr_reg
(
self
.
R_TXR
,
data
);
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
self
.
wait_busy
();
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Tp
sError
(
'No ACK upon write'
)
raise
Pt
sError
(
'No ACK upon write'
)
def
read
(
self
,
last
):
def
read
(
self
,
last
):
cmd
=
self
.
CR_RD
;
cmd
=
self
.
CR_RD
;
...
@@ -263,7 +263,7 @@ class CSI570 :
...
@@ -263,7 +263,7 @@ class CSI570 :
break
;
break
;
if
(
not
finish
):
if
(
not
finish
):
raise
Tp
sError
(
'SI570: Not found a proper setup'
)
raise
Pt
sError
(
'SI570: Not found a proper setup'
)
tmp
=
freq_dco
/
114.28
;
tmp
=
freq_dco
/
114.28
;
rfreq
=
int
((
tmp
*
(
2
**
28
)));
rfreq
=
int
((
tmp
*
(
2
**
28
)));
...
@@ -397,7 +397,7 @@ class CMinic:
...
@@ -397,7 +397,7 @@ class CMinic:
mask
=
1
<<
2
;
mask
=
1
<<
2
;
if
(
self
.
minic_readl
(
self
.
MINIC_REG_MCR
)
&
mask
)
:
if
(
self
.
minic_readl
(
self
.
MINIC_REG_MCR
)
&
mask
)
:
raise
Tp
sError
(
'MINIC: TX error'
);
raise
Pt
sError
(
'MINIC: TX error'
);
def
receive
(
self
,
size
)
:
def
receive
(
self
,
size
)
:
# Setup RX
# Setup RX
...
@@ -555,7 +555,7 @@ def main (default_directory='.'):
...
@@ -555,7 +555,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
if
(
p
.
is_alive
())
:
p
.
terminate
();
p
.
terminate
();
raise
Tp
sError
(
"Test SATA 0 -> SATA 1: Error in SATA 1, RX"
)
raise
Pt
sError
(
"Test SATA 0 -> SATA 1: Error in SATA 1, RX"
)
time
.
sleep
(
2
);
time
.
sleep
(
2
);
...
@@ -574,7 +574,7 @@ def main (default_directory='.'):
...
@@ -574,7 +574,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
if
(
p
.
is_alive
())
:
p
.
terminate
();
p
.
terminate
();
raise
Tp
sError
(
"Test SATA 1 -> SATA 0: Error in SATA 0, RX"
)
raise
Pt
sError
(
"Test SATA 1 -> SATA 0: Error in SATA 0, RX"
)
time
.
sleep
(
2
)
time
.
sleep
(
2
)
...
@@ -594,7 +594,7 @@ def main (default_directory='.'):
...
@@ -594,7 +594,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
if
(
p
.
is_alive
())
:
p
.
terminate
();
p
.
terminate
();
raise
Tp
sError
(
"Test SFP -> DP0: Error in DP0, RX"
)
raise
Pt
sError
(
"Test SFP -> DP0: Error in DP0, RX"
)
time
.
sleep
(
2
);
time
.
sleep
(
2
);
...
@@ -613,7 +613,7 @@ def main (default_directory='.'):
...
@@ -613,7 +613,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
if
(
p
.
is_alive
())
:
p
.
terminate
();
p
.
terminate
();
raise
Tp
sError
(
"Test DP0 -> SFP: Error in SFP, RX"
)
raise
Pt
sError
(
"Test DP0 -> SFP: Error in SFP, RX"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
();
main
();
test/spec/python/test06.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test06: checks Silabs SI570 oscillator.
test06: checks Silabs SI570 oscillator.
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
self
.
wait_busy
()
self
.
wait_busy
()
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Tp
sError
(
'Failed I2C. No ACK upon address (device 0x
%
x not connected?)'
%
addr
)
raise
Pt
sError
(
'Failed I2C. No ACK upon address (device 0x
%
x not connected?)'
%
addr
)
def
write
(
self
,
data
,
last
):
def
write
(
self
,
data
,
last
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
self
.
wr_reg
(
self
.
R_TXR
,
data
);
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
self
.
wait_busy
();
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
if
(
self
.
rd_reg
(
self
.
R_SR
)
&
self
.
SR_RXACK
):
raise
Tp
sError
(
'Failed I2C. No ACK upon write'
)
raise
Pt
sError
(
'Failed I2C. No ACK upon write'
)
def
read
(
self
,
last
):
def
read
(
self
,
last
):
cmd
=
self
.
CR_RD
;
cmd
=
self
.
CR_RD
;
...
@@ -220,7 +220,7 @@ class CSI570 :
...
@@ -220,7 +220,7 @@ class CSI570 :
break
;
break
;
if
(
not
finish
):
if
(
not
finish
):
raise
Tp
sError
(
'SI570: Not found a proper setup'
)
raise
Pt
sError
(
'SI570: Not found a proper setup'
)
tmp
=
freq_dco
/
114.28
;
tmp
=
freq_dco
/
114.28
;
rfreq
=
int
((
tmp
*
(
2
**
28
)));
rfreq
=
int
((
tmp
*
(
2
**
28
)));
...
@@ -260,7 +260,7 @@ def main (default_directory='.'):
...
@@ -260,7 +260,7 @@ def main (default_directory='.'):
if
(
gennum
.
iread
(
0
,
0x80000
,
4
))
:
if
(
gennum
.
iread
(
0
,
0x80000
,
4
))
:
print
"SI570 CLK present: OK"
print
"SI570 CLK present: OK"
else
:
else
:
raise
Tp
sError
(
"SIS570 CLK present: FAILED"
)
raise
Pt
sError
(
"SIS570 CLK present: FAILED"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
();
main
();
test/spec/python/test07.py
View file @
e52ac237
...
@@ -15,7 +15,7 @@ import i2c
...
@@ -15,7 +15,7 @@ import i2c
import
gn4124
import
gn4124
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test07: checks data and address lines of DDR memory.
test07: checks data and address lines of DDR memory.
...
@@ -54,7 +54,7 @@ def main (default_directory='.'):
...
@@ -54,7 +54,7 @@ def main (default_directory='.'):
num_data_lines
=
16
;
num_data_lines
=
16
;
if
(
len
(
pages
)
<
(
num_addr_lines
+
2
))
:
if
(
len
(
pages
)
<
(
num_addr_lines
+
2
))
:
raise
Tp
sError
(
"Not enough pages"
);
raise
Pt
sError
(
"Not enough pages"
);
data
=
0xDEADBABE
data
=
0xDEADBABE
# Clear memory pages
# Clear memory pages
...
@@ -174,7 +174,7 @@ def main (default_directory='.'):
...
@@ -174,7 +174,7 @@ def main (default_directory='.'):
if
(
error
)
:
if
(
error
)
:
print
"RESULT: [FAILED]"
print
"RESULT: [FAILED]"
raise
Tp
sError
(
"Error in DDR data/address lines. Please check log file for more information"
)
raise
Pt
sError
(
"Error in DDR data/address lines. Please check log file for more information"
)
else
:
else
:
print
"RESULT: [OK]"
print
"RESULT: [OK]"
...
...
test/spec/python/test08.py
View file @
e52ac237
...
@@ -12,7 +12,7 @@ import rr
...
@@ -12,7 +12,7 @@ import rr
import
time
import
time
import
math
import
math
import
os.path
import
os.path
from
tp
sexcept
import
*
# jdgc
from
pt
sexcept
import
*
# jdgc
""" SPEC test for two clock domains.
""" SPEC test for two clock domains.
...
@@ -368,7 +368,7 @@ def main (default_directory='.'):
...
@@ -368,7 +368,7 @@ def main (default_directory='.'):
for
i
in
range
(
0
,
len
(
double_counter
.
results
)):
for
i
in
range
(
0
,
len
(
double_counter
.
results
)):
if
(
double_counter
.
results
[
i
]
==
False
):
if
(
double_counter
.
results
[
i
]
==
False
):
print
"Test "
+
str
(
i
)
+
":
\t
FAIL"
print
"Test "
+
str
(
i
)
+
":
\t
FAIL"
raise
Tp
sCritical
(
"Mismatch between expected fast cycles and expected ones"
)
raise
Pt
sCritical
(
"Mismatch between expected fast cycles and expected ones"
)
else
:
else
:
print
"Test "
+
str
(
i
)
+
":
\t
PASS"
print
"Test "
+
str
(
i
)
+
":
\t
PASS"
...
...
test/spec/python/test09.py
View file @
e52ac237
...
@@ -11,7 +11,7 @@ import rr
...
@@ -11,7 +11,7 @@ import rr
import
time
import
time
import
os
import
os
from
ctypes
import
*
from
ctypes
import
*
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test09: reads serial number of the temperature sensor.
test09: reads serial number of the temperature sensor.
...
...
test/spec/python/test10.py
View file @
e52ac237
...
@@ -11,7 +11,7 @@ import rr
...
@@ -11,7 +11,7 @@ import rr
import
time
import
time
import
os
import
os
import
serial
import
serial
from
tp
sexcept
import
*
from
pt
sexcept
import
*
from
multiprocessing
import
Process
from
multiprocessing
import
Process
"""
"""
...
@@ -62,7 +62,7 @@ def rx_thread(ser):
...
@@ -62,7 +62,7 @@ def rx_thread(ser):
char1
=
ser
.
read
(
1
);
char1
=
ser
.
read
(
1
);
if
(
char1
!=
"A"
)
:
if
(
char1
!=
"A"
)
:
raise
Tp
sError
(
"UART sent 'A'. USB received: "
+
char1
)
raise
Pt
sError
(
"UART sent 'A'. USB received: "
+
char1
)
print
"UART sent 'A'. USB received: "
+
char1
print
"UART sent 'A'. USB received: "
+
char1
...
@@ -91,7 +91,7 @@ def main (default_directory='.'):
...
@@ -91,7 +91,7 @@ def main (default_directory='.'):
char1
=
uart
.
read
();
char1
=
uart
.
read
();
if
(
chr
(
char1
)
!=
'a'
)
:
if
(
chr
(
char1
)
!=
'a'
)
:
raise
Tp
sError
(
"USB sent 'a'. UART received: "
+
chr
(
char1
))
raise
Pt
sError
(
"USB sent 'a'. UART received: "
+
chr
(
char1
))
print
"USB sent 'a'. UART Received: "
+
chr
(
char1
);
print
"USB sent 'a'. UART Received: "
+
chr
(
char1
);
...
...
test/spec/python/test12.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test10: overwrites GENNUM EEPROM with VENDOR ID, DEVICE ID of SPEC Board.
test10: overwrites GENNUM EEPROM with VENDOR ID, DEVICE ID of SPEC Board.
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if
tmp
&
0x1
:
if
tmp
&
0x1
:
break
break
elif
tmp
&
0xC
:
elif
tmp
&
0xC
:
raise
Tp
sError
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
raise
Pt
sError
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
sys
.
exit
()
sys
.
exit
()
i
-=
1
i
-=
1
if
i
==
0
:
if
i
==
0
:
raise
Tp
sError
(
'ERROR, completion status not detected!!'
)
raise
Pt
sError
(
'ERROR, completion status not detected!!'
)
sys
.
exit
()
sys
.
exit
()
# Change to read mode
# Change to read mode
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j
-=
1
j
-=
1
if
j
==
0
:
if
j
==
0
:
error_flag
=
1
error_flag
=
1
raise
Tp
sWarning
(
'ERROR, completion status not detected!!'
)
raise
Pt
sWarning
(
'ERROR, completion status not detected!!'
)
# Read data from fifo
# Read data from fifo
while
transfer_len
>
0
:
while
transfer_len
>
0
:
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
#print 'TR_SIZE=%d' % tmp
break
break
elif
tmp
&
0xC
:
elif
tmp
&
0xC
:
raise
Tp
sWarning
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
raise
Pt
sWarning
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
tmp
=
self
.
gennum
.
iread
(
4
,
0x914
,
4
)
tmp
=
self
.
gennum
.
iread
(
4
,
0x914
,
4
)
return
total_transfer
return
total_transfer
i
-=
1
i
-=
1
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if
written
==
len
(
file_data
):
if
written
==
len
(
file_data
):
print
'EEPROM written with '
+
file_name
+
' content!'
print
'EEPROM written with '
+
file_name
+
' content!'
else
:
else
:
raise
Tp
sError
(
"ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file."
)
raise
Pt
sError
(
"ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file."
)
return
0
return
0
def
compare_eeprom_with_file
(
self
,
file_name
):
def
compare_eeprom_with_file
(
self
,
file_name
):
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
else
:
else
:
raise
Tp
sError
(
'EEPROM=
%.2
X, FILE=
%.2
X => ERROR'
%
(
eeprom_data
[
i
],
file_data
[
i
]))
raise
Pt
sError
(
'EEPROM=
%.2
X, FILE=
%.2
X => ERROR'
%
(
eeprom_data
[
i
],
file_data
[
i
]))
def
main
(
default_directory
=
'.'
):
def
main
(
default_directory
=
'.'
):
...
...
test/spec/python/test12_rollback.py
View file @
e52ac237
...
@@ -10,7 +10,7 @@ import sys
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
rr
import
time
import
time
import
os
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
"""
test10_rooback: overwrites GENNUM's EEPROM with the default value of GENNUM Vendor ID.
test10_rooback: overwrites GENNUM's EEPROM with the default value of GENNUM Vendor ID.
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if
tmp
&
0x1
:
if
tmp
&
0x1
:
break
break
elif
tmp
&
0xC
:
elif
tmp
&
0xC
:
raise
Tp
sError
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
raise
Pt
sError
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
sys
.
exit
()
sys
.
exit
()
i
-=
1
i
-=
1
if
i
==
0
:
if
i
==
0
:
raise
Tp
sError
(
'ERROR, completion status not detected!!'
)
raise
Pt
sError
(
'ERROR, completion status not detected!!'
)
sys
.
exit
()
sys
.
exit
()
# Change to read mode
# Change to read mode
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j
-=
1
j
-=
1
if
j
==
0
:
if
j
==
0
:
error_flag
=
1
error_flag
=
1
raise
Tp
sWarning
(
'ERROR, completion status not detected!!'
)
raise
Pt
sWarning
(
'ERROR, completion status not detected!!'
)
# Read data from fifo
# Read data from fifo
while
transfer_len
>
0
:
while
transfer_len
>
0
:
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
#print 'TR_SIZE=%d' % tmp
break
break
elif
tmp
&
0xC
:
elif
tmp
&
0xC
:
raise
Tp
sWarning
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
raise
Pt
sWarning
(
'NACK detected or TIMEOUT, IRT_STATUS = 0x
%
x!!'
%
tmp
)
tmp
=
self
.
gennum
.
iread
(
4
,
0x914
,
4
)
tmp
=
self
.
gennum
.
iread
(
4
,
0x914
,
4
)
return
total_transfer
return
total_transfer
i
-=
1
i
-=
1
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if
written
==
len
(
file_data
):
if
written
==
len
(
file_data
):
print
'EEPROM written with '
+
file_name
+
' content!'
print
'EEPROM written with '
+
file_name
+
' content!'
else
:
else
:
raise
Tp
sError
(
"ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file."
)
raise
Pt
sError
(
"ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file."
)
return
0
return
0
def
compare_eeprom_with_file
(
self
,
file_name
):
def
compare_eeprom_with_file
(
self
,
file_name
):
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
else
:
else
:
raise
Tp
sError
(
'EEPROM=
%.2
X, FILE=
%.2
X => ERROR'
%
(
eeprom_data
[
i
],
file_data
[
i
]))
raise
Pt
sError
(
'EEPROM=
%.2
X, FILE=
%.2
X => ERROR'
%
(
eeprom_data
[
i
],
file_data
[
i
]))
def
main
(
default_directory
=
'.'
):
def
main
(
default_directory
=
'.'
):
...
...
tpsexcept.py
View file @
e52ac237
#! /usr/bin/env python
#! /usr/bin/env python
# coding: utf8
# coding: utf8
class
Tp
sException
(
Exception
):
class
Pt
sException
(
Exception
):
pass
pass
class
TpsCritical
(
Tp
sException
):
class
PtsCritical
(
Pt
sException
):
"""critical error, abort the whole test suite"""
"""critical error, abort the whole test suite"""
pass
pass
class
TpsError
(
Tp
sException
):
class
PtsError
(
Pt
sException
):
"""error, continue remaining tests in test suite"""
"""error, continue remaining tests in test suite"""
pass
pass
class
TpsUser
(
Tp
sException
):
class
PtsUser
(
Pt
sException
):
"""error, user intervention required"""
"""error, user intervention required"""
pass
pass
class
TpsWarning
(
Tp
sException
):
class
PtsWarning
(
Pt
sException
):
"""warning, a cautionary message should be displayed"""
"""warning, a cautionary message should be displayed"""
pass
pass
class
TpsInvalid
(
Tp
sException
):
class
PtsInvalid
(
Pt
sException
):
"""reserved: invalid parameters"""
"""reserved: invalid parameters"""
class
TpsNoBatch
(
Tp
sInvalid
):
class
PtsNoBatch
(
Pt
sInvalid
):
"""reserved: a suite was created without batch of tests to run"""
"""reserved: a suite was created without batch of tests to run"""
pass
pass
class
TpsBadTestNo
(
Tp
sInvalid
):
class
PtsBadTestNo
(
Pt
sInvalid
):
"""reserved: a bad test number was given"""
"""reserved: a bad test number was given"""
pass
pass
...
...
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