Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
FMC ADC 100M 14b 4cha - Testing
Commits
4393db5d
Commit
4393db5d
authored
Jun 21, 2011
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tps: add zip collection of log files
parent
1215dae1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
tps.py
tps.py
+17
-1
No files found.
tps.py
View file @
4393db5d
#! /user/dcobas/2.7.1/bin/python
#! /usr/bin/env python
# coding: utf8
...
...
@@ -16,6 +15,7 @@ import stat
import
datetime
import
random
import
warnings
import
zipfile
from
ConfigParser
import
ConfigParser
,
NoOptionError
from
optparse
import
OptionParser
...
...
@@ -25,6 +25,7 @@ from tpsexcept import *
default_config_file
=
'tpsdefault.cfg'
default_log_pattern
=
'tps_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_name
=
'tps_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)'
...
...
@@ -37,6 +38,11 @@ def tps_raw_input(msg, default='y'):
return
default
return
ret
def
make_zip
(
zipname
,
ziplist
):
with
zipfile
.
ZipFile
(
zipname
,
'w'
)
as
z
:
for
f
in
ziplist
:
z
.
write
(
f
)
def
run_test
(
testname
,
logname
,
yes
=
False
):
"""run test testname with output redirected to logname
...
...
@@ -68,6 +74,7 @@ class Suite(object):
self
.
config
=
default_config_file
self
.
log_pattern
=
default_log_pattern
self
.
log_name
=
default_log_name
self
.
zip_name
=
default_zip_name
#self.read_config(self.config)
def
missing
(
self
):
...
...
@@ -185,6 +192,12 @@ class Suite(object):
runid
=
runid
)
logfilename
=
os
.
path
.
join
(
self
.
log_path
,
logfilename
)
log
=
file
(
logfilename
,
'wb'
)
zipfilename
=
self
.
zip_name
.
format
(
board
=
self
.
board
,
serial
=
self
.
serial
,
timestamp
=
ts
,
runid
=
runid
)
zipfilename
=
os
.
path
.
join
(
self
.
log_path
,
zipfilename
)
ziplist
=
[
logfilename
]
if
self
.
test_path
not
in
sys
.
path
:
sys
.
path
.
append
(
self
.
test_path
)
...
...
@@ -206,6 +219,7 @@ class Suite(object):
runid
=
runid
,
number
=
shortname
)
logname
=
os
.
path
.
join
(
self
.
log_path
,
logname
)
ziplist
.
append
(
logname
)
log
.
write
(
'------------------------
\n
'
)
log
.
write
(
'running test {0} = {1}
\n
'
.
format
(
shortname
,
test
))
print
'.'
,
...
...
@@ -259,6 +273,8 @@ class Suite(object):
log
.
write
(
msg
)
log
.
close
()
make_zip
(
zipfilename
,
ziplist
)
def
get_serial
():
"""return serial number of current board to test
"""
...
...
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