Merge ~morphis/snappy-hwe-snaps/+git/network-manager:suspend-resume into ~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager:master

Proposed by Simon Fels
Status: Merged
Approved by: Alfonso Sanchez-Beato
Approved revision: 915a8e10a66e9232352b73186650eb88e951dc7b
Merged at revision: 57b73020ce529d4b8f4250bb1487dbc85873aece
Proposed branch: ~morphis/snappy-hwe-snaps/+git/network-manager:suspend-resume
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager:master
Diff against target: 127 lines (+88/-1)
4 files modified
run-tests.sh (+1/-1)
snapcraft.yaml (+4/-0)
tests/main/suspend-resume/task.yaml (+80/-0)
tests/main/wifi-connect-secured-ap/task.yaml (+3/-0)
Reviewer Review Type Date Requested Status
Alfonso Sanchez-Beato Approve
System Enablement Bot continuous-integration Approve
Konrad Zapałowicz (community) code Approve
Tony Espy Pending
Review via email: mp+313683@code.launchpad.net

Description of the change

Enable suspend/resume tracking via systemd

 * add spread test to test suspend/resume tracking probably
 * disable session tracking explicitly as not support currently
 * always unload the mac80211_hwsim driver when we used it

To post a comment you must log in.
Revision history for this message
Konrad Zapałowicz (kzapalowicz) wrote :

Ack

review: Approve (code)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/run-tests.sh b/run-tests.sh
index eaa2fca..0c8a1fc 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -17,7 +17,7 @@
17set -e17set -e
1818
19image_name=ubuntu-core-16.img19image_name=ubuntu-core-16.img
20channel=candidate20channel=stable
21spread_opts=21spread_opts=
22force_new_image=022force_new_image=0
23test_from_channel=023test_from_channel=0
diff --git a/snapcraft.yaml b/snapcraft.yaml
index 56ba3f0..f1c9e00 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -135,6 +135,10 @@ parts:
135 - --with-dhclient=no135 - --with-dhclient=no
136 - --with-dnsmasq=no136 - --with-dnsmasq=no
137 - --with-systemd-journal=no137 - --with-systemd-journal=no
138 - --with-session-tracking=no
139 # We only support suspend/resume tracking together with systemd/logind
140 # at the moment.
141 - --with-suspend-resume=systemd
138 # Removes dependency on libicudata which weights 25M. Also libsoup142 # Removes dependency on libicudata which weights 25M. Also libsoup
139 # is only used to verify a domain in the DNS resolve process has a143 # is only used to verify a domain in the DNS resolve process has a
140 # valid format and to check if a valid internet connection is available.144 # valid format and to check if a valid internet connection is available.
diff --git a/tests/main/suspend-resume/task.yaml b/tests/main/suspend-resume/task.yaml
141new file mode 100644145new file mode 100644
index 0000000..b5df7d1
--- /dev/null
+++ b/tests/main/suspend-resume/task.yaml
@@ -0,0 +1,80 @@
1summary: Verify suspend/resume tracking works reliable
2
3restore: |
4 rmmod mac80211_hwsim
5
6execute: |
7 # Install necessary test-tools, we need inotify-tools in this case
8 snap install --edge se-test-tools
9
10 # Get two connected wifi network interfaces wlan0 and wlan1
11 modprobe mac80211_hwsim radios=2
12
13 # FIXME: take the one from edge for now as that is the one which
14 # has automatic setup capabilities
15 snap install --edge wifi-ap
16
17 /snap/bin/network-manager.nmcli d wifi rescan
18 while ! /snap/bin/network-manager.nmcli d wifi | grep Ubuntu ; do
19 /snap/bin/network-manager.nmcli d wifi rescan
20 sleep 1
21 done
22
23 /snap/bin/network-manager.nmcli d wifi connect Ubuntu
24
25 # Override the existing systemd-suspend service unit with a customized
26 # one to prevent the device from entering real suspend. The service unit
27 # will block as long as no new files gets created inside the specified
28 # directory inotifywait listens for changes on.
29 cat <<-EOF > $PROJECT_PATH/systemd-suspend.service
30 [Unit]
31 Description=Suspend
32 Documentation=man:systemd-suspend.service(8)
33 DefaultDependencies=no
34 [Service]
35 Type=oneshot
36 ExecStart=/bin/sh -c '/snap/bin/se-test-tools.inotifywait -e create /home/network-manager/systemd-suspend'
37 EOF
38 mkdir -p /home/network-manager/systemd-suspend
39 mount -o bind,ro $PROJECT_PATH/systemd-suspend.service /lib/systemd/system/systemd-suspend.service
40 systemctl daemon-reload
41
42 # NetworkManager should have an inhibit lock in place by default
43 systemd-inhibit --list | grep "NetworkManager needs to turn off networks"
44
45 service=snap.network-manager.networkmanager
46
47 # Flush the syslog so that we can reliable grep it once we triggered
48 # the system suspend
49 journalctl --flush -u $service
50
51 # Kick off the actual suspend in background so that we can continue
52 # verifying the correct state left by the system before it would
53 # normally enter a sleep state.
54 systemctl suspend --no-block &
55
56 # The easiest way to ensure NetworkManager did the right thing is
57 # by going through its log output and verifying it prints out
58 # what we expect.
59 journalctl --no-pager -u $service | grep 'manager: sleep requested'
60 journalctl --no-pager -u $service | grep 'manager: sleeping...'
61 journalctl --no-pager -u $service | grep "device (wlan1): state change: activated -> unmanaged (reason 'sleeping')"
62 journalctl --no-pager -u $service | grep 'manager: NetworkManager state is now ASLEEP'
63
64 # Connection should be reported as disconnected
65 /snap/bin/network-manager.nmcli d | grep -v 'wlan1.*connected'
66 # .. and interface should be disabled
67 ifconfig | grep -v wlan1
68
69 # Now we wakeup the system again and verify NetworkManager
70 # is correctly setting up the ethernet port again.
71 journalctl --flush -u $service
72 touch $PROJECT_PATH/systemd-suspend/wakeup
73
74 journalctl --no-pager -u $service | grep 'manager: wake requested (sleeping: yes enabled: yes)'
75 journalctl --no-pager -u $service | grep 'manager: NetworkManager state is now CONNECTED_LOCAL'
76 journalctl --no-pager -u $service | grep 'manager: NetworkManager state is now CONNECTED_GLOBAL'
77 journalctl --no-pager -u $service | grep 'device (wlan1): Activation: successful, device activated.'
78
79 ifconfig | grep wlan1
80 /snap/bin/network-manager.nmcli d | grep -v 'wlan1.*connected'
diff --git a/tests/main/wifi-connect-secured-ap/task.yaml b/tests/main/wifi-connect-secured-ap/task.yaml
index ed56a9b..2c7ed53 100644
--- a/tests/main/wifi-connect-secured-ap/task.yaml
+++ b/tests/main/wifi-connect-secured-ap/task.yaml
@@ -4,6 +4,9 @@ environment:
4 WIFI_SSID: Ubuntu4 WIFI_SSID: Ubuntu
5 WIFI_PASSPHRASE: Test12345 WIFI_PASSPHRASE: Test1234
66
7restore: |
8 rmmod mac80211_hwsim
9
7execute: |10execute: |
8 snap install wifi-ap11 snap install wifi-ap
912

Subscribers

People subscribed via source and target branches