Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
crazyflie-lib-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lukas Wegmann
crazyflie-lib-python
Commits
d142a29d
Commit
d142a29d
authored
6 years ago
by
Kristoffer Richardsson
Browse files
Options
Downloads
Patches
Plain Diff
#119 Updates to restart system tests
parent
eb6be503
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys_test/swarm_test_rig/rig_support.py
+10
-10
10 additions, 10 deletions
sys_test/swarm_test_rig/rig_support.py
sys_test/swarm_test_rig/test_connection.py
+12
-1
12 additions, 1 deletion
sys_test/swarm_test_rig/test_connection.py
with
22 additions
and
11 deletions
sys_test/swarm_test_rig/rig_support.py
+
10
−
10
View file @
d142a29d
...
@@ -43,7 +43,7 @@ class RigSupport:
...
@@ -43,7 +43,7 @@ class RigSupport:
]
]
def
restart_devices
(
self
,
uris
):
def
restart_devices
(
self
,
uris
):
def
send_packets
(
uris
,
value
):
def
send_packets
(
uris
,
value
,
description
):
for
uri
in
uris
:
for
uri
in
uris
:
devid
,
channel
,
datarate
,
address
=
RadioDriver
.
parse_uri
(
uri
)
devid
,
channel
,
datarate
,
address
=
RadioDriver
.
parse_uri
(
uri
)
radio
.
set_channel
(
channel
)
radio
.
set_channel
(
channel
)
...
@@ -52,17 +52,16 @@ class RigSupport:
...
@@ -52,17 +52,16 @@ class RigSupport:
received_packet
=
False
received_packet
=
False
for
i
in
range
(
10
):
for
i
in
range
(
10
):
# TODO krri Seems to work better with a pause here,
# investigate why
time
.
sleep
(
0.2
)
result
=
radio
.
send_packet
((
0xf3
,
0xfe
,
value
))
result
=
radio
.
send_packet
((
0xf3
,
0xfe
,
value
))
if
result
.
ack
is
True
:
if
result
.
ack
is
True
:
received_packet
=
True
received_packet
=
True
# if i > 0:
# print('Lost packets', i, uri)
break
break
time
.
sleep
(
0.1
)
if
not
received_packet
:
if
not
received_packet
:
raise
Exception
(
'
Failed to restart device
'
)
raise
Exception
(
'
Failed to turn device {}, for {}
'
.
format
(
description
,
uri
))
print
(
'
Restarting devices
'
)
print
(
'
Restarting devices
'
)
...
@@ -70,8 +69,9 @@ class RigSupport:
...
@@ -70,8 +69,9 @@ class RigSupport:
BOOTLOADER_CMD_SYSON
=
0x03
BOOTLOADER_CMD_SYSON
=
0x03
radio
=
Crazyradio
()
radio
=
Crazyradio
()
send_packets
(
uris
,
BOOTLOADER_CMD_SYSOFF
)
send_packets
(
uris
,
BOOTLOADER_CMD_SYSOFF
,
'
off
'
)
time
.
sleep
(
0.1
)
send_packets
(
uris
,
BOOTLOADER_CMD_SYSON
,
'
on
'
)
send_packets
(
uris
,
BOOTLOADER_CMD_SYSON
)
# Wait for devices to boot
time
.
sleep
(
8
)
radio
.
close
()
radio
.
close
()
time
.
sleep
(
5
)
This diff is collapsed.
Click to expand it.
sys_test/swarm_test_rig/test_connection.py
+
12
−
1
View file @
d142a29d
...
@@ -88,9 +88,20 @@ class TestConnection(unittest.TestCase):
...
@@ -88,9 +88,20 @@ class TestConnection(unittest.TestCase):
def
test_that_all_devices_are_restarted
(
self
):
def
test_that_all_devices_are_restarted
(
self
):
# Fixture
# Fixture
uris
=
self
.
test_rig_support
.
all_uris
# Test
# Test
# Assert
# Assert
self
.
test_rig_support
.
restart_devices
(
self
.
test_rig_support
.
all_uris
)
self
.
test_rig_support
.
restart_devices
(
uris
)
def
test_that_all_devices_are_restarted_multiple_times
(
self
):
# Fixture
uris
=
self
.
test_rig_support
.
all_uris
# Test
# Assert
for
i
in
range
(
10
):
self
.
test_rig_support
.
restart_devices
(
uris
)
def
test_that_the_same_cf_object_can_be_connected_multiple_times
(
self
):
def
test_that_the_same_cf_object_can_be_connected_multiple_times
(
self
):
# Fixture
# Fixture
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment