Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Starting Kit
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
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
White Rabbit Starting Kit
Commits
78e6a2b1
Commit
78e6a2b1
authored
Aug 05, 2019
by
manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt the tests to the new tools
parent
8269bb7c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
33 deletions
+41
-33
dio.py
test/validation/dio.py
+4
-4
testAdvDIO.py
test/validation/testAdvDIO.py
+14
-8
testDIO.py
test/validation/testDIO.py
+22
-20
vuart.py
test/validation/vuart.py
+1
-1
No files found.
test/validation/dio.py
View file @
78e6a2b1
...
@@ -12,7 +12,7 @@ from ssh import SshCmd,SshCmdException
...
@@ -12,7 +12,7 @@ from ssh import SshCmd,SshCmdException
## Class DIO
## Class DIO
#
#
class
DIO
():
class
DIO
():
def
__init__
(
self
,
hostName
,
userName
,
password
,
interfaceName
):
def
__init__
(
self
,
hostName
,
userName
,
password
,
busId
):
"""
"""
Construcctor
Construcctor
...
@@ -20,13 +20,13 @@ class DIO ():
...
@@ -20,13 +20,13 @@ class DIO ():
hostName: ip or hostname
hostName: ip or hostname
userName: username
userName: username
password : password
password : password
interfaceName: interface name
busId: number PCIe bus
"""
"""
self
.
hostName
=
hostName
self
.
hostName
=
hostName
self
.
userName
=
userName
self
.
userName
=
userName
self
.
password
=
password
self
.
password
=
password
self
.
interfaceName
=
interfaceName
self
.
busId
=
busId
self
.
command
=
"sudo wr-dio-cmd
"
+
interfaceName
self
.
command
=
"sudo wr-dio-cmd
/dev/fmc-dio-
%
i:0"
%
int
(
busId
,
16
)
self
.
sshCmd
=
SshCmd
()
self
.
sshCmd
=
SshCmd
()
def
configurePort
(
self
,
channel
,
mode
):
def
configurePort
(
self
,
channel
,
mode
):
...
...
test/validation/testAdvDIO.py
View file @
78e6a2b1
...
@@ -38,7 +38,7 @@ def findTimestamp(listStamp1,listStamp2,offset):
...
@@ -38,7 +38,7 @@ def findTimestamp(listStamp1,listStamp2,offset):
return
False
return
False
def
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName
2
):
def
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
busId1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
busId
2
):
"""
"""
Check the pulses generated on a remote board
Check the pulses generated on a remote board
...
@@ -47,33 +47,34 @@ def testAdvDIO(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
...
@@ -47,33 +47,34 @@ def testAdvDIO(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
username1: user name host 1
username1: user name host 1
password1: password
password1: password
interfaceName1 : interface name
interfaceName1 : interface name
busId1: number PCIe bus PC 1
hostName2: ip remote host 2
hostName2: ip remote host 2
username2: user name host 2
username2: user name host 2
password2: password
password2: password
interfaceName2 : interface name
interfaceName2 : interface name
busId2: number PCIe bus PC 2
Raises:
Raises:
error test
error test
"""
"""
try
:
try
:
sshCmd1
=
SshCmd
()
sshCmd1
=
SshCmd
()
sshCmd2
=
SshCmd
()
sshCmd2
=
SshCmd
()
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
interfaceName
1
)
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
busId
1
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
interfaceName
2
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
busId
2
)
dio1
.
configurePorts
(
"pdiii"
)
dio1
.
configurePorts
(
"pdiii"
)
dio2
.
configurePorts
(
"iiiii"
)
dio2
.
configurePorts
(
"iiiii"
)
dio1
.
clearTimestamps
()
dio1
.
clearTimestamps
()
dio2
.
clearTimestamps
()
dio2
.
clearTimestamps
()
command
=
"sudo wr-dio-agent
"
+
interfaceName1
command
=
"sudo wr-dio-agent
%
s /dev/fmc-dio-
%
i:0"
%
(
interfaceName1
,
int
(
busId1
,
16
))
sshCmd1
.
exec
(
hostName1
,
command
,
userName1
,
password1
,
False
)
sshCmd1
.
exec
(
hostName1
,
command
,
userName1
,
password1
,
False
)
command
=
"sudo wr-dio-ruler
"
+
interfaceName1
+
" IN0 R1+"
+
str
(
delay
)
command
=
"sudo wr-dio-ruler
%
s /dev/fmc-dio-
%
i:0 IN0 R1+
%
s"
%
(
interfaceName2
,
int
(
busId1
,
16
),
str
(
delay
)
)
sshCmd2
.
exec
(
hostName2
,
command
,
userName2
,
password2
,
False
)
sshCmd2
.
exec
(
hostName2
,
command
,
userName2
,
password2
,
False
)
totalOffset
=
delay
+
maxOffset
totalOffset
=
delay
+
maxOffset
time
.
sleep
(
2
)
time
.
sleep
(
2
)
if
(
not
findTimestamp
(
dio1
.
getTimestamp
(
0
),
dio1
.
getTimestamp
(
1
),
totalOffset
)):
if
(
not
findTimestamp
(
dio1
.
getTimestamp
(
0
),
dio1
.
getTimestamp
(
1
),
totalOffset
)):
raise
raise
except
SshCmdException
as
e
:
except
SshCmdException
as
e
:
sshCmd
.
printSshErrorCommand
(
e
.
strError
,
command
)
SshCmd
.
printSshErrorCommand
(
e
.
strError
,
command
)
print
(
"Test advanced error"
)
raise
raise
except
:
except
:
print
(
"Test advanced error"
)
print
(
"Test advanced error"
)
...
@@ -91,14 +92,17 @@ def main(configuration):
...
@@ -91,14 +92,17 @@ def main(configuration):
userName1
=
configuration
[
"userName1"
]
userName1
=
configuration
[
"userName1"
]
password1
=
configuration
[
"password1"
]
password1
=
configuration
[
"password1"
]
interfaceName1
=
configuration
[
"interfaceName1"
]
interfaceName1
=
configuration
[
"interfaceName1"
]
busIdSpec1
=
configuration
[
"busIdSpec1"
]
hostName2
=
configuration
[
"hostName2"
]
hostName2
=
configuration
[
"hostName2"
]
userName2
=
configuration
[
"userName2"
]
userName2
=
configuration
[
"userName2"
]
password2
=
configuration
[
"password2"
]
password2
=
configuration
[
"password2"
]
interfaceName2
=
configuration
[
"interfaceName2"
]
interfaceName2
=
configuration
[
"interfaceName2"
]
busIdSpec2
=
configuration
[
"busIdSpec2"
]
try
:
try
:
print
(
"This test needs White Rabbit working"
)
print
(
"Executing advanced DIO test"
)
print
(
"Executing advanced DIO test"
)
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName
2
)
testAdvDIO
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
busIdSpec1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
busIdSpec
2
)
print
(
"Test advanced DIO: successful"
)
print
(
"Test advanced DIO: successful"
)
except
:
except
:
print
(
"Test advanced DIO: error"
)
print
(
"Test advanced DIO: error"
)
...
@@ -115,10 +119,12 @@ if __name__ == '__main__':
...
@@ -115,10 +119,12 @@ if __name__ == '__main__':
configuration
[
"userName1"
]
=
config
.
get
(
'pc1'
,
"userName"
)
configuration
[
"userName1"
]
=
config
.
get
(
'pc1'
,
"userName"
)
configuration
[
"password1"
]
=
config
.
get
(
'pc1'
,
"password"
)
configuration
[
"password1"
]
=
config
.
get
(
'pc1'
,
"password"
)
configuration
[
"interfaceName1"
]
=
config
.
get
(
'pc1'
,
"interfaceName"
)
configuration
[
"interfaceName1"
]
=
config
.
get
(
'pc1'
,
"interfaceName"
)
configuration
[
"busIdSpec1"
]
=
config
.
get
(
'pc1'
,
"busIdSpec"
)
configuration
[
"hostName2"
]
=
config
.
get
(
'pc2'
,
"hostName"
)
configuration
[
"hostName2"
]
=
config
.
get
(
'pc2'
,
"hostName"
)
configuration
[
"userName2"
]
=
config
.
get
(
'pc2'
,
"userName"
)
configuration
[
"userName2"
]
=
config
.
get
(
'pc2'
,
"userName"
)
configuration
[
"password2"
]
=
config
.
get
(
'pc2'
,
"password"
)
configuration
[
"password2"
]
=
config
.
get
(
'pc2'
,
"password"
)
configuration
[
"interfaceName2"
]
=
config
.
get
(
'pc2'
,
"interfaceName"
)
configuration
[
"interfaceName2"
]
=
config
.
get
(
'pc2'
,
"interfaceName"
)
configuration
[
"busIdSpec2"
]
=
config
.
get
(
'pc2'
,
"busIdSpec"
)
main
(
configuration
)
main
(
configuration
)
except
configparser
.
Error
as
e
:
except
configparser
.
Error
as
e
:
...
...
test/validation/testDIO.py
View file @
78e6a2b1
...
@@ -35,7 +35,7 @@ def findTimestamp(listStamp1,listStamp2,offset):
...
@@ -35,7 +35,7 @@ def findTimestamp(listStamp1,listStamp2,offset):
return
False
return
False
def
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName
2
,
channel
):
def
tryChannel
(
hostName1
,
userName1
,
password1
,
busId1
,
hostName2
,
userName2
,
password2
,
busId
2
,
channel
):
"""
"""
Try the input and output of channel
Try the input and output of channel
...
@@ -43,18 +43,18 @@ def tryChannel(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
...
@@ -43,18 +43,18 @@ def tryChannel(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
hostName1: ip remote host 1
hostName1: ip remote host 1
username1: user name host 1
username1: user name host 1
password1: password
password1: password
interfaceName1 : interface name
busId1: number PCIe bus PC 1
hostName2: ip remote host 2
hostName2: ip remote host 2
username2: user name host 2
username2: user name host 2
password2: password
password2: password
interfaceName2 : interface name
busId2: number PCIe bus PC 2
channel: number of channel to try(0 to 4)
channel: number of channel to try(0 to 4)
R
aises
:
R
eturn
:
error channel
True if the channel fail, False otherwise
"""
"""
try
:
try
:
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
interfaceName
1
)
dio1
=
DIO
(
hostName1
,
userName1
,
password1
,
busId
1
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
interfaceName
2
)
dio2
=
DIO
(
hostName2
,
userName2
,
password2
,
busId
2
)
dio1
.
configurePorts
(
"pdddd"
)
dio1
.
configurePorts
(
"pdddd"
)
dio2
.
configurePorts
(
"iiiii"
)
dio2
.
configurePorts
(
"iiiii"
)
dio1
.
clearTimestamps
()
dio1
.
clearTimestamps
()
...
@@ -78,13 +78,14 @@ def tryChannel(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
...
@@ -78,13 +78,14 @@ def tryChannel(hostName1,userName1,password1,interfaceName1,hostName2,userName2,
if
(
findTimestamp
(
dio1
.
getTimestamp
(
channel
),
dio2
.
getTimestamp
(
channel
),
maxOffset
)):
if
(
findTimestamp
(
dio1
.
getTimestamp
(
channel
),
dio2
.
getTimestamp
(
channel
),
maxOffset
)):
print
(
"Channel"
,
channel
,
": ok in host:"
,
hostName1
,
"and host:"
,
hostName2
)
print
(
"Channel"
,
channel
,
": ok in host:"
,
hostName1
,
"and host:"
,
hostName2
)
return
False
else
:
else
:
raise
raise
else
:
else
:
raise
raise
except
:
except
:
print
(
"Channel"
,
channel
,
": error in host:"
,
hostName1
,
"or host:"
,
hostName2
)
print
(
"Channel"
,
channel
,
": error in host:"
,
hostName1
,
"or host:"
,
hostName2
)
r
ais
e
r
eturn
Tru
e
#--------------------------------------------------#
#--------------------------------------------------#
...
@@ -97,21 +98,22 @@ def main(configuration):
...
@@ -97,21 +98,22 @@ def main(configuration):
hostName1
=
configuration
[
"hostName1"
]
hostName1
=
configuration
[
"hostName1"
]
userName1
=
configuration
[
"userName1"
]
userName1
=
configuration
[
"userName1"
]
password1
=
configuration
[
"password1"
]
password1
=
configuration
[
"password1"
]
interfaceName1
=
configuration
[
"interfaceName
1"
]
busIdSpec1
=
configuration
[
"busIdSpec
1"
]
hostName2
=
configuration
[
"hostName2"
]
hostName2
=
configuration
[
"hostName2"
]
userName2
=
configuration
[
"userName2"
]
userName2
=
configuration
[
"userName2"
]
password2
=
configuration
[
"password2"
]
password2
=
configuration
[
"password2"
]
interfaceName2
=
configuration
[
"interfaceName
2"
]
busIdSpec2
=
configuration
[
"busIdSpec
2"
]
try
:
error
=
False
print
(
"Executing DIO test"
)
numberChannels
=
5
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
0
)
print
(
"This test needs White Rabbit working"
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
1
)
print
(
"Executing DIO test"
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
2
)
for
i
in
range
(
numberChannels
):
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
3
)
error
|=
tryChannel
(
hostName1
,
userName1
,
password1
,
busIdSpec1
,
hostName2
,
userName2
,
password2
,
busIdSpec2
,
i
)
tryChannel
(
hostName1
,
userName1
,
password1
,
interfaceName1
,
hostName2
,
userName2
,
password2
,
interfaceName2
,
4
)
if
(
not
error
):
print
(
"Test DIO: successful"
)
print
(
"Test DIO: successful"
)
e
xcept
:
e
lse
:
print
(
"Test DIO: error"
)
print
(
"Test DIO: error"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -125,11 +127,11 @@ if __name__ == '__main__':
...
@@ -125,11 +127,11 @@ if __name__ == '__main__':
configuration
[
"hostName1"
]
=
config
.
get
(
'pc1'
,
"hostName"
)
configuration
[
"hostName1"
]
=
config
.
get
(
'pc1'
,
"hostName"
)
configuration
[
"userName1"
]
=
config
.
get
(
'pc1'
,
"userName"
)
configuration
[
"userName1"
]
=
config
.
get
(
'pc1'
,
"userName"
)
configuration
[
"password1"
]
=
config
.
get
(
'pc1'
,
"password"
)
configuration
[
"password1"
]
=
config
.
get
(
'pc1'
,
"password"
)
configuration
[
"
interfaceName1"
]
=
config
.
get
(
'pc1'
,
"interfaceName
"
)
configuration
[
"
busIdSpec1"
]
=
config
.
get
(
'pc1'
,
"busIdSpec
"
)
configuration
[
"hostName2"
]
=
config
.
get
(
'pc2'
,
"hostName"
)
configuration
[
"hostName2"
]
=
config
.
get
(
'pc2'
,
"hostName"
)
configuration
[
"userName2"
]
=
config
.
get
(
'pc2'
,
"userName"
)
configuration
[
"userName2"
]
=
config
.
get
(
'pc2'
,
"userName"
)
configuration
[
"password2"
]
=
config
.
get
(
'pc2'
,
"password"
)
configuration
[
"password2"
]
=
config
.
get
(
'pc2'
,
"password"
)
configuration
[
"
interfaceName2"
]
=
config
.
get
(
'pc2'
,
"interfaceName
"
)
configuration
[
"
busIdSpec2"
]
=
config
.
get
(
'pc2'
,
"busIdSpec
"
)
main
(
configuration
)
main
(
configuration
)
except
configparser
.
Error
as
e
:
except
configparser
.
Error
as
e
:
...
...
test/validation/vuart.py
View file @
78e6a2b1
...
@@ -89,7 +89,7 @@ class Vuart ():
...
@@ -89,7 +89,7 @@ class Vuart ():
error function
error function
"""
"""
try
:
try
:
command
=
"sfp
\
detect
"
command
=
"sfp
\
match
"
return
self
.
vUartCommand
(
command
)
return
self
.
vUartCommand
(
command
)
except
:
except
:
print
(
"Error sfp detect"
)
print
(
"Error sfp detect"
)
...
...
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