summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-06 09:03:11 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-13 17:30:34 +0200
commit9da508d6a39eb24fdc70eb5a525be58d2c06202a (patch)
tree44572c5a33292b3c2d84cfe884c2a602dbff7d51 /tests
parent420f69566a25fe83136269445d81a85a35cb053c (diff)
downloadalpine-conf-9da508d6a39eb24fdc70eb5a525be58d2c06202a.zip
setup-interfaces: add test for interactive wifi setup
Diffstat (limited to 'tests')
-rwxr-xr-xtests/bin/iwlist66
-rwxr-xr-xtests/bin/wpa_passphrase9
-rwxr-xr-xtests/setup_interfaces_test27
3 files changed, 101 insertions, 1 deletions
diff --git a/tests/bin/iwlist b/tests/bin/iwlist
new file mode 100755
index 0000000..6b92726
--- /dev/null
+++ b/tests/bin/iwlist
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+cat<<EOF
+wlan0 Scan completed :
+ Cell 01 - Address: 98:77:E7:E6:75:2F
+ Channel:1
+ Frequency:2.412 GHz (Channel 1)
+ Quality=45/70 Signal level=-65 dBm
+ Encryption key:on
+ ESSID:"Telenor0366rar"
+ Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
+ 24 Mb/s; 36 Mb/s; 54 Mb/s
+ Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
+ Mode:Master
+ Extra:tsf=00000167602af804
+ Extra: Last beacon: 2067ms ago
+ IE: Unknown: 000E54656C656E6F7230333636726172
+ IE: Unknown: 010882848B962430486C
+ IE: Unknown: 030101
+ IE: Unknown: 07064E4F20010D14
+ IE: Unknown: 200100
+ IE: Unknown: 23021100
+ IE: Unknown: 2A0104
+ IE: Unknown: 32040C121860
+ IE: IEEE 802.11i/WPA2 Version 1
+ Group Cipher : CCMP
+ Pairwise Ciphers (1) : CCMP
+ Authentication Suites (1) : PSK
+ IE: Unknown: 0B0501002E0000
+ IE: Unknown: 2D1ABC091BFFFF000000000000000000000000000000000000000000
+ IE: Unknown: 3D1601080400000000000000000000000000000000000000
+ IE: Unknown: 7F080400080000000040
+ IE: Unknown: DD840050F204104A0001101044000102103B00010310470010393837374537F536F735323739383737102100044B616F6E10230008444732323030544E10240003312E311042000F3037313230323830343137323933381054000800060050F20400011011000A57694669205275746572100800020006103C0001031049000600372A000120
+ IE: Unknown: DD090010180201001C0000
+ IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
+ Cell 02 - Address: 98:77:E7:E6:75:30
+ Channel:1
+ Frequency:2.412 GHz (Channel 1)
+ Quality=45/70 Signal level=-65 dBm
+ Encryption key:on
+ ESSID:"Telenor0366rar-5GHz"
+ Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
+ 24 Mb/s; 36 Mb/s; 54 Mb/s
+ Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
+ Mode:Master
+ Extra:tsf=00000167602b053e
+ Extra: Last beacon: 2064ms ago
+ IE: Unknown: 001354656C656E6F72303336367261722D3547487A
+ IE: Unknown: 010882848B962430486C
+ IE: Unknown: 030101
+ IE: Unknown: 07064E4F20010D14
+ IE: Unknown: 200100
+ IE: Unknown: 23021100
+ IE: Unknown: 2A0104
+ IE: Unknown: 32040C121860
+ IE: IEEE 802.11i/WPA2 Version 1
+ Group Cipher : CCMP
+ Pairwise Ciphers (1) : CCMP
+ Authentication Suites (1) : PSK
+ IE: Unknown: 0B0504002E0000
+ IE: Unknown: 2D1ABC091BFFFF000000000000000000000000000000000000000000
+ IE: Unknown: 3D1601080400000000000000000000000000000000000000
+ IE: Unknown: 7F080400080000000040
+ IE: Unknown: DD090010180204001C0000
+ IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
+EOF
diff --git a/tests/bin/wpa_passphrase b/tests/bin/wpa_passphrase
new file mode 100755
index 0000000..33e3c34
--- /dev/null
+++ b/tests/bin/wpa_passphrase
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+cat<<EOF
+network={
+ ssid="Telenor0366rar"
+ #psk="0123456789"
+ psk=87ffb01b74e1ebecab3bf1588668728f2eb78440e3a757460012bb71943c22d9
+}
+EOF
diff --git a/tests/setup_interfaces_test b/tests/setup_interfaces_test
index c189918..e210b26 100755
--- a/tests/setup_interfaces_test
+++ b/tests/setup_interfaces_test
@@ -8,7 +8,8 @@ init_tests \
setup_interfaces_interactive_vlan_ng \
setup_interfaces_interactive_vlan0_ng \
setup_interfaces_interactive_br0 \
- setup_interfaces_interactive_bond0
+ setup_interfaces_interactive_bond0 \
+ setup_interfaces_interactive_wlan0
setup_interfaces_usage_body() {
test_usage setup-interfaces
@@ -152,3 +153,27 @@ setup_interfaces_interactive_bond0_body() {
-o match:"apk add.*bonding" \
setup-interfaces <answers
}
+
+setup_interfaces_interactive_wlan0_body() {
+ init_env
+ create_fake_ifaces lo eth0 wlan2
+ mkdir -p sys/class/net/wlan2/phy80211
+
+ (
+ # Which one do you want to initialize? (or '?' or 'done') [eth0]
+ echo wlan2
+ # Type the wireless network name to connect to:
+ echo Telenor0366rar
+ # Type the "Telenor0366rar" network Pre-Shared Key (will not echo):
+ echo 0123456789
+ # Ip address for wlan0? (or 'dhcp', 'none', '?') [dhcp]
+ echo dhcp
+ # Do you want to do any manual network configuration? (y/n) [n]
+ echo n
+ )>answers
+ atf_check -s exit:0 \
+ -o match:"Available interfaces are: eth0 wlan2" \
+ -o match:"Type the \"Telenor0366rar\" network Pre-Shared Key" \
+ -o match:"Ip address for wlan2" \
+ setup-interfaces <answers
+}