Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
Conv TTL RS485 - Testing
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
Conv TTL RS485 - Testing
Commits
b0b9d9de
Commit
b0b9d9de
authored
Jan 18, 2019
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pts.py a bit more robust and verbose
parent
0e6be66a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
27 deletions
+30
-27
pts.py
pts-fm/python/pts.py
+30
-27
No files found.
pts-fm/python/pts.py
View file @
b0b9d9de
...
...
@@ -153,9 +153,9 @@ if __name__ == '__main__':
print
"ERROR: Bitstream download fail. Check JTAG connectivity."
else
:
# Run JPTS in another shell script; JPTS will handle running each of the test scripts
cmd
=
"xterm -e ./jpts -s
%
s
%
s"
%
(
sn1
,
sn2
)
cmd
=
"xterm -e ./jpts -
d -
s
%
s
%
s"
%
(
sn1
,
sn2
)
print
"Running tests :
%
s
\n
"
%
(
cmd
)
subprocess
.
call
(
cmd
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
subprocess
.
call
(
cmd
,
shell
=
True
)
ret
=
subprocess
.
call
(
"grep FAIL log/*.log"
,
shell
=
True
,
stdout
=
fnull
,
stderr
=
fnull
)
if
(
ret
==
0
):
...
...
@@ -208,34 +208,38 @@ if __name__ == '__main__':
#Read unique board ID
IDMS
=
bus
.
vv_read
(
UIDREGMS
)
IDLS
=
bus
.
vv_read
(
UIDREGLS
)
#Generate log file
# Generate output file named according to current time
try
:
IDMS
=
bus
.
vv_read
(
UIDREGMS
)
IDLS
=
bus
.
vv_read
(
UIDREGLS
)
fname
=
time
.
strftime
(
"serial-num-CTDAP-
%
Y-
%
m-
%
d"
,
time
.
localtime
())
+
".txt"
ret
=
subprocess
.
call
([
"ls /home/pts-administrator/pts/log/t485 | grep "
+
fname
],
shell
=
True
,
stdout
=
None
,
stderr
=
None
)
#print ("%d" % ret)
if
(
ret
!=
0
):
f
=
open
(
"/home/pts-administrator/pts/log/t485/"
+
fname
,
"w"
)
print
(
" File not found ... Create new one
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"CONV-TTL-RS485 Upgrade log created on
%
s
\n
"
%
time
.
strftime
(
"
%
Y-
%
m-
%
d-
%
Hh
%
Mm
%
Ss"
,
time
.
localtime
()))
f
.
write
(
"---------------------------------------------------------------------------------
\n
"
)
f
.
write
(
"Barcode 1 | Barcode 2 | PCB ID |
\n
"
)
f
.
write
(
"---------------------------------------------------------------------------------
\n
"
)
f
.
close
()
print
(
"Upgrade log can be found in /home/pts-administrator/pts/log/t485/
%
s
\n
"
%
fname
)
print
(
"Board unique ID can be found in /home/pts-administrator/pts/log/t485/
%
s
\n
"
%
fname
)
f
=
open
(
"/home/pts-administrator/pts/log/t485/"
+
fname
,
"a"
)
f
.
write
(
"
%
s
\t
%
s
\t
%
x
%
x
\n
"
%
(
sn1
,
sn2
,
IDMS
,
IDLS
)
)
#Generate log file
f
.
close
()
# Generate output file named according to current time
fname
=
time
.
strftime
(
"serial-num-CTDAP-
%
Y-
%
m-
%
d"
,
time
.
localtime
())
+
".txt"
ret
=
subprocess
.
call
([
"ls /home/pts-administrator/pts/log/t485 | grep "
+
fname
],
shell
=
True
,
stdout
=
None
,
stderr
=
None
)
#print ("%d" % ret)
if
(
ret
!=
0
):
f
=
open
(
"/home/pts-administrator/pts/log/t485/"
+
fname
,
"w"
)
print
(
" File not found ... Create new one
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"CONV-TTL-RS485 Upgrade log created on
%
s
\n
"
%
time
.
strftime
(
"
%
Y-
%
m-
%
d-
%
Hh
%
Mm
%
Ss"
,
time
.
localtime
()))
f
.
write
(
"---------------------------------------------------------------------------------
\n
"
)
f
.
write
(
"Barcode 1 | Barcode 2 | PCB ID |
\n
"
)
f
.
write
(
"---------------------------------------------------------------------------------
\n
"
)
f
.
close
()
print
(
"Upgrade log can be found in /home/pts-administrator/pts/log/t485/
%
s
\n
"
%
fname
)
print
(
"Board unique ID can be found in /home/pts-administrator/pts/log/t485/
%
s
\n
"
%
fname
)
f
=
open
(
"/home/pts-administrator/pts/log/t485/"
+
fname
,
"a"
)
f
.
write
(
"
%
s
\t
%
s
\t
%
x
%
x
\n
"
%
(
sn1
,
sn2
,
IDMS
,
IDLS
)
)
f
.
close
()
except
:
print
""
print
"BOARD FAILED..."
#-------------------------------------------------------------------------------
# We're done, turn off the VME crate
...
...
@@ -263,4 +267,3 @@ if __name__ == '__main__':
sys
.
exit
(
1
)
else
:
ok
=
raw_input
(
"--> To exit PTS, type 'ok': "
)
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