Merge ~morphis/snappy-hwe-snaps/+git/wifi-ap:f/support-spread-on-hw into ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master

Proposed by Simon Fels
Status: Needs review
Proposed branch: ~morphis/snappy-hwe-snaps/+git/wifi-ap:f/support-spread-on-hw
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-ap:master
Diff against target: 594 lines (+223/-104)
23 files modified
.gitignore (+6/-0)
dev/null (+0/-69)
run-tests.sh (+8/-7)
spread.yaml (+18/-0)
tests/lib/prepare-all.sh (+15/-2)
tests/lib/prepare.sh (+26/-24)
tests/lib/restore-all.sh (+9/-0)
tests/lib/restore-each.sh (+7/-0)
tests/main/background-process-control/task.yaml (+4/-1)
tests/main/conf-wizard-auto-at-boot/task.yaml (+3/-0)
tests/main/conf-wizard-auto-can-be-blocked/task.yaml (+3/-0)
tests/main/conf-wizard-auto-nodefaultip/task.yaml (+3/-0)
tests/main/conf-wizard-auto-noip/task.yaml (+3/-0)
tests/main/conf-wizard-auto-nowifi/task.yaml (+3/-0)
tests/main/conf-wizard-auto/task.yaml (+3/-0)
tests/main/conf-wizard-disabled-from-gadget/task.yaml (+3/-0)
tests/main/configuration-changes/task.yaml (+3/-0)
tests/main/default-conf-brings-up-ap/task.yaml (+3/-0)
tests/main/default-configuration/tasks.yaml (+3/-0)
tests/main/documentation-builds/task.yaml (+6/-0)
tests/main/socket-plug/task.yaml (+3/-0)
tests/main/stress-ap/task.yaml (+88/-0)
tests/main/utf8-ssid/task.yaml (+3/-1)
Reviewer Review Type Date Requested Status
Matteo Croce (community) Approve
System Enablement Bot continuous-integration Needs Fixing
Review via email: mp+319046@code.launchpad.net

Description of the change

Allow running our stress test on real hardware

This is based on recent changes to tests-extras which allow us now executing all white-listed tests via something like this:

$ ./run-tests.sh \
  --spread-system=hw-ubuntu-core-16 \
  --external-address=192.168.178.36 \
  --external-user=admin \
  --external-password=admin \
  --spread-filter=tests/main/stress-ap \
  --debug

This relies on having a second WiFi network device available on the specified external system. Name of network device can be specified via the two parameters in spread.yaml

To post a comment you must log in.
Revision history for this message
Matteo Croce (teknoraver) :
review: Needs Fixing
71e58bc... by Simon Fels

Respect review comments

Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Matteo Croce (teknoraver) :
review: Needs Fixing
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: Needs Fixing (continuous-integration)
Revision history for this message
Matteo Croce (teknoraver) :
review: Approve

Unmerged commits

71e58bc... by Simon Fels

Respect review comments

c036235... by Simon Fels

Add .gitignore file

1b7bc1c... by Simon Fels

Allow running our stress test on real hardware

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.gitignore b/.gitignore
0new file mode 1006440new file mode 100644
index 0000000..2aaa3a0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
1parts
2stage
3prime
4
5.spread*
6.tests-extras
diff --git a/run-tests.sh b/run-tests.sh
index 0b0679d..54f23f7 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -32,12 +32,12 @@ tests-extras repository and execute the run-tests.sh script from
32there passing arguments as-is.32there passing arguments as-is.
3333
34optional arguments:34optional arguments:
35 --help Show this help message and exit35 --help Show this help message and exit
36 --channel Select another channel to build the base image from (default: stable)36 --channel=<channel> Select another channel to build the base image from (default: $channel)
37 --snap Extra snap to install37 --snap=<name> Extra snap to install
38 --debug Enable verbose debugging output38 --debug Enable verbose debugging output
39 --test-from-channel Pull network-manager snap from the specified channel instead of building it from source39 --test-from-channel=<channel> Pull snap from the specified channel instead of building it from source
40 --force-new-image Force generating a new image used for testing40 --force-new-image Force generating a new image used for testing
41EOF41EOF
42}42}
4343
@@ -67,7 +67,7 @@ restore_and_update_tests_extras() {
67# hidden directory which is re-used since then.67# hidden directory which is re-used since then.
6868
69# Display help w/o fetching anything and exit69# Display help w/o fetching anything and exit
70[ "$1" = "--help" ] && show_help70[ ! -d "$TESTS_EXTRAS_PATH" ] && [ "$1" = "--help" ] && show_help
7171
72if [ -d "$TESTS_EXTRAS_PATH" ]; then72if [ -d "$TESTS_EXTRAS_PATH" ]; then
73 restore_and_update_tests_extras73 restore_and_update_tests_extras
@@ -75,5 +75,6 @@ else
75 clone_tests_extras75 clone_tests_extras
76fi76fi
7777
78
78echo "INFO: Executing tests runner"79echo "INFO: Executing tests runner"
79cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@"80cd $TESTS_EXTRAS_PATH && ./tests-runner.sh "$@"
diff --git a/spread.yaml b/spread.yaml
index 4bea33a..9a2c2f3 100644
--- a/spread.yaml
+++ b/spread.yaml
@@ -22,6 +22,10 @@ environment:
22 SNAP_NAME: wifi-ap22 SNAP_NAME: wifi-ap
23 # Allow the host to pass the channel to use for the test rim23 # Allow the host to pass the channel to use for the test rim
24 SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL)24 SNAP_CHANNEL: $(HOST:echo $SNAP_CHANNEL)
25 # Set these to different names when you run the tests on hardware where
26 # you need to use different interfaces.
27 HW_WLAN0_NAME: wlan0
28 HW_WLAN1_NAME: wlan1
2529
26backends:30backends:
27 qemu:31 qemu:
@@ -29,6 +33,16 @@ backends:
29 - ubuntu-core-16:33 - ubuntu-core-16:
30 username: test34 username: test
31 password: test35 password: test
36 external:
37 type: adhoc
38 environment:
39 SPREAD_EXTERNAL_ADDRESS: "$(HOST: echo ${SPREAD_EXTERNAL_ADDRESS:-localhost:8022})"
40 allocate: |
41 ADDRESS $SPREAD_EXTERNAL_ADDRESS
42 systems:
43 - hw-ubuntu-core-16:
44 username: $(HOST:echo $SPREAD_EXTERNAL_USER)
45 password: $(HOST:echo $SPREAD_EXTERNAL_PASSWORD)
3246
33# Put this somewhere where we have read-write access47# Put this somewhere where we have read-write access
34path: /home/wifi-ap48path: /home/wifi-ap
@@ -39,6 +53,9 @@ exclude:
39prepare: |53prepare: |
40 . $TESTSLIB/prepare-all.sh54 . $TESTSLIB/prepare-all.sh
4155
56restore: |
57 . $TESTSLIB/restore-all.sh
58
42prepare-each: |59prepare-each: |
43 # Cleanup logs so we can just dump what has happened in the debug-each60 # Cleanup logs so we can just dump what has happened in the debug-each
44 # step below after a test case ran.61 # step below after a test case ran.
@@ -58,6 +75,7 @@ suites:
58 summary: Full-system tests for the wifi-ap snap75 summary: Full-system tests for the wifi-ap snap
59 systems:76 systems:
60 - ubuntu-core-1677 - ubuntu-core-16
78 - hw-ubuntu-core-16
61 prepare: |79 prepare: |
62 . $TESTSLIB/prepare.sh80 . $TESTSLIB/prepare.sh
63 restore-each: |81 restore-each: |
diff --git a/tests/lib/prepare-all.sh b/tests/lib/prepare-all.sh
index 38380e2..49be914 100644
--- a/tests/lib/prepare-all.sh
+++ b/tests/lib/prepare-all.sh
@@ -1,7 +1,20 @@
1#!/bin/bash1#!/bin/bash
22
3# Simulate two WiFi radio network interfaces3if [ "$SPREAD_SYSTEM" = "ubuntu-core-16" ]; then
4modprobe mac80211_hwsim radios=24 # Simulate two WiFi radio network interfaces
5 modprobe mac80211_hwsim radios=2
6elif [ "$SPREAD_SYSTEM" = "hw-ubuntu-core-16" ]; then
7 if ! snap list | grep -q wifi-ap; then
8 echo "ERROR: wifi-ap snap is not installed. You need to manually install"
9 echo " the version you want to test."
10 exit 1
11 fi
12 systemctl stop snap.wifi-ap.management-service
13 tar czf $SPREAD_PATH/wifi-ap-state.tar.gz /var/snap/wifi-ap/current /var/snap/wifi-ap/common
14 rm -rf /var/snap/wifi-ap/current/* /var/snap/wifi-ap/common/*
15 systemctl start snap.wifi-ap.management-service
16 exit 0
17fi
518
6# We don't have to build a snap when we should use one from a19# We don't have to build a snap when we should use one from a
7# channel20# channel
diff --git a/tests/lib/prepare.sh b/tests/lib/prepare.sh
index d4b7020..19e6b83 100644
--- a/tests/lib/prepare.sh
+++ b/tests/lib/prepare.sh
@@ -2,34 +2,36 @@
22
3. $TESTSLIB/utilities.sh3. $TESTSLIB/utilities.sh
44
5echo "Wait for firstboot change to be ready"5if [ "$SPREAD_SYSTEM" = "ubuntu-core-16" ]; then
6while ! snap changes | grep -q "Done"; do6 echo "Wait for firstboot change to be ready"
7 snap changes || true7 while ! snap changes | grep -q "Done"; do
8 snap change 1 || true8 snap changes || true
9 sleep 19 snap change 1 || true
10done10 sleep 1
11 done
1112
12echo "Ensure fundamental snaps are still present"13 echo "Ensure fundamental snaps are still present"
13. $TESTSLIB/snap-names.sh14 . $TESTSLIB/snap-names.sh
14for name in $gadget_name $kernel_name $core_name; do15 for name in $gadget_name $kernel_name $core_name; do
15 if ! snap list | grep -q $name ; then16 if ! snap list | grep -q $name ; then
16 echo "Not all fundamental snaps are available, all-snap image not valid"17 echo "Not all fundamental snaps are available, all-snap image not valid"
17 echo "Currently installed snaps:"18 echo "Currently installed snaps:"
18 snap list19 snap list
19 exit 120 exit 1
20 fi21 fi
21done22 done
2223
23echo "Kernel has a store revision"24 echo "Kernel has a store revision"
24snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical"25 snap list | grep ^${kernel_name} | grep -E " [0-9]+\s+canonical"
2526
26install_snap_under_test27 install_snap_under_test
2728
28# Snapshot of the current snapd state for a later restore29 # Snapshot of the current snapd state for a later restore
29if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then30 if [ ! -f $SPREAD_PATH/snapd-state.tar.gz ] ; then
30 systemctl stop snapd.service snapd.socket31 systemctl stop snapd.service snapd.socket
31 tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan32 tar czf $SPREAD_PATH/snapd-state.tar.gz /var/lib/snapd /etc/netplan
32 systemctl start snapd.socket33 systemctl start snapd.socket
34 fi
33fi35fi
3436
35# For debugging dump all snaps and connected slots/plugs37# For debugging dump all snaps and connected slots/plugs
diff --git a/tests/lib/restore-all.sh b/tests/lib/restore-all.sh
36new file mode 10064438new file mode 100644
index 0000000..5c371ef
--- /dev/null
+++ b/tests/lib/restore-all.sh
@@ -0,0 +1,9 @@
1#!/bin/bash
2
3if [ "$SPREAD_SYSTEM" = "hw-ubuntu-core-16" ]; then
4 if [ -e $SPREAD_PATH/wifi-ap-state.tar.gz ]; then
5 systemctl stop snap.wifi-ap.management-service || true
6 tar xzf $SPREAD_PATH/wifi-ap-state.tar.gz -C /
7 systemctl start snap.wifi-ap.management-service
8 fi
9fi
diff --git a/tests/lib/restore-each.sh b/tests/lib/restore-each.sh
index fa474b4..324b4d6 100644
--- a/tests/lib/restore-each.sh
+++ b/tests/lib/restore-each.sh
@@ -3,6 +3,13 @@
3. $TESTSLIB/snap-names.sh3. $TESTSLIB/snap-names.sh
4. $TESTSLIB/utilities.sh4. $TESTSLIB/utilities.sh
55
6if [ "$SPREAD_SYSTEM" = "hw-ubuntu-core-16" ]; then
7 systemctl stop snap.wifi-ap.management-service || true
8 rm -rf /var/snap/wifi-ap/current/* /var/snap/wifi-ap/common/*
9 systemctl start snap.wifi-ap.management-service
10 exit 0
11fi
12
6# Remove all snaps not being the core, gadget, kernel or snap we're testing13# Remove all snaps not being the core, gadget, kernel or snap we're testing
7for snap in /snap/*; do14for snap in /snap/*; do
8 snap="${snap:6}"15 snap="${snap:6}"
diff --git a/tests/main/background-process-control/task.yaml b/tests/main/background-process-control/task.yaml
index 58dd047..070aadf 100644
--- a/tests/main/background-process-control/task.yaml
+++ b/tests/main/background-process-control/task.yaml
@@ -1,5 +1,8 @@
1summary: Test correct service behavior to ensure the background AP process is running1summary: Test correct service behavior to ensure the background AP process is running
22
3systems:
4 - -hw-ubuntu-core-16
5
3prepare: |6prepare: |
4 # We need some tools for scanning etc.7 # We need some tools for scanning etc.
5 snap install wireless-tools8 snap install wireless-tools
@@ -24,7 +27,7 @@ execute: |
2427
25 # Restart should get us back into the same state we were in before28 # Restart should get us back into the same state we were in before
26 /snap/bin/wifi-ap.status restart-ap29 /snap/bin/wifi-ap.status restart-ap
27 # Restart needs some time 30 # Restart needs some time
28 sleep 531 sleep 5
29 /snap/bin/wifi-ap.status | grep "ap.active: true"32 /snap/bin/wifi-ap.status | grep "ap.active: true"
30 /snap/bin/wireless-tools.iw dev wlan1 scan | grep 'SSID: Ubuntu'33 /snap/bin/wireless-tools.iw dev wlan1 scan | grep 'SSID: Ubuntu'
diff --git a/tests/main/conf-wizard-auto-at-boot/task.yaml b/tests/main/conf-wizard-auto-at-boot/task.yaml
index b042097..01d8ddb 100644
--- a/tests/main/conf-wizard-auto-at-boot/task.yaml
+++ b/tests/main/conf-wizard-auto-at-boot/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that the automatic wizard works1summary: Verify that the automatic wizard works
22
3systems:
4 - -hw-ubuntu-core-16
5
3execute: |6execute: |
4 # Check that we get good default values7 # Check that we get good default values
5 test "$(/snap/bin/wifi-ap.config get disabled)" = false8 test "$(/snap/bin/wifi-ap.config get disabled)" = false
diff --git a/tests/main/conf-wizard-auto-can-be-blocked/task.yaml b/tests/main/conf-wizard-auto-can-be-blocked/task.yaml
index ecacd6f..4f921a0 100644
--- a/tests/main/conf-wizard-auto-can-be-blocked/task.yaml
+++ b/tests/main/conf-wizard-auto-can-be-blocked/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify the automatic wizard running on service startup can be blocked with a configuration option1summary: Verify the automatic wizard running on service startup can be blocked with a configuration option
22
3systems:
4 - -hw-ubuntu-core-16
5
3environment:6environment:
4 SNAP_COMMON: /var/snap/wifi-ap/common7 SNAP_COMMON: /var/snap/wifi-ap/common
5 SNAP_DATA: /var/snap/wifi-ap/current8 SNAP_DATA: /var/snap/wifi-ap/current
diff --git a/tests/main/conf-wizard-auto-nodefaultip/task.yaml b/tests/main/conf-wizard-auto-nodefaultip/task.yaml
index 8be2f75..81c168c 100644
--- a/tests/main/conf-wizard-auto-nodefaultip/task.yaml
+++ b/tests/main/conf-wizard-auto-nodefaultip/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that the wizard is able to find an unused IP1summary: Verify that the wizard is able to find an unused IP
22
3systems:
4 - -hw-ubuntu-core-16
5
3prepare: |6prepare: |
4 # Dummy interface to assign an IP to7 # Dummy interface to assign an IP to
5 modprobe dummy8 modprobe dummy
diff --git a/tests/main/conf-wizard-auto-noip/task.yaml b/tests/main/conf-wizard-auto-noip/task.yaml
index 10822e1..e557c19 100644
--- a/tests/main/conf-wizard-auto-noip/task.yaml
+++ b/tests/main/conf-wizard-auto-noip/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that wizard fails when all private subnets are busy1summary: Verify that wizard fails when all private subnets are busy
22
3systems:
4 - -hw-ubuntu-core-16
5
3prepare: |6prepare: |
4 # Dummy interface to assign an IP to7 # Dummy interface to assign an IP to
5 modprobe dummy8 modprobe dummy
diff --git a/tests/main/conf-wizard-auto-nowifi/task.yaml b/tests/main/conf-wizard-auto-nowifi/task.yaml
index ce89798..71e0190 100644
--- a/tests/main/conf-wizard-auto-nowifi/task.yaml
+++ b/tests/main/conf-wizard-auto-nowifi/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that wizard fails when there are no WiFi devices1summary: Verify that wizard fails when there are no WiFi devices
22
3systems:
4 - -hw-ubuntu-core-16
5
3prepare: |6prepare: |
4 rmmod mac80211_hwsim7 rmmod mac80211_hwsim
58
diff --git a/tests/main/conf-wizard-auto/task.yaml b/tests/main/conf-wizard-auto/task.yaml
index ae6219c..0b1f8cf 100644
--- a/tests/main/conf-wizard-auto/task.yaml
+++ b/tests/main/conf-wizard-auto/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that the automatic wizard works1summary: Verify that the automatic wizard works
22
3systems:
4 - -hw-ubuntu-core-16
5
3execute: |6execute: |
4 # The automatic wizard was already started7 # The automatic wizard was already started
58
diff --git a/tests/main/conf-wizard-disabled-from-gadget/task.yaml b/tests/main/conf-wizard-disabled-from-gadget/task.yaml
index 227ecfb..caf7f84 100644
--- a/tests/main/conf-wizard-disabled-from-gadget/task.yaml
+++ b/tests/main/conf-wizard-disabled-from-gadget/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify the wizard can be disabled by default from a gadget snap1summary: Verify the wizard can be disabled by default from a gadget snap
22
3systems:
4 - -hw-ubuntu-core-16
5
3# FIXME: This test needs to stay manual until a snap is in edge which6# FIXME: This test needs to stay manual until a snap is in edge which
4# contains a configure hook. Otherwise the snap installation will7# contains a configure hook. Otherwise the snap installation will
5# always fail.8# always fail.
diff --git a/tests/main/configuration-changes/task.yaml b/tests/main/configuration-changes/task.yaml
index 1800102..056580e 100644
--- a/tests/main/configuration-changes/task.yaml
+++ b/tests/main/configuration-changes/task.yaml
@@ -1,5 +1,8 @@
1summary: Test that we can change the configuration1summary: Test that we can change the configuration
22
3systems:
4 - -hw-ubuntu-core-16
5
3execute: |6execute: |
4 test "`/snap/bin/wifi-ap.config get wifi.interface`" = wlan07 test "`/snap/bin/wifi-ap.config get wifi.interface`" = wlan0
5 /snap/bin/wifi-ap.config set wifi.interface=wlan18 /snap/bin/wifi-ap.config set wifi.interface=wlan1
diff --git a/tests/main/default-conf-brings-up-ap/task.yaml b/tests/main/default-conf-brings-up-ap/task.yaml
index 6777c8d..b57850e 100644
--- a/tests/main/default-conf-brings-up-ap/task.yaml
+++ b/tests/main/default-conf-brings-up-ap/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that the default configuration is able to spawn up an AP1summary: Verify that the default configuration is able to spawn up an AP
22
3systems:
4 - -hw-ubuntu-core-16
5
3execute: |6execute: |
4 . $TESTSLIB/utilities.sh7 . $TESTSLIB/utilities.sh
58
diff --git a/tests/main/default-configuration/tasks.yaml b/tests/main/default-configuration/tasks.yaml
index d6c1cba..67f9cb4 100644
--- a/tests/main/default-configuration/tasks.yaml
+++ b/tests/main/default-configuration/tasks.yaml
@@ -1,5 +1,8 @@
1summary: Verify snap has correct default configuration1summary: Verify snap has correct default configuration
22
3systems:
4 - -hw-ubuntu-core-16
5
3execute: |6execute: |
4 test `/snap/bin/wifi-ap.config get debug` = false7 test `/snap/bin/wifi-ap.config get debug` = false
5 test `/snap/bin/wifi-ap.config get disabled` = true8 test `/snap/bin/wifi-ap.config get disabled` = true
diff --git a/tests/main/documentation-builds/task.yaml b/tests/main/documentation-builds/task.yaml
index e746465..8780a98 100644
--- a/tests/main/documentation-builds/task.yaml
+++ b/tests/main/documentation-builds/task.yaml
@@ -1,5 +1,11 @@
1summary: Verify the project documentation is building without errors1summary: Verify the project documentation is building without errors
22
3systems:
4 - -hw-ubuntu-core-16
5
6systems:
7 - -hw-ubuntu-core-16
8
3execute: |9execute: |
4 # Need to install in devmode as otherwise the snap can't access our project10 # Need to install in devmode as otherwise the snap can't access our project
5 # home which is outside of the home directory of our current user.11 # home which is outside of the home directory of our current user.
diff --git a/tests/main/socket-plug/task.yaml b/tests/main/socket-plug/task.yaml
index 8306aaf..e18d0db 100644
--- a/tests/main/socket-plug/task.yaml
+++ b/tests/main/socket-plug/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that the exported content interface does work1summary: Verify that the exported content interface does work
22
3systems:
4 - -hw-ubuntu-core-16
5
3execute: |6execute: |
4 # The automatic wizard was already started7 # The automatic wizard was already started
58
diff --git a/tests/main/stress-ap-status-control/task.yaml b/tests/main/stress-ap-status-control/task.yaml
6deleted file mode 1006449deleted file mode 100644
index 89ded92..0000000
--- a/tests/main/stress-ap-status-control/task.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
1summary: Stress test for the AP status control API
2
3environment:
4 RESTART_ITERATIONS: 15
5 SCAN_ITERATIONS: 10
6
7prepare: |
8 # We need some tools for scanning etc.
9 snap install wireless-tools
10 snap connect wireless-tools:network-control core
11
12execute: |
13 # Bring up the access point first
14 /snap/bin/wifi-ap.config set disabled=false
15 until /snap/bin/wifi-ap.status | grep "ap.active: true" ; do
16 sleep 0.5
17 done
18
19 # Scan for networks on the other side of the WiFi network
20 # and ensure the network is available.
21 ifconfig wlan1 up
22 n=0
23 found_ap=0
24 while [ $n -lt $SCAN_ITERATIONS ] ; do
25 if /snap/bin/wireless-tools.iw dev wlan1 scan | grep 'SSID: Ubuntu'; then
26 found_ap=1
27 break
28 fi
29 sleep 0.5
30 let n=n+1
31 done
32 test $found_ap -eq 1
33
34 # We will restart the AP a huge number of times again and again
35 # and expect that the AP afterwards comes back up normally and
36 # we can still search and connect to it.
37 n=0
38 while [ $n -lt $RESTART_ITERATIONS ] ; do
39 /snap/bin/wifi-ap.status restart-ap
40 sleep 0.5
41 let n=n+1
42 done
43
44 # Wait for AP to be marked as active again
45 until /snap/bin/wifi-ap.status | fgrep "ap.active: true" ; do
46 sleep 0.5
47 done
48
49 # The AP should be still available in our scan result
50 n=0
51 found_ap=0
52 while [ $n -lt $SCAN_ITERATIONS ] ; do
53 if /snap/bin/wireless-tools.iw dev wlan1 scan | grep 'SSID: Ubuntu'; then
54 found_ap=1
55 break
56 fi
57 sleep 0.5
58 let n=n+1
59 done
60 test $found_ap -eq 1
61
62 # Verify we can associate with the AP
63 sudo /snap/bin/wireless-tools.iw wlan1 connect Ubuntu
64 sudo /snap/bin/wireless-tools.iw dev wlan1 link | grep 'SSID: Ubuntu'
65
66 # We should only have one hostapd and one dnsmasq process at this time
67 # (we have to ignore the grep'ing process as otherwise we get a count of 2)
68 test `pgrep -c hostapd` -eq 1
69 test `pgrep -c dnsmasq` -eq 1
diff --git a/tests/main/stress-ap/task.yaml b/tests/main/stress-ap/task.yaml
70new file mode 1006440new file mode 100644
index 0000000..4b667b8
--- /dev/null
+++ b/tests/main/stress-ap/task.yaml
@@ -0,0 +1,88 @@
1summary: Stress test for the WiFi AP
2
3environment:
4 RESTART_ITERATIONS: 30
5 SCAN_ITERATIONS: 15
6 AP_NAME: "StressUbuntuAP"
7
8prepare: |
9 # We need some tools for scanning etc.
10 snap install wireless-tools
11 snap connect wireless-tools:network-control core
12
13execute: |
14 # Bring up the access point first
15 /snap/bin/wifi-ap.config set \
16 wifi.interface=$HW_WLAN0_NAME \
17 wifi.ssid=$AP_NAME \
18 disabled=false
19
20 until /snap/bin/wifi-ap.status | grep "ap.active: true" ; do
21 sleep 0.5
22 done
23
24 scan_command() {
25 if [ -e /snap/bin/nmcli ]; then
26 /snap/bin/nmcli d wifi rescan
27 /snap/bin/nmcli d wifi list ifname $1
28 return
29 fi
30 /snap/bin/wireless-tools.iw dev $1 scan
31 }
32
33 # Scan for networks on the other side of the WiFi network
34 # and ensure the network is available.
35 ifconfig $HW_WLAN1_NAME up
36 n=0
37 found_ap=0
38 while [ $n -lt $SCAN_ITERATIONS ] ; do
39 if scan_command $HW_WLAN1_NAME | grep $AP_NAME; then
40 found_ap=1
41 break
42 fi
43 sleep 0.5
44 let n=n+1
45 done
46 test $found_ap -eq 1
47
48 # We will restart the AP a huge number of times again and again
49 # and expect that the AP afterwards comes back up normally and
50 # we can still search and connect to it.
51 n=0
52 while [ $n -lt $RESTART_ITERATIONS ] ; do
53 /snap/bin/wifi-ap.status restart-ap
54 sleep 0.5
55 let n=n+1
56 done
57
58 # Wait for AP to be marked as active again
59 until /snap/bin/wifi-ap.status | fgrep "ap.active: true" ; do
60 sleep 0.5
61 done
62
63 # The AP should be still available in our scan result
64 n=0
65 found_ap=0
66 while [ $n -lt $SCAN_ITERATIONS ] ; do
67 if scan_command $HW_WLAN1_NAME | grep $AP_NAME; then
68 found_ap=1
69 break
70 fi
71 sleep 0.5
72 let n=n+1
73 done
74 test $found_ap -eq 1
75
76 if [ -e /snap/bin/nmcli ]; then
77 /snap/bin/nmcli d wifi connect $AP_NAME ifname $HW_WLAN1_NAME
78 /snap/bin/nmcli d | grep "$HW_WLAN1_NAME.*connected"
79 else
80 # Verify we can associate with the AP
81 sudo /snap/bin/wireless-tools.iw $HW_WLAN1_NAME connect $AP_NAME
82 sudo /snap/bin/wireless-tools.iw dev $HW_WLAN1_NAME link | grep $AP_NAME
83 fi
84
85 # We should only have one hostapd and one dnsmasq process at this time
86 # (we have to ignore the grep'ing process as otherwise we get a count of 2)
87 test `pgrep -c hostapd` -eq 1
88 test `pgrep -c dnsmasq` -eq 1
diff --git a/tests/main/utf8-ssid/task.yaml b/tests/main/utf8-ssid/task.yaml
index 9b6faa6..1c2759d 100644
--- a/tests/main/utf8-ssid/task.yaml
+++ b/tests/main/utf8-ssid/task.yaml
@@ -1,5 +1,8 @@
1summary: Verify that the AP can accept an UTF8 SSID1summary: Verify that the AP can accept an UTF8 SSID
22
3systems:
4 - -hw-ubuntu-core-16
5
3environment:6environment:
4 SCAN_ITERATIONS: 157 SCAN_ITERATIONS: 15
58
@@ -45,4 +48,3 @@ execute: |
45 # Verify we can associate with the AP48 # Verify we can associate with the AP
46 /snap/bin/wireless-tools.iw wlan1 connect 'Ubuntu👍'49 /snap/bin/wireless-tools.iw wlan1 connect 'Ubuntu👍'
47 /snap/bin/wireless-tools.iw dev wlan1 link | fgrep 'SSID: Ubuntu\xf0\x9f\x91\x8d'50 /snap/bin/wireless-tools.iw dev wlan1 link | fgrep 'SSID: Ubuntu\xf0\x9f\x91\x8d'
48

Subscribers

People subscribed via source and target branches

to all changes: