os: use 'assert'-proc in run scripts

Issue 
This commit is contained in:
Roman Iten 2025-01-22 10:49:56 +01:00 committed by Christian Helmuth
parent 369a7a242b
commit df26fe779a
31 changed files with 94 additions and 169 deletions

@ -1,4 +1,4 @@
assert_spec x86
assert {[have_spec x86]}
create_boot_directory
build {

@ -1,20 +1,15 @@
#
# there are no nic driver packages for these targets
#
if {[have_board rpi3] ||
[have_board imx53_qsb_tz]} {
puts "Run script is not supported on this platform."
exit 0
}
assert {![have_board rpi3]}
assert {![have_board imx53_qsb_tz]}
#
# these targets would require extra setup on the autopilot which is not desired
#
if {[get_cmd_switch --autopilot] && ([have_spec linux] ||
[have_board zynq_qemu] ||
[have_board virt_qemu_riscv])} {
puts "Autopilot mode is not supported on this platform."
exit 0
if {[have_cmd_arg --autopilot]} {
assert {![have_board linux] &&
![have_board zynq_qemu] &&
![have_board virt_qemu_riscv]} \
"Autopilot mode is not supported on this platform."
}

@ -3,8 +3,4 @@ source ${genode_dir}/repos/os/run/assert_nic.inc
#
# the test should be run isolated as it would disturb normal network operation
#
if {![have_include power_on/qemu]} {
puts "Run script is not supported on this platform."
exit 0
}
assert {[have_include power_on/qemu]}

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
#
# Check used commands

@ -17,11 +17,9 @@ if {[have_include "power_on/qemu"]} {
}
}
if {[have_spec pistachio]} {
# The bomb test triggers a kernel assertion at kernel/src/api/v4/tcb.h,
# line 727, which remains unfixed since the kernel is no longer developed.
puts "Run script does not support Pistachio"
exit 0
assert {![have_spec pistachio]} {
The bomb test triggers a kernel assertion at kernel/src/api/v4/tcb.h,
line 727, which remains unfixed since the kernel is no longer developed.
}
# prevent hitting the socket-descriptor limit on Linux

@ -3,15 +3,10 @@ build {
server/cpu_balancer app/cpu_burner app/top server/dynamic_rom
}
if {![have_include "power_on/qemu"]} {
puts "Run script is not supported on this platform"
exit 0
}
# foc in principle supports migration, but due to bug #4357 foc is not tested
if {![have_spec nova] && ![have_spec sel4]} {
puts "Run script is not supported on this platform"
exit 0
}
assert {[have_include power_on/qemu]}
assert {[have_spec nova] || [have_spec sel4]} \
"foc in principle supports migration, but due to bug #4357 foc is not tested"
set cpu_width 4
set cpu_height 1

@ -1,14 +1,9 @@
if {[get_cmd_switch --autopilot]} {
if {[have_include "power_on/qemu"]} {
puts "\nRun script does not support Qemu.\n"
exit 0
}
if {[have_cmd_arg --autopilot]} {
assert {![have_include power_on/qemu]} \
"Autopilot mode is not supported on this platform."
}
if {[have_board linux]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
assert {![have_board linux]}
build { core init timer lib/ld test/cpu_bench }

@ -1,10 +1,9 @@
if {[have_board imx6q_sabrelite] ||
[have_board imx7d_sabre] ||
[have_board zynq_usrp_e31x] ||
([get_cmd_switch --autopilot] && [have_board linux]) ||
([get_cmd_switch --autopilot] && [have_include "power_on/qemu"])} {
puts "Run script does not support this platform."
exit 0
assert {[have_recipe pkg/[drivers_interactive_pkg]]} \
"Recipe for 'pkg/[drivers_interactive_pkg]' not available."
if {[have_cmd_arg --autopilot]} {
assert {![have_board linux] && ![have_include power_on/qemu]} \
"Autopilot mode is not supported on this platform."
}
create_boot_directory
@ -206,7 +205,7 @@ close $launchpad_config_fd
build_boot_image [list {*}[build_artifacts] launchpad.config]
if {[get_cmd_switch --autopilot]} {
if {[have_cmd_arg --autopilot]} {
run_genode_until {\[init -> scout\] png is.*\n} 40
grep_output {(requests resources: )|(Error)}

@ -1,18 +1,9 @@
if {[have_board imx7d_sabre] ||
[have_board imx6q_sabrelite] ||
[have_board rpi3] ||
[have_board zynq_qemu] ||
[have_board zynq_usrp_e31x] ||
[have_board imx53_qsb_tz] ||
[have_board imx53_qsb] && [have_spec foc]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
assert {[have_recipe pkg/[drivers_interactive_pkg]]} \
"Recipe for 'pkg/[drivers_interactive_pkg]' not available."
if {[get_cmd_switch --autopilot] && ([have_spec linux] ||
[have_board virt_qemu_riscv])} {
puts "\nAutopilot run is not supported on this platform\n"
exit 0
if {[have_cmd_arg --autopilot]} {
assert {![have_spec linux] && ![have_board virt_qemu_riscv]} \
"Autopilot mode is not supported on this platform."
}
create_boot_directory

@ -1,3 +1,6 @@
assert {[have_recipe pkg/[drivers_interactive_pkg]]} \
"Recipe for 'pkg/[drivers_interactive_pkg]' not available."
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \

@ -10,14 +10,12 @@ set demand [expr 1*1024*1024]
set cpus 4
set init_ram 256
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_arg --autopilot] } {
if {[have_include "power_on/qemu"]} {
puts "\nRun script does not support Qemu.\n"
exit 0
}
assert {![have_include power_on/qemu]} \
"Autopilot mode is not supported on this platform."
assert_spec nova
assert {[have_spec nova]}
# set specifically for our nightly test hardware */
if {[have_spec x86_64]} {
@ -104,7 +102,7 @@ build_boot_image [build_artifacts]
append qemu_args " -m [expr 128 + $init_ram*$cpus]M -nographic -smp $cpus"
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_arg --autopilot] } {
run_genode_until {bomb started} 20

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
set tshark [installed_command tshark]
set trafgen [installed_command trafgen]
@ -11,7 +11,7 @@ rename exit run_tool_exit
proc exit {{code 0}} {
global lx_fs_dir
global input_file
if {[get_cmd_switch --autopilot]} { exec rm -rf $input_file $lx_fs_dir }
if {[have_cmd_arg --autopilot]} { exec rm -rf $input_file $lx_fs_dir }
run_tool_exit $code
}
build { core init lib/ld lib/vfs test/internet_checksum server/lx_fs }

@ -1,14 +1,12 @@
if {[have_spec linux]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
if {[get_cmd_switch --autopilot] && ![have_include "power_on/qemu"]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
assert {![have_spec linux]}
if {[have_cmd_arg --autopilot]} {
assert {[have_include power_on/qemu]} \
"Autopilot mode is not supported on this platform."
}
proc log_service { } {
if { [get_cmd_switch --autopilot] } { return log }
if { [have_cmd_arg --autopilot] } { return log }
return ram
}
@ -107,7 +105,7 @@ build_boot_image [build_artifacts]
append qemu_args " -nographic "
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_arg --autopilot] } {
run_genode_until {.*\[log_core -> log] \[.*\n} 20
} else {
run_genode_until forever

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
lappend depot_archives [depot_user]/src/[base_src]
lappend depot_archives [depot_user]/src/init
@ -7,7 +7,7 @@ lappend depot_archives [depot_user]/src/vfs_import
set build_components { }
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_arg --autopilot] } {
lappend depot_archives [depot_user]/src/lx_fs
} else {
lappend build_components server/lx_fs

@ -1,7 +1,4 @@
if {[have_include "power_on/qemu"]} {
puts "\nTest running on Qemu is not supported.\n"
exit 0
}
assert {![have_include power_on/qemu]}
build {
core init timer lib/ld

@ -5,10 +5,7 @@ proc platform_supported { } {
return 0
}
if {![platform_supported]} {
puts "Run script is not supported on this platform"
exit 0
}
assert {[platform_supported]}
build {
core lib/ld init timer monitor lib/sandbox

@ -10,10 +10,7 @@ proc platform_supported { } {
return 0
}
if {![platform_supported]} {
puts "Run script is not supported on this platform"
exit 0
}
assert {[platform_supported]}
create_boot_directory

@ -1,4 +1,4 @@
assert_spec x86
assert {[have_spec x86]}
# perform write tests when requested
if {[info exists env(GENODE_TEST_WRITE)]} {
@ -14,10 +14,9 @@ set is_32bit_x86_hw [expr !$is_qemu && [have_spec 32bit]]
#
# Only run tests on supported platforms
#
if {[expr [have_spec linux] || $is_32bit_x86_hw || [expr $is_qemu && $is_old]]} {
puts "This run script is not supported on this platform."
exit 0
}
assert {![have_spec linux]}
assert {!$is_32bit_x86_hw}
assert {!($is_qemu && $is_old)}
#
# Qemu and on certain platforms only use the small set of tests

@ -38,17 +38,11 @@ set on_linux_with_dst_ip ""
catch {set on_linux_with_dst_ip $::env(ON_LINUX_WITH_DST_IP)}
set on_linux [expr ![string equal $on_linux_with_dst_ip ""]]
if {[expr [have_spec linux] && !$on_linux]} {
assert {!([have_spec linux] && !$on_linux)} \
"You must set 'on_linux_with_dst_ip' in the run script if you want to run on Linux."
puts "You must set 'on_linux_with_dst_ip' in the run script if you want to run on Linux."
exit 0
}
if {[expr ![have_spec linux] && $on_linux]} {
puts "You must run on Linux if 'on_linux_with_dst_ip' in the run script is set."
exit 0
}
assert {!(![have_spec linux] && $on_linux)} \
"You must run on Linux if 'on_linux_with_dst_ip' in the run script is set."
set on_hardware [expr ![have_include power_on/qemu]]
set second_ping_via_udp [expr $on_hardware && !$on_linux]

@ -1,7 +1,4 @@
if { ![have_board pbxa9] } {
puts "Platform is unsupported."
exit 0
}
assert {[have_board pbxa9]}
create_boot_directory

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
build {
core init timer lib/ld

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
build { core init timer lib/ld server/dynamic_rom app/rom_to_file server/lx_fs }

@ -1,7 +1,4 @@
if {![have_board pbxa9]} {
puts "Test requires board pbxa9"
exit
}
assert {[have_board pbxa9]}
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \

@ -1,10 +1,9 @@
#
# Check for platform support
#
if {[get_cmd_switch --autopilot] &&
[expr [have_board virt_qemu_riscv] || [have_board rpi]]} {
puts "Autopilot mode is not supported on this platform."
exit 0
if {[have_cmd_arg --autopilot]} {
assert {![have_board virt_qemu_riscv] && ![have_board rpi]} \
"Autopilot mode is not supported on this platform."
}
proc buffer_size_kib {} {
@ -13,8 +12,7 @@ proc buffer_size_kib {} {
if {[have_board imx53_qsb]} { return [expr 1024] }
if {[have_board imx53_qsb_tz]} { return [expr 1024] }
if {[have_board rpi]} { return [expr 4 * 1024] }
puts "\n Run script is not supported on this platform. \n";
exit 0;
assert {false} "Run script is not supported on this platform."
}
proc sd_card {} {
@ -23,8 +21,7 @@ proc sd_card {} {
if {[have_board imx53_qsb]} { return imx53_sd_card }
if {[have_board imx53_qsb_tz]} { return imx53_sd_card }
if {[have_board rpi]} { return rpi_sd_card }
puts "\n Run script is not supported on this platform. \n";
exit 0;
assert {false} "Run script is not supported on this platform."
}
create_boot_directory

@ -1,9 +1,7 @@
assert_spec x86_64
assert {[have_spec x86_64]}
if {![have_board pc] || [expr ![have_spec nova] && ![have_spec hw]] } {
puts "Run script is only supported on hw/pc and nova/pc"
exit 0
}
assert {[have_board pc]}
assert {[have_spec nova] || [have_spec hw]}
build { core init timer lib/ld driver/acpi server/report_rom app/smbios_decoder }

@ -16,7 +16,7 @@
# file system ('execve' takes a file name as argument). Data extracted via
# 'tar_rom' is not represented as file. Hence, it cannot be executed.
#
if {[have_spec linux]} { puts "Run script does not support Linux"; exit 0 }
assert {![have_spec linux]}
build { core init timer lib/ld test/timer server/tar_rom }

@ -39,6 +39,8 @@
# make run/test KERNEL=linux PKG=test-fs_report
#
assert {![have_cmd_arg --autopilot]}
##
# Obtain name of the test pkg from the 'PKG' environment variable
#

@ -1,7 +1,4 @@
if { ![have_board pbxa9] } {
puts "Platform is unsupported."
exit 0
}
assert {[have_board pbxa9]}
build { core init timer lib/ld driver/uart test/uart }

@ -1,11 +1,8 @@
if {![have_board pc]} {
puts "\nRun script is not supported on this platform.\n";
exit 0
}
assert {[have_board pc]}
if {[get_cmd_switch --autopilot] && ![have_include "power_on/qemu"]} {
puts "\nAutopilot run is not supported on this platform\n"
exit 0
if {[have_cmd_arg --autopilot]} {
assert {[have_include power_on/qemu]} \
"Autopilot mode is not supported on this platform."
}
create_boot_directory

@ -4,14 +4,12 @@
# \date 2015-06-25
#
assert_spec hw
assert {[have_spec hw]}
if { ![have_board imx7d_sabre] && ![have_board imx8q_evk] &&
![have_board virt_qemu_arm_v7a] &&
![have_board virt_qemu_arm_v8a]} {
puts "Run script is not supported on this platform"
exit 0
}
assert {[have_board imx7d_sabre] ||
[have_board imx8q_evk] ||
[have_board virt_qemu_arm_v7a] ||
[have_board virt_qemu_arm_v8a]}
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \

@ -4,25 +4,15 @@
# \author Benjamin Lamowski
# \date 2018-08-26
assert_spec x86
assert {[have_spec x86]}
if { [get_cmd_switch --autopilot] } {
# nightly x86 32bit test machine has no vmx support
if {[have_spec x86_32] && ![have_include "power_on/qemu"]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
if { [have_cmd_arg --autopilot] } {
assert {!([have_spec x86_32] && ![have_include power_on/qemu])} \
"Nightly x86 32-bit test machine has no vmx support."
if {[have_include "power_on/qemu"] && [have_spec sel4]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
assert {!([have_include power_on/qemu] && [have_spec sel4])}
if {[have_spec nova] || [have_spec foc] || [have_spec sel4]} {
} else {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
assert {[have_spec nova] || [have_spec foc] || [have_spec sel4]}
}
# ia32_tsc_aux with rdtscp