Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite - base
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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 - base
Commits
1eb97d57
Commit
1eb97d57
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
214b6c87
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
31 deletions
+48
-31
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
tpsexcept.py
tpsexcept.py
+8
-8
No files found.
LICENSE
0 → 100644
View file @
1eb97d57
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 @
1eb97d57
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 @
1eb97d57
...
@@ -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 @
1eb97d57
...
@@ -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 @
1eb97d57
File moved
tpsexcept.py
View file @
1eb97d57
#! /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