gems: use 'assert'-proc in run scripts

Issue #5432
This commit is contained in:
Roman Iten 2025-02-26 17:43:39 +01:00 committed by Norman Feske
parent d5ff0877d3
commit f4d5e480e3
18 changed files with 60 additions and 85 deletions

View File

@ -3,9 +3,9 @@ set block_number 12345
set test_rounds 10000
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 { core lib/ld init lib/libc lib/vfs lib/libcrypto test/aes_cbc_4k }

View File

@ -1,8 +1,8 @@
if { ![have_spec foc] && ![have_spec hw] && ![have_spec nova] &&
![have_spec okl4] && ![have_spec sel4] } {
puts "Run script is not supported on this platform"
exit 0
}
assert {[have_spec foc] &&
[have_spec hw] &&
[have_spec nova] &&
[have_spec okl4] &&
[have_spec sel4]}
set build_components {
core lib/ld init timer

View File

@ -148,7 +148,7 @@ proc autopilot_run_genode_until {{wait_for_re forever} {timeout_value 0} {runnin
# Whether the run script is used interactively
#
proc interactive {} {
return [expr ![get_cmd_switch --autopilot]]
return [expr ![have_cmd_switch --autopilot]]
}
@ -622,15 +622,11 @@ proc exit {{status 0}} {
#
# Check platform support
#
if {[expr ![have_spec x86] && \
![have_spec arm_v6] && \
![have_spec arm_v7a] && \
![have_spec arm_v8a] && \
![have_spec riscv]]} \
{
puts "\n Run script is not supported on this platform. \n";
exit 0
}
assert {[have_spec x86] ||
[have_spec arm_v6] ||
[have_spec arm_v7a] ||
[have_spec arm_v8a] ||
[have_spec riscv]}
#
# Default list of test package-archives

View File

@ -1,15 +1,14 @@
assert {![have_board linux] &&
![have_board rpi3] &&
![have_board imx53_qsb_tz]}
if {[have_cmd_switch --autopilot]} {
assert {![have_board virt_qemu_riscv]} \
"Autopilot mode is not supported on this platform."
}
create_boot_directory
if {[have_board linux] || [have_board rpi3] || [have_board imx53_qsb_tz]} {
puts "Run script does not support this platform."
exit 0
}
if {[get_cmd_switch --autopilot] && [have_board virt_qemu_riscv]} {
puts "Autopilot mode is not supported on this platform."
exit 0
}
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/[drivers_nic_pkg] \
[depot_user]/src/report_rom \

View File

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
create_boot_directory
@ -20,7 +20,7 @@ create_tar_from_depot_binaries [run_dir]/genode/depot.tar \
[depot_user]/pkg/themed_decorator \
[depot_user]/pkg/sticks_blue_backdrop
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_switch --autopilot] } {
import_from_depot [depot_user]/src/depot_remove
} else {
build { app/depot_remove }
@ -74,7 +74,7 @@ exec mkdir [run_dir]/genode/depot
exec tar xvf [run_dir]/genode/depot.tar -C [run_dir]/genode/depot
exec chmod -R +r [run_dir]/genode/depot
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_switch --autopilot] } {
build_boot_image {}
} else {
build_boot_image [build_artifacts]

View File

@ -1,7 +1,4 @@
if {[have_spec riscv]} {
puts "\n Run script is not supported on this platform. \n";
exit 0
}
assert {![have_spec riscv]}
proc jent_avail { } {
if {[have_board pbxa9]} { return 0 }
@ -454,4 +451,4 @@ if {[container_initialized]} {
}
}
if {[get_cmd_switch --autopilot] && [have_board linux]} { exec rm -rf [lx_fs_dir] }
if {[have_cmd_switch --autopilot] && [have_board linux]} { exec rm -rf [lx_fs_dir] }

View File

@ -1,8 +1,8 @@
create_boot_directory
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."
}
import_from_depot \

View File

@ -1,7 +1,7 @@
#
# Test runs only on Linux
#
assert_spec linux
assert {[have_spec linux]}
#
# Build

View File

@ -10,21 +10,13 @@
proc sculpt_version { } { return "24.10" }
proc assert_platform_supported { } {
if {[have_board pc]} return
if {[have_board imx8q_evk]} return
if {[have_board mnt_reform2]} return
if {[have_board mnt_pocket]} return
if {[have_board linux]} return
if {[have_board pinephone]} return
if {[have_board imx8mp_armstone]} return
puts "Platform is unsupported.";
exit 0;
}
assert_platform_supported
assert {[have_board pc] ||
[have_board imx8q_evk] ||
[have_board mnt_reform2] ||
[have_board mnt_pocket] ||
[have_board linux] ||
[have_board pinephone] ||
[have_board imx8mp_armstone]}
proc log_core { } {

View File

@ -2,19 +2,11 @@
# Generates publishable Sculpt system image
#
proc board_supported { } {
if {[have_board pinephone]} { return true }
if {[have_board pc]} { return true }
if {[have_board mnt_reform2]} { return true }
if {[have_board mnt_pocket]} { return true }
if {[have_board imx8mp_armstone]} { return true }
return false
}
if {![board_supported]} {
puts stderr "board is not supported by the run script"
exit 1
}
assert {[have_board pinephone] ||
[have_board pc] ||
[have_board mnt_reform2] ||
[have_board mnt_pocket] ||
[have_board imx8mp_armstone]}
proc assert_include { include } {
if {![have_include $include]} {

View File

@ -8,8 +8,7 @@
# TODO: Add support for Linux via user-level networking (using the
# tun/tap proxy driver at os/src/driver/nic/linux)
#
if {[have_spec linux]} {
puts "Run script does not support Linux."; exit 0 }
assert {![have_spec linux]}
create_boot_directory

View File

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
# check that babeltrace2 is present
set babeltrace_missing [catch {

View File

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
# check that babeltrace2 is present
set babeltrace_missing [catch {

View File

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
# check that python-pcapng is present
set python_pcapng_missing [catch {

View File

@ -1,7 +1,7 @@
# riscv lacks jitterentropy support currently
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."
}
set dd [installed_command dd]
@ -917,7 +917,7 @@ install_config $config
if {[have_board linux]} {
exec rm -rf [lx_local_tresor_image]
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_switch --autopilot] } {
exec rm -rf [lx_autopilot_tresor_image]
catch { exec $dd if=/dev/urandom of=[lx_autopilot_tresor_image] bs=1M count=[lx_tresor_image_size_mb] }
@ -945,7 +945,7 @@ run_genode_until "child \"test\" exited with exit value.*\n" $test_timeout
if {[have_board linux]} {
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_switch --autopilot] } {
exec rm -rf [lx_local_tresor_image]
exec rm -rf [lx_autopilot_tresor_image]

View File

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
append build_components {
core init timer lib/ld lib/vfs server/lx_block server/lx_fs server/vfs app/sequence

View File

@ -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 { app/sequence server/vfs lib/libc lib/vfs lib/vfs_import test/libc }

View File

@ -1,4 +1,4 @@
assert_spec linux
assert {[have_spec linux]}
set dd [installed_command dd]
@ -266,7 +266,7 @@ set repo "[repository_contains $shell_script]"
exec cp $repo/$shell_script bin/
exec rm -rf [local_tresor_image]
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_switch --autopilot] } {
exec rm -rf [autopilot_tresor_image]
catch { exec $dd if=/dev/urandom of=[autopilot_tresor_image] bs=1M count=[tresor_image_size_mb] }
@ -285,7 +285,7 @@ build_boot_image $boot_modules
run_genode_until {.*"/bin/bash".* exited with exit value 0.*\n} 120
if { [get_cmd_switch --autopilot] } {
if { [have_cmd_switch --autopilot] } {
exec rm -rf [local_tresor_image]
exec rm -rf [autopilot_tresor_image]