Merge lp:~brendan-donegan/checkbox/bug944176_wireless_connection_failpass into lp:checkbox

Proposed by Brendan Donegan
Status: Merged
Merged at revision: 1295
Proposed branch: lp:~brendan-donegan/checkbox/bug944176_wireless_connection_failpass
Merge into: lp:checkbox
Diff against target: 69 lines (+8/-6)
2 files modified
debian/changelog (+2/-0)
jobs/wireless.txt.in (+6/-6)
To merge this branch: bzr merge lp:~brendan-donegan/checkbox/bug944176_wireless_connection_failpass
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Marc Tardif (community) Needs Information
Brendan Donegan (community) Needs Resubmitting
Review via email: mp+95429@code.launchpad.net

Description of the change

This merge updates the commands used by the wireless_connection tests to always remove the SSID file from the system-connections directory, but fail if internet_test fails and pass if it passes.

To post a comment you must log in.
Revision history for this message
Marc Tardif (cr3) wrote :

The commands seem helluva complicated. How about this:

trap "rm -f /etc/NetworkManager/system-connections/$WPA_BG_SSID" EXIT
create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK
internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`

This will always remove the SSID file and exit with the status of the last command, ie internet_test. What do you think?

review: Needs Information
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

That seems to work as well. I guess much of the complication comes from having things on one line though - are we allowed to have commands on multiple lines in Checkbox?

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

Used the trap command. I kept everything on one line, just in case

review: Needs Resubmitting
1292. By Brendan Donegan

Made the command simpler using trap according to cr3's feedback.

Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This wasn't working when I tested it, but I realise now that the EXIT signal will only be issued if this command is run inside a seperate shell session. If you run it from the same shell then no exit will ever be issued. So it will work fine in Checkbox, just not where it is copied and run on the same shell. I think a few of our job commands are like that.

Revision history for this message
Marc Tardif (cr3) wrote :

The last two diffs seem to remove the wrong file:

-command: create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK && ifconfig eth0 down; iperf -c $SERVER_IPERF -t 300 -i 30; ifconfig eth0 up; rm -f /etc/NetworkManager/system-connections/$WPA_BG_SSID
+command: trap "rm -f /etc/NetworkManager/system-connections/$OPEN_N_SSID; ifconfig eth0 up" EXIT; create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; ifconfig eth0 down; iperf -c $SERVER_IPERF -t 300 -i 30

Before, $WPA_BG_SSID was being removed. After, $OPEN_N_SSID is now being removed. Is that intentional?

review: Needs Information
Revision history for this message
Marc Tardif (cr3) wrote :

To answer your previous question: yes, you are allowed to have commands on multiple lines in checkbox.

Revision history for this message
Daniel Manrique (roadmr) wrote :

I fixed the last two commands (were apparently cut-pasted and they indeed were deleting the wrong file). Thanks for catching that!

I'll merge this change now (with that minor fix).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-03-01 22:35:44 +0000
3+++ debian/changelog 2012-03-02 08:21:18 +0000
4@@ -7,6 +7,8 @@
5 (LP: #942548)
6 * Updated command fields in composite disk jobs to address the ! in
7 some disk paths (LP: #942769)
8+ * Fixed command run by wireless_connection tests so that they fail if the
9+ internet_test fails, but still clean up the connection file (LP: #944176)
10
11 [Daniel Manrique]
12 * Tweaks to internet_test: don't try to ping an IP that's unreachable from
13
14=== modified file 'jobs/wireless.txt.in'
15--- jobs/wireless.txt.in 2012-02-01 16:28:33 +0000
16+++ jobs/wireless.txt.in 2012-03-02 08:21:18 +0000
17@@ -24,7 +24,7 @@
18 requires: device.category == 'WIRELESS'
19 user: root
20 environ: WPA_BG_SSID WPA_BG_PSK
21-command: create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`; rm -f /etc/NetworkManager/system-connections/$WPA_BG_SSID
22+command: trap "rm -f /etc/NetworkManager/system-connections/$WPA_BG_SSID" EXIT; create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`
23 _description:
24 Tests that the systems wireless hardware can connect to a router using WPA
25 security and the 802.11b/g protocols.
26@@ -34,7 +34,7 @@
27 requires: device.category == 'WIRELESS'
28 user: root
29 environ: OPEN_BG_SSID
30-command: create_connection $OPEN_BG_SSID; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`; rm -f /etc/NetworkManager/system-connections/$OPEN_BG_SSID
31+command: trap "rm -f /etc/NetworkManager/system-connections/$OPEN_BG_SSID" EXIT; create_connection $OPEN_BG_SSID --security=wpa --key=$OPEN_BG_PSK; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`
32 _description:
33 Tests that the systems wireless hardware can connect to a router using no
34 security and the 802.11b/g protocols.
35@@ -44,7 +44,7 @@
36 requires: device.category == 'WIRELESS'
37 user: root
38 environ: WPA_N_SSID WPA_N_PSK
39-command: create_connection $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`; rm -f /etc/NetworkManager/system-connections/$WPA_N_SSID
40+command: trap "rm -f /etc/NetworkManager/system-connections/$WPA_N_SSID" EXIT; create_connection $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`
41 _description:
42 Tests that the systems wireless hardware can connect to a router using WPA
43 security and the 802.11n protocol.
44@@ -54,7 +54,7 @@
45 requires: device.category == 'WIRELESS'
46 user: root
47 environ: OPEN_N_SSID
48-command: create_connection $OPEN_N_SSID; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`; rm -f /etc/NetworkManager/system-connections/$OPEN_N_SSID
49+command: trap "rm -f /etc/NetworkManager/system-connections/$OPEN_N_SSID" EXIT; create_connection $OPEN_N_SSID --security=wpa --key=$OPEN_N_PSK; internet_test --interface=`nmcli dev status | awk '/802-11-wireless/ {print $1}'`
50 _description:
51 Tests that the systems wireless hardware can connect to a router using no
52 security and the 802.11n protocol.
53@@ -66,7 +66,7 @@
54 device.category == 'WIRELESS'
55 user: root
56 environ: WPA_BG_SSID WPA_BG_PSK SERVER_IPERF
57-command: create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK && ifconfig eth0 down; iperf -c $SERVER_IPERF -t 300 -i 30; ifconfig eth0 up; rm -f /etc/NetworkManager/system-connections/$WPA_BG_SSID
58+command: trap "rm -f /etc/NetworkManager/system-connections/$OPEN_N_SSID; ifconfig eth0 up" EXIT; create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; ifconfig eth0 down; iperf -c $SERVER_IPERF -t 300 -i 30
59 _description:
60 Tests the performance of a systems wireless connection through the iperf tool.
61
62@@ -77,6 +77,6 @@
63 device.category == 'WIRELESS'
64 user: root
65 environ: WPA_BG_SSID WPA_BG_PSK SERVER_IPERF
66-command: create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK && ifconfig eth0 down; iperf -c $SERVER_IPERF -t 300 -i 30 -u -b 100m -p 5050; ifconfig eth0 up; rm -f /etc/NetworkManager/system-connections/$WPA_BG_SSID
67+command: trap "rm -f /etc/NetworkManager/system-connections/$OPEN_N_SSID; ifconfig eth0 up" EXIT; create_connection $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK && ifconfig eth0 down; iperf -c $SERVER_IPERF -t 300 -i 30 -u -b 100m -p 5050
68 _description:
69 Tests the performance of a systems wireless connection through the iperf tool, using UDP packets.

Subscribers

People subscribed via source and target branches