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,
aka TPS of "Office Space" fame.
This is Production Test Suite project.
Supporting automated hardware testing at BE/CO/HT
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
from
ConfigParser
import
ConfigParser
,
NoOptionError
from
optparse
import
OptionParser
from
sha
import
sha
as
sha160
from
tp
sexcept
import
*
from
pt
sexcept
import
*
default_config_file
=
'
tp
sdefault.cfg'
default_log_pattern
=
'
tp
s_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_name
=
'
tp
s_run_{runid}_{timestamp}_{board}_{serial}.txt'
default_config_file
=
'
pt
sdefault.cfg'
default_log_pattern
=
'
pt
s_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_name
=
'
pt
s_run_{runid}_{timestamp}_{board}_{serial}.txt'
default_zip_name
=
'zip_run_{runid}_{timestamp}_{board}_{serial}.zip'
default_test_pattern
=
r'test[0-9][0-9]'
default_test_syntax
=
r'(test)?(\d\d)'
original_raw_input
=
raw_input
def
tp
s_raw_input
(
msg
,
default
=
'y'
):
def
pt
s_raw_input
(
msg
,
default
=
'y'
):
try
:
ret
=
original_raw_input
(
msg
)
except
EOFError
:
...
...
@@ -55,7 +55,7 @@ def run_test(testname, logname, yes=False):
if
yes
:
tmpin
=
sys
.
stdin
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
.
main
(
default_directory
=
'./test/spec/python'
)
finally
:
...
...
@@ -93,7 +93,7 @@ class Suite(object):
except
IOError
:
errmsg
=
'could not read configuration file {0}'
errmsg
=
errmsg
.
format
(
self
.
config
)
raise
Tp
sCritical
(
errmsg
)
raise
Pt
sCritical
(
errmsg
)
config
=
ConfigParser
(
cfg
)
try
:
...
...
@@ -131,10 +131,10 @@ class Suite(object):
if
not
self
.
board
:
msg
=
'invalid board name [{0}]'
.
format
(
self
.
board
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
if
not
self
.
serial
:
msg
=
'invalid serial number [{0}]'
.
format
(
self
.
serial
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
# self.serial = self.serial.strip(',')
if
not
self
.
extra_serial
:
self
.
extra_serial
=
'0000'
...
...
@@ -150,7 +150,7 @@ class Suite(object):
pass
except
IOError
:
msg
=
'invalid test path [{0}]'
.
format
(
self
.
test_path
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
try
:
tmp
=
os
.
tempnam
(
self
.
log_path
)
...
...
@@ -160,7 +160,7 @@ class Suite(object):
pass
except
:
msg
=
'invalid log path [{0}]'
.
format
(
self
.
log_path
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
if
not
self
.
repeat
:
self
.
repeat
=
1
...
...
@@ -169,17 +169,17 @@ class Suite(object):
self
.
repeat
=
int
(
self
.
repeat
)
except
ValueError
:
msg
=
'invalid repeat factor [{0}]'
.
format
(
self
.
repeat
)
raise
Tp
sInvalid
(
msg
)
raise
Pt
sInvalid
(
msg
)
if
not
self
.
sequence
:
raise
Tp
sNoBatch
(
'null test sequence'
)
raise
Pt
sNoBatch
(
'null test sequence'
)
run
=
[]
for
testno
in
self
.
sequence
:
test_glob
=
os
.
path
.
join
(
self
.
test_path
,
'test'
+
testno
+
'.py'
)
files
=
glob
.
glob
(
test_glob
)
if
not
files
:
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
])
if
self
.
randomize
:
...
...
@@ -252,17 +252,17 @@ class Suite(object):
log
.
write
(
'running test {0} = {1}
\n
'
.
format
(
shortname
,
test
))
print
'running test '
+
shortname
run_test
(
testname
,
logname
,
yes
=
self
.
yes
)
except
Tp
sCritical
,
e
:
except
Pt
sCritical
,
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
(
' cannot continue, aborting test suite'
)
failures
.
append
((
shortname
,
e
,
))
break
except
Tp
sError
,
e
:
except
Pt
sError
,
e
:
print
'test [
%
s]: error, continuing: [
%
s]'
%
(
shortname
,
e
)
log
.
write
(
' error in test {0}, exception [{1}]
\n
'
.
format
(
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
)
log
.
write
(
' error in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
failures
.
append
((
shortname
,
e
,
))
...
...
@@ -280,7 +280,7 @@ class Suite(object):
elif
ans
==
'c'
:
log
.
write
(
' user intervention: continue
\n
'
)
continue
except
Tp
sWarning
,
e
:
except
Pt
sWarning
,
e
:
print
'test [
%
s]: warning: [
%
s]'
%
(
shortname
,
e
)
log
.
write
(
' warning in test {0}, exception [{1}]
\n
'
.
format
(
shortname
,
e
))
failures
.
append
((
shortname
,
e
,
))
...
...
@@ -477,7 +477,7 @@ def main():
s
.
sequence
=
valid
try
:
s
.
validate_and_compute_run
()
except
Tp
sInvalid
,
e
:
except
Pt
sInvalid
,
e
:
print
'bad parameters:'
,
e
return
...
...
tp
s.sh
→
pt
s.sh
View file @
e52ac237
...
...
@@ -3,7 +3,7 @@
LOGDIR
=
./log
mkdir
-p
$LOGDIR
sudo rm
-fr
$LOGDIR
/
tp
s
*
sudo rm
-fr
$LOGDIR
/
pt
s
*
serial
=
$1
if
[
x
$1
=
x
""
]
;
then
...
...
@@ -28,7 +28,7 @@ echo -n "Press enter to continue...\n"
read
tmp
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... "
...
...
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
# coding: utf8
class
Tp
sException
(
Exception
):
class
Pt
sException
(
Exception
):
pass
class
TpsCritical
(
Tp
sException
):
class
PtsCritical
(
Pt
sException
):
"""critical error, abort the whole test suite"""
pass
class
TpsError
(
Tp
sException
):
class
PtsError
(
Pt
sException
):
"""error, continue remaining tests in test suite"""
pass
class
TpsUser
(
Tp
sException
):
class
PtsUser
(
Pt
sException
):
"""error, user intervention required"""
pass
class
TpsWarning
(
Tp
sException
):
class
PtsWarning
(
Pt
sException
):
"""warning, a cautionary message should be displayed"""
pass
class
TpsInvalid
(
Tp
sException
):
class
PtsInvalid
(
Pt
sException
):
"""reserved: invalid parameters"""
class
TpsNoBatch
(
Tp
sInvalid
):
class
PtsNoBatch
(
Pt
sInvalid
):
"""reserved: a suite was created without batch of tests to run"""
pass
class
TpsBadTestNo
(
Tp
sInvalid
):
class
PtsBadTestNo
(
Pt
sInvalid
):
"""reserved: a bad test number was given"""
pass
...
...
test/example/python/test00.py
View file @
e52ac237
...
...
@@ -10,7 +10,7 @@ import sys
import
rr
# Needed for accessing the rawrabbit driver
import
time
import
os
from
tp
sexcept
import
*
# Declaration of Exceptions
from
pt
sexcept
import
*
# Declaration of Exceptions
"""
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
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test02: checks the EEPROM of the GENNUM chip.
...
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if
tmp
&
0x1
:
break
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
()
i
-=
1
if
i
==
0
:
raise
Tp
sError
(
'ERROR, completion status not detected!!'
)
raise
Pt
sError
(
'ERROR, completion status not detected!!'
)
sys
.
exit
()
# Change to read mode
...
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j
-=
1
if
j
==
0
:
error_flag
=
1
raise
Tp
sWarning
(
'ERROR, completion status not detected!!'
)
raise
Pt
sWarning
(
'ERROR, completion status not detected!!'
)
# Read data from fifo
while
transfer_len
>
0
:
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
...
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
break
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
)
return
total_transfer
i
-=
1
...
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if
written
==
len
(
file_data
):
print
'EEPROM written with '
+
file_name
+
' content!'
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
def
compare_eeprom_with_file
(
self
,
file_name
):
...
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
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
):
if
file_name
==
""
:
...
...
test/spec/python/test01.py
View file @
e52ac237
...
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test00: checks voltage of the power pins in FMC connector.
...
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
self
.
wait_busy
()
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
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
...
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
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
):
cmd
=
self
.
CR_RD
;
...
...
@@ -172,15 +172,15 @@ def main (default_directory='.'):
# Check the values of the ADC.
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
)
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
)
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
)
if
__name__
==
'__main__'
:
...
...
test/spec/python/test02.py
View file @
e52ac237
...
...
@@ -13,7 +13,7 @@ import time
import
os
import
errno
from
tp
sexcept
import
*
# jdgc
from
pt
sexcept
import
*
# jdgc
"""
test01: checks the low speed pins of FMC connector (low count connector).
...
...
@@ -1104,7 +1104,7 @@ def summary_results(testStatus):
for
i
in
sorted
(
testStatus
.
keys
()):
if
testStatus
[
i
]
==
'Fail'
:
raise
Tp
sError
(
"FMC connector failure"
)
raise
Pt
sError
(
"FMC connector failure"
)
print
string
...
...
test/spec/python/test03.py
View file @
e52ac237
...
...
@@ -12,7 +12,7 @@ import time
import
os
import
os.path
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.
...
...
@@ -40,7 +40,7 @@ def main (default_directory='.'):
flash
.
lib
.
gpio_bootselect
(
flash
.
GENNUM_FLASH
);
version
=
hex
(
flash
.
lib
.
flash_read_id
());
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.
print
"Starting the process to load a FW into Flash memory"
...
...
@@ -74,7 +74,7 @@ def main (default_directory='.'):
sys
.
stdout
=
tmp_stdout
;
sys
.
stdin
=
tmp_stdin
;
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__'
:
main
();
test/spec/python/test04.py
View file @
e52ac237
...
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test00: checks the presence of the SFP connector and reads the type of connector
...
...
@@ -146,7 +146,7 @@ def main (default_directory='.'):
if
(
type
==
3
)
:
print
"Type is correct"
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__'
:
main
();
...
...
test/spec/python/test05.py
View file @
e52ac237
...
...
@@ -13,7 +13,7 @@ import sys
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test05: check SATA ports and high speed pins on FMC connector (low count connector).
...
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
self
.
wait_busy
()
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
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
...
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
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
):
cmd
=
self
.
CR_RD
;
...
...
@@ -263,7 +263,7 @@ class CSI570 :
break
;
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
;
rfreq
=
int
((
tmp
*
(
2
**
28
)));
...
...
@@ -397,7 +397,7 @@ class CMinic:
mask
=
1
<<
2
;
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
)
:
# Setup RX
...
...
@@ -555,7 +555,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
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
);
...
...
@@ -574,7 +574,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
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
)
...
...
@@ -594,7 +594,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
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
);
...
...
@@ -613,7 +613,7 @@ def main (default_directory='.'):
if
(
p
.
is_alive
())
:
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__'
:
main
();
test/spec/python/test06.py
View file @
e52ac237
...
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test06: checks Silabs SI570 oscillator.
...
...
@@ -70,7 +70,7 @@ class COpenCoresI2C:
self
.
wait_busy
()
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
):
self
.
wr_reg
(
self
.
R_TXR
,
data
);
...
...
@@ -80,7 +80,7 @@ class COpenCoresI2C:
self
.
wr_reg
(
self
.
R_CR
,
cmd
);
self
.
wait_busy
();
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
):
cmd
=
self
.
CR_RD
;
...
...
@@ -220,7 +220,7 @@ class CSI570 :
break
;
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
;
rfreq
=
int
((
tmp
*
(
2
**
28
)));
...
...
@@ -260,7 +260,7 @@ def main (default_directory='.'):
if
(
gennum
.
iread
(
0
,
0x80000
,
4
))
:
print
"SI570 CLK present: OK"
else
:
raise
Tp
sError
(
"SIS570 CLK present: FAILED"
)
raise
Pt
sError
(
"SIS570 CLK present: FAILED"
)
if
__name__
==
'__main__'
:
main
();
test/spec/python/test07.py
View file @
e52ac237
...
...
@@ -15,7 +15,7 @@ import i2c
import
gn4124
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test07: checks data and address lines of DDR memory.
...
...
@@ -54,7 +54,7 @@ def main (default_directory='.'):
num_data_lines
=
16
;
if
(
len
(
pages
)
<
(
num_addr_lines
+
2
))
:
raise
Tp
sError
(
"Not enough pages"
);
raise
Pt
sError
(
"Not enough pages"
);
data
=
0xDEADBABE
# Clear memory pages
...
...
@@ -174,7 +174,7 @@ def main (default_directory='.'):
if
(
error
)
:
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
:
print
"RESULT: [OK]"
...
...
test/spec/python/test08.py
View file @
e52ac237
...
...
@@ -12,7 +12,7 @@ import rr
import
time
import
math
import
os.path
from
tp
sexcept
import
*
# jdgc
from
pt
sexcept
import
*
# jdgc
""" SPEC test for two clock domains.
...
...
@@ -368,7 +368,7 @@ def main (default_directory='.'):
for
i
in
range
(
0
,
len
(
double_counter
.
results
)):
if
(
double_counter
.
results
[
i
]
==
False
):
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
:
print
"Test "
+
str
(
i
)
+
":
\t
PASS"
...
...
test/spec/python/test09.py
View file @
e52ac237
...
...
@@ -11,7 +11,7 @@ import rr
import
time
import
os
from
ctypes
import
*
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test09: reads serial number of the temperature sensor.
...
...
test/spec/python/test10.py
View file @
e52ac237
...
...
@@ -11,7 +11,7 @@ import rr
import
time
import
os
import
serial
from
tp
sexcept
import
*
from
pt
sexcept
import
*
from
multiprocessing
import
Process
"""
...
...
@@ -62,7 +62,7 @@ def rx_thread(ser):
char1
=
ser
.
read
(
1
);
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
...
...
@@ -91,7 +91,7 @@ def main (default_directory='.'):
char1
=
uart
.
read
();
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
);
...
...
test/spec/python/test12.py
View file @
e52ac237
...
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test10: overwrites GENNUM EEPROM with VENDOR ID, DEVICE ID of SPEC Board.
...
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if
tmp
&
0x1
:
break
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
()
i
-=
1
if
i
==
0
:
raise
Tp
sError
(
'ERROR, completion status not detected!!'
)
raise
Pt
sError
(
'ERROR, completion status not detected!!'
)
sys
.
exit
()
# Change to read mode
...
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j
-=
1
if
j
==
0
:
error_flag
=
1
raise
Tp
sWarning
(
'ERROR, completion status not detected!!'
)
raise
Pt
sWarning
(
'ERROR, completion status not detected!!'
)
# Read data from fifo
while
transfer_len
>
0
:
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
...
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
break
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
)
return
total_transfer
i
-=
1
...
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if
written
==
len
(
file_data
):
print
'EEPROM written with '
+
file_name
+
' content!'
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
def
compare_eeprom_with_file
(
self
,
file_name
):
...
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
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
=
'.'
):
...
...
test/spec/python/test12_rollback.py
View file @
e52ac237
...
...
@@ -10,7 +10,7 @@ import sys
import
rr
import
time
import
os
from
tp
sexcept
import
*
from
pt
sexcept
import
*
"""
test10_rooback: overwrites GENNUM's EEPROM with the default value of GENNUM Vendor ID.
...
...
@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if
tmp
&
0x1
:
break
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
()
i
-=
1
if
i
==
0
:
raise
Tp
sError
(
'ERROR, completion status not detected!!'
)
raise
Pt
sError
(
'ERROR, completion status not detected!!'
)
sys
.
exit
()
# Change to read mode
...
...
@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j
-=
1
if
j
==
0
:
error_flag
=
1
raise
Tp
sWarning
(
'ERROR, completion status not detected!!'
)
raise
Pt
sWarning
(
'ERROR, completion status not detected!!'
)
# Read data from fifo
while
transfer_len
>
0
:
read_data
.
append
(
0xFF
&
self
.
gennum
.
iread
(
4
,
self
.
I2C_DATA
,
4
))
...
...
@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
break
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
)
return
total_transfer
i
-=
1
...
...
@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if
written
==
len
(
file_data
):
print
'EEPROM written with '
+
file_name
+
' content!'
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
def
compare_eeprom_with_file
(
self
,
file_name
):
...
...
@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if
file_data
[
i
]
==
eeprom_data
[
i
]:
print
'EEPROM=
%.2
X, FILE=
%.2
X => OK'
%
(
eeprom_data
[
i
],
file_data
[
i
])
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
=
'.'
):
...
...
tpsexcept.py
View file @
e52ac237
#! /usr/bin/env python
# coding: utf8
class
Tp
sException
(
Exception
):
class
Pt
sException
(
Exception
):
pass
class
TpsCritical
(
Tp
sException
):
class
PtsCritical
(
Pt
sException
):
"""critical error, abort the whole test suite"""
pass
class
TpsError
(
Tp
sException
):
class
PtsError
(
Pt
sException
):
"""error, continue remaining tests in test suite"""
pass
class
TpsUser
(
Tp
sException
):
class
PtsUser
(
Pt
sException
):
"""error, user intervention required"""
pass
class
TpsWarning
(
Tp
sException
):
class
PtsWarning
(
Pt
sException
):
"""warning, a cautionary message should be displayed"""
pass
class
TpsInvalid
(
Tp
sException
):
class
PtsInvalid
(
Pt
sException
):
"""reserved: invalid parameters"""
class
TpsNoBatch
(
Tp
sInvalid
):
class
PtsNoBatch
(
Pt
sInvalid
):
"""reserved: a suite was created without batch of tests to run"""
pass
class
TpsBadTestNo
(
Tp
sInvalid
):
class
PtsBadTestNo
(
Pt
sInvalid
):
"""reserved: a bad test number was given"""
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