From 1e518cb60675553b46cfb76edd0b48832eb8bac6 Mon Sep 17 00:00:00 2001 From: Roman Iten Date: Wed, 26 Feb 2025 14:58:11 +0100 Subject: [PATCH] dde_linux: use 'assert'-proc in run scripts Issue #5432 --- repos/dde_linux/run/driver_time.run | 5 +--- repos/dde_linux/run/nic_router_uplinks.run | 5 ++-- repos/dde_linux/run/usb_hid_raw.run | 26 ++++++++------------ repos/dde_linux/run/usb_hid_reconnect.run | 14 +++-------- repos/dde_linux/run/vfs_cfg.run | 6 ++--- repos/dde_linux/run/wg_fetchurl.run | 5 +--- repos/dde_linux/run/wg_qemu_tap_preamble.inc | 20 +++------------ repos/dde_linux/run/wg_reconfig.run | 5 +--- repos/dde_linux/run/wg_reconnect.run | 5 +--- 9 files changed, 27 insertions(+), 64 deletions(-) diff --git a/repos/dde_linux/run/driver_time.run b/repos/dde_linux/run/driver_time.run index ad2b5d8b2b..2f97ae4ebe 100644 --- a/repos/dde_linux/run/driver_time.run +++ b/repos/dde_linux/run/driver_time.run @@ -1,7 +1,4 @@ -if {[expr ![have_spec arm_64] && ![have_spec x86_64]]} { - puts "Run script is not supported on this platform." - exit 0 -} +assert {[have_spec arm_64] || [have_spec x86_64]} set use_top 0 diff --git a/repos/dde_linux/run/nic_router_uplinks.run b/repos/dde_linux/run/nic_router_uplinks.run index 0c069c0b9a..9ac800a18c 100644 --- a/repos/dde_linux/run/nic_router_uplinks.run +++ b/repos/dde_linux/run/nic_router_uplinks.run @@ -1,5 +1,6 @@ -if {[expr ![have_spec nova] && ![have_spec sel4] && ![have_spec hw] && ![have_spec foc] || ![have_spec x86] || [have_include power_on/qemu]]} { - puts "\n Run script is not supported on this platform. \n"; exit 0 } +assert {[have_spec x86]} +assert {[have_spec nova] || [have_spec sel4] || [have_spec hw] || [have_spec foc]} +assert {![have_include power_on/qemu]} proc wifi_ssid {} { return "$::env(GENODE_WIFI_SSID2)" } diff --git a/repos/dde_linux/run/usb_hid_raw.run b/repos/dde_linux/run/usb_hid_raw.run index d0834a63fd..29023edaca 100644 --- a/repos/dde_linux/run/usb_hid_raw.run +++ b/repos/dde_linux/run/usb_hid_raw.run @@ -38,23 +38,17 @@ # input events on the host PC. # -if {[have_board linux]} { - puts "Run script does not support Linux." - exit 0 -} +assert {![have_board linux]} -if {[get_cmd_switch --autopilot] && [have_include "power_on/qemu"]} { - puts "Run script does not support autopilot mode on Qemu" - exit 0 -} +if {[have_cmd_switch --autopilot]} { + assert {![have_include power_on/qemu]} \ + "Autopilot mode is not supported on this platform." -if { [get_cmd_switch --autopilot] && - ![have_board pc] && - ![have_board rpi] && - ![have_board imx8q_evk] && - ![have_board imx6q_sabrelite]} { - puts "Run script does not support autopilot mode on this platform" - exit 0 + assert {[have_board pc] || + [have_board rpi] || + [have_board imx8q_evk] || + [have_board imx6q_sabrelite]} \ + "Autopilot mode is not supported on this platform." } create_boot_directory @@ -196,7 +190,7 @@ append qemu_args " -device nec-usb-xhci,id=xhci" append qemu_args " -device usb-kbd,bus=xhci.0" append qemu_args " -device usb-mouse,bus=xhci.0" -if { [have_include "power_on/qemu"] || ![get_cmd_switch --autopilot] } { run_genode_until forever } +if { [have_include "power_on/qemu"] || ![have_cmd_switch --autopilot] } { run_genode_until forever } # autopilot test diff --git a/repos/dde_linux/run/usb_hid_reconnect.run b/repos/dde_linux/run/usb_hid_reconnect.run index 443bc91d8b..a885fbffed 100644 --- a/repos/dde_linux/run/usb_hid_reconnect.run +++ b/repos/dde_linux/run/usb_hid_reconnect.run @@ -3,17 +3,9 @@ # # Test connect and disconnect on Qemu -assert_spec x86 - -if {[have_spec linux]} { - puts "Run script does not support Linux." - exit 0 -} - -if {![have_include "power_on/qemu"]} { - puts "Test requires to be run on Qemu." - exit 0 -} +assert {[have_spec x86]} +assert {![have_spec linux]} +assert {[have_include power_on/qemu]} create_boot_directory import_from_depot [depot_user]/src/[base_src] \ diff --git a/repos/dde_linux/run/vfs_cfg.run b/repos/dde_linux/run/vfs_cfg.run index 08b20ff543..88799c72e4 100644 --- a/repos/dde_linux/run/vfs_cfg.run +++ b/repos/dde_linux/run/vfs_cfg.run @@ -1,6 +1,6 @@ -if {[get_cmd_switch --autopilot] && [have_board virt_qemu_riscv]} { - puts "Autopilot mode is not supported on this platform." - exit 0 +if {[have_cmd_switch --autopilot]} { + assert {![have_board virt_qemu_riscv]} \ + "Autopilot mode is not supported on this platform." } build { diff --git a/repos/dde_linux/run/wg_fetchurl.run b/repos/dde_linux/run/wg_fetchurl.run index 5c43fbe5ad..418695ef45 100644 --- a/repos/dde_linux/run/wg_fetchurl.run +++ b/repos/dde_linux/run/wg_fetchurl.run @@ -8,10 +8,7 @@ # then check the MD5 sum of the file. # -if {[expr ![have_spec arm_64] && ![have_spec x86_64]]} { - puts "Run script is not supported on this platform." - exit 0 -} +assert {[have_spec arm_64] || [have_spec x86_64]} if {[have_spec linux]} { set linux 1 diff --git a/repos/dde_linux/run/wg_qemu_tap_preamble.inc b/repos/dde_linux/run/wg_qemu_tap_preamble.inc index e1b6ef0344..ddb330e337 100644 --- a/repos/dde_linux/run/wg_qemu_tap_preamble.inc +++ b/repos/dde_linux/run/wg_qemu_tap_preamble.inc @@ -7,20 +7,9 @@ # undone whenever the test terminates. # -if {[expr ![have_spec arm_64] && ![have_spec x86_64]]} { - puts "Run script is not supported on this platform." - exit 0 -} - -if {[expr [have_spec arm_64] && ![have_board virt_qemu]]} { - puts "Run script is not supported on this platform." - exit 0 -} - -if {[expr ![have_include power_on/qemu]]} { - puts "Test requires Qemu." - exit 0 -} +assert {[have_spec arm_64] || [have_spec x86_64]} +assert {[have_board virt_qemu] || ![have_spec arm_64]} +assert {[have_include power_on/qemu]} append wg_board_qemu_args " -m 512 " append wg_board_qemu_args " -nographic " @@ -41,8 +30,7 @@ if {[have_board virt_qemu]} { } else { - puts "Run script is not supported on this platform." - exit 0 + assert {false} "Run script is not supported on this platform." } proc board_qemu_args { } { diff --git a/repos/dde_linux/run/wg_reconfig.run b/repos/dde_linux/run/wg_reconfig.run index 32f7a8c1fa..2291d68191 100644 --- a/repos/dde_linux/run/wg_reconfig.run +++ b/repos/dde_linux/run/wg_reconfig.run @@ -14,10 +14,7 @@ # server WireGuard. # -if {[expr ![have_spec arm_v8a] && ![have_spec x86_64]]} { - puts "Run script is not supported on this platform." - exit 0 -} +assert {[have_spec arm_v8a] || [have_spec x86_64]} create_boot_directory diff --git a/repos/dde_linux/run/wg_reconnect.run b/repos/dde_linux/run/wg_reconnect.run index 49eaf88fa3..bc71442ada 100644 --- a/repos/dde_linux/run/wg_reconnect.run +++ b/repos/dde_linux/run/wg_reconnect.run @@ -38,10 +38,7 @@ # # The client side will be restarted two times to test reconnecting. -if { ![expr [have_board linux] || [have_board pc]] } { - puts "Run script is not supported on this platform." - exit 0 -} +assert {[have_board linux] || [have_board pc]} proc rtc_binary_name { } {