Skip to content

Commit 8feebcb

Browse files
committed
OWR*.206: Variable checks, improved cold-boot, other fixes
rtcwake static binary now provided via cloud download, simplified Download File kw added to lib/openwrt.robot Signed-off-by: Mateusz Maciejewski <[email protected]>
1 parent 053080e commit 8feebcb

File tree

4 files changed

+55
-18
lines changed

4 files changed

+55
-18
lines changed

dasharo-compatibility/os-openwrt.robot

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,35 @@ Test Setup Run Keyword
2121
Default Tags semiauto
2222

2323

24-
*** Variables ***
25-
${OPENWRT_IMAGE_LINK}= https://cloud.3mdeb.com/public.php/dav/files/nfC3WGaqCCzHmck
26-
${OPENWRT_IMAGE_FILE}= openwrt_combined_efi.img
27-
${OPENWRT_TARGET_DEVICE}= nvme0n1
28-
${OPENWRT_ETHERNET_CONTROLLER}= Intel Corporation Ethernet Controller
29-
30-
3124
*** Test Cases ***
3225
OWR001.206 Install operating system on disk (OpenWrt)
3326
[Documentation] This test installs OpenWrt on NVMe drive using dd program.
3427
... DTS is boot via iPXE and OpenWrt image is downloaded using wget.
3528
... OPENWRT_IMAGE_LINK - image link to download via wget
3629
... OPENWRT_IMAGE_FILE - core of file name
3730
... OPENWRT_TARGET_DEVICE - target drive to be wiped out using dd (!)
31+
[Tags] semiauto
32+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR001.206 not supported
33+
Variable Should Exist ${OPENWRT_TARGET_DEVICE}
34+
Variable Should Exist ${OPENWRT_IMAGE_LINK}
35+
Variable Should Exist ${OPENWRT_IMAGE_FILE}
36+
${selection}= Get Selection From User
37+
... Caution! You are about to install OpenWrt on ${OPENWRT_TARGET_DEVICE} device. Are you sure?
38+
... Yes, I'd like to wipe all the data existing on ${OPENWRT_TARGET_DEVICE} device.
39+
... No, let's skip OpenWrt installation.
40+
${contains_yes}= Run Keyword And Return Status Should Contain ${selection} Yes, I'd like to
41+
Skip If not(${contains_yes}) OpenWrt installation on ${OPENWRT_TARGET_DEVICE} device skipped.
3842
Power On
3943
Make Sure That Network Boot Is Enabled
4044
Boot Dasharo Tools Suite iPXE
4145
Enter Shell In DTS
4246
VAR ${openwrt_image_gz}= ${OPENWRT_IMAGE_FILE} .gz separator=${EMPTY}
4347
Remove File ${openwrt_image_gz}
4448
Remove File ${OPENWRT_IMAGE_FILE}
45-
Download File ${OPENWRT_IMAGE_LINK} ${openwrt_image_gz}
46-
Execute Linux Command gunzip ${openwrt_image_gz}
47-
Execute Linux Command dd if=${OPENWRT_IMAGE_FILE} of=/dev
49+
Download File OpenWrt ${OPENWRT_IMAGE_LINK} ${openwrt_image_gz}
50+
Execute Linux Command gunzip ${openwrt_image_gz} | dd of=/dev/${OPENWRT_TARGET_DEVICE} bs=1M
4851
Execute Linux Command sync
49-
Power On
52+
Execute Reboot Command
5053
Boot OpenWrt
5154
# Disabling DHCP server of OpenWrt
5255
Execute Command In Terminal /etc/init.d/odhcpd disable
@@ -58,13 +61,15 @@ OWR001.206 Install operating system on disk (OpenWrt)
5861

5962
OWR002.206 Boot operating system from disk (OpenWrt)
6063
[Documentation] Boot installed OpenWrt from NVMe drive, check identity.
64+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR002.206 not supported
6165
Power On
6266
Boot OpenWrt
6367
${out}= Execute Command In Terminal uname -a
6468
Should Contain ${out} OpenWrt
6569

6670
OWR003.206 Boot operating system from disk after cold-boot (OpenWrt)
6771
[Documentation] Boot OpenWrt from hard disk after cold-boot.
72+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR003.206 not supported
6873
VAR @{supported_power_ctrls}= RteCtrl sonoff
6974
Skip If '${POWER_CTRL}' not in ${supported_power_ctrls}
7075
Power On
@@ -78,10 +83,12 @@ OWR003.206 Boot operating system from disk after cold-boot (OpenWrt)
7883

7984
OWR004.206 Boot operating system from disk after warm-boot (OpenWrt)
8085
[Documentation] Boot OpenWrt from hard disk after warm-boot.
86+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR004.206 not supported
8187
Power On
8288
Boot OpenWrt
83-
Execute Command In Terminal poweroff
84-
Power On
89+
Download File OpenWrt https://cloud.3mdeb.com/public.php/dav/files/Aqe5Xj24pkoYLwX /bin/rtcwake
90+
Execute Command In Terminal chmod +x /bin/rtcwake
91+
Perform Warmboot Using Rtcwake
8592
${start_date}= Get Current Date
8693
Boot OpenWrt
8794
${end_date}= Get Current Date
@@ -90,6 +97,7 @@ OWR004.206 Boot operating system from disk after warm-boot (OpenWrt)
9097

9198
OWR005.206 Boot operating system from disk after reboot (OpenWrt)
9299
[Documentation] Boot OpenWrt from hard disk after reboot.
100+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR005.206 not supported
93101
Power On
94102
Boot OpenWrt
95103
Execute Command In Terminal reboot
@@ -101,6 +109,7 @@ OWR005.206 Boot operating system from disk after reboot (OpenWrt)
101109

102110
OWR006.206 Scan WiFi networks (OpenWrt)
103111
[Documentation] Enable WiFi and scan for 3mdeb lab network.
112+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR006.206 not supported
104113
Power On
105114
Boot OpenWrt
106115
Enable WiFi OpenWrt
@@ -109,6 +118,8 @@ OWR006.206 Scan WiFi networks (OpenWrt)
109118
OWR007.206 Ethernet controller detection (OpenWrt)
110119
[Documentation] Check presence of ethernet controller using lspci.
111120
... Install pciutils if missing. Controller name defined in OPENWRT_ETHERNET_CONTROLLER.
121+
Skip If not ${TESTS_IN_OPENWRT_SUPPORT} OWR007.206 not supported
122+
Variable Should Exist ${OPENWRT_ETHERNET_CONTROLLER}
112123
Power On
113124
Boot OpenWrt
114125
Detect Or Install Package OpenWrt pciutils

lib/openwrt.robot

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ Resource ../keywords.robot
44
Resource ../lib/platform/power.robot
55

66

7-
*** Variables ***
8-
${OPENWRT_WIFI_UP_ATTEMPTS}= 512
9-
${OPENWRT_WIFI_SCAN_ATTEMPTS}= 8
10-
11-
127
*** Keywords ***
138
Boot OpenWrt
149
[Documentation] Boot OpenWrt using Boot From File, kernel -> /efi/boot/bootx64.efi
@@ -40,6 +35,7 @@ Enable WiFi OpenWrt
4035
[Documentation] Enabling WiFi in OpenWrt with uci. Setting it up and
4136
... waiting for wifi status output to be "up".
4237
... Number of attempts defined in OPENWRT_WIFI_UP_ATTEMPTS.
38+
Variable Should Exist ${OPENWRT_WIFI_UP_ATTEMPTS}
4339
${out_show}= Execute Command In Terminal uci show wireless
4440
Should Contain ${out_show} wireless.radio0=wifi-device
4541
Execute Command In Terminal uci set wireless.radio0.country='PL'
@@ -63,6 +59,7 @@ Scan WiFi For Network OpenWrt
6359
[Documentation] Sanning for WiFi network named by ESSID. Interface name extracted
6460
... from wifi status command output. Number of attempts defined in OPENWRT_WIFI_SCAN_ATTEMPTS.
6561
[Arguments] ${essid}
62+
Variable Should Exist ${OPENWRT_WIFI_SCAN_ATTEMPTS}
6663
VAR @{empty_list}= @{EMPTY}
6764
${ifname_grep}= Execute Command In Terminal wifi status | grep "ifname"
6865
${re_search}= Get Regexp Matches ${ifname_grep} (\\s*)(\"ifname\":\\s*)\"([^"]*)\", 3
@@ -73,3 +70,14 @@ Scan WiFi For Network OpenWrt
7370
Pass Execution If ${contains} == ${TRUE} ${essid} network found in ${index} attempt(s).
7471
END
7572
Fail Searching for ${essid} network failed in ${OPENWRT_WIFI_SCAN_ATTEMPTS} attempts.
73+
74+
Download File OpenWrt
75+
[Documentation] Download file from the given URL.
76+
[Arguments] ${remote_url} ${local_path} ${timeout}=30
77+
Wait Until Keyword Succeeds 5x 1s
78+
... Check Internet Connection On Linux
79+
${out}= Execute Linux Command
80+
... wget --no-check-certificate -O ${local_path} ${remote_url}
81+
... ${timeout}
82+
Should Contain ${out} ${local_path}
83+
Should Not Contain ${out} failed

platform-configs/include/default.robot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ ${TESTS_IN_WINDOWS_SUPPORT}= ${FALSE}
8585
${TESTS_IN_METATB_SUPPORT}= ${FALSE}
8686
${TESTS_IN_HEADS_SUPPORT}= ${FALSE}
8787
${TESTS_IN_FEDORA_SUPPORT}= ${FALSE}
88+
${TESTS_IN_OPENWRT_SUPPORT}= ${FALSE}
8889

8990
# Regression test flags
9091
${DASHARO_SECURITY_MENU_SUPPORT}= ${FALSE}
@@ -262,6 +263,14 @@ ${CAPSULE_UPDATE_SUPPORT}= ${FALSE}
262263
# Test module: trenchboot
263264
${TRENCHBOOT_SUPPORT}= ${FALSE}
264265

266+
# OpenWRT-specific variables
267+
${OPENWRT_IMAGE_LINK}= ${TBD}
268+
${OPENWRT_IMAGE_FILE}= ${TBD}
269+
${OPENWRT_TARGET_DEVICE}= ${TBD}
270+
${OPENWRT_ETHERNET_CONTROLLER}= ${TBD}
271+
${OPENWRT_WIFI_UP_ATTEMPTS}= ${TBD}
272+
${OPENWRT_WIFI_SCAN_ATTEMPTS}= ${TBD}
273+
265274
# Test cases iterations number
266275
# Booting OS from USB stick test cases
267276
${BOOT_FROM_USB_ITERATIONS_NUMBER}= 0

platform-configs/include/protectli-common.robot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ ${TESTS_IN_FIRMWARE_SUPPORT}= ${TRUE}
4242
${TESTS_IN_UBUNTU_SUPPORT}= ${TRUE}
4343
${TESTS_IN_WINDOWS_SUPPORT}= ${TRUE}
4444
${TESTS_IN_ESXI_SUPPORT}= ${TRUE}
45+
${TESTS_IN_OPENWRT_SUPPORT}= ${TRUE}
4546

4647
# Regression test flags
4748
${DASHARO_USB_MENU_SUPPORT}= ${TRUE}
@@ -142,6 +143,14 @@ ${STABILITY_DETECTION_WARMBOOT_ITERATIONS}= 2
142143
${STABILITY_DETECTION_REBOOT_ITERATIONS}= 5
143144
${STABILITY_DETECTION_SUSPEND_ITERATIONS}= 5
144145

146+
# OpenWRT-specific variables
147+
${OPENWRT_IMAGE_LINK}= https://cloud.3mdeb.com/public.php/dav/files/nfC3WGaqCCzHmck
148+
${OPENWRT_IMAGE_FILE}= openwrt_combined_efi.img
149+
${OPENWRT_TARGET_DEVICE}= nvme0n1
150+
${OPENWRT_ETHERNET_CONTROLLER}= Intel Corporation Ethernet Controller
151+
${OPENWRT_WIFI_UP_ATTEMPTS}= 512
152+
${OPENWRT_WIFI_SCAN_ATTEMPTS}= 8
153+
145154

146155
*** Keywords ***
147156
Power On

0 commit comments

Comments
 (0)