base: use [build_artifacts] in run scripts

The patch also removes a few legacies along the way, unifies the coding
style, and cuts back superfluous comments.

Issue #4860
This commit is contained in:
Norman Feske 2023-05-04 14:11:51 +02:00 committed by Christian Helmuth
parent fc71f1848f
commit f119d9ee8b
25 changed files with 70 additions and 348 deletions

View File

@ -1,4 +1,4 @@
build "core init test/cap_integrity"
build { core init lib/ld test/cap_integrity }
create_boot_directory
@ -20,7 +20,7 @@ install_config {
</config>
}
build_boot_image "core ld.lib.so init test-cap_integrity"
build_boot_image [build_artifacts]
append qemu_args "-nographic "

View File

@ -1,16 +1,7 @@
#
# \brief Test CPU-scheduler implementation of core
# \author Martin Stein
# \date 2014-09-30
#
build { core init lib/ld test/cpu_scheduler }
# build program images
build "core init test/cpu_scheduler"
# create directory where the boot files are written to
create_boot_directory
# the init config is not used but the build system needs it
install_config {
<config>
<parent-provides>
@ -28,15 +19,12 @@ install_config {
</start>
</config>}
# create single boot image from the compiled program images
build_boot_image "core ld.lib.so init test-cpu_scheduler"
build_boot_image [build_artifacts]
# configure qemu to use 64 MB RAM and avoid GUI mode
append qemu_args " -nographic"
# execute the test in qemu if the targeted platform is supported
run_genode_until "child .test-cpu_scheduler. exited with exit value .*\n" 10
# check the output
grep_output {child .test-cpu_scheduler. exited with exit value}
compare_output_to { [init] child "test-cpu_scheduler" exited with exit value 0 }

View File

@ -1,16 +1,7 @@
#
# \brief Test double-list implementation of core
# \author Martin Stein
# \date 2014-09-30
#
build { core init lib/ld test/double_list }
# build program images
build "core init test/double_list"
# create directory where the boot files are written to
create_boot_directory
# the init config is not used but the build system needs it
install_config {
<config>
<parent-provides>
@ -29,16 +20,12 @@ install_config {
</config>
}
# create single boot image from the compiled program images
build_boot_image "core ld.lib.so init test-double_list"
build_boot_image [build_artifacts]
# configure qemu to use 64 MB RAM and avoid GUI mode
append qemu_args " -nographic"
# execute the test in qemu if the targeted platform is supported
run_genode_until "done.*\n" 10
# check the output
grep_output {\[init -> test-double_list\]}
compare_output_to {
[init -> test-double_list] print each

View File

@ -11,7 +11,7 @@ assert_spec linux
# Build
#
build { core init server/lx_fs test/libc_vfs }
build { core init lib/ld lib/libc lib/vfs server/lx_fs test/libc_vfs }
create_boot_directory
@ -61,10 +61,7 @@ exec mkdir -p bin/libc_vfs
# Boot modules
#
build_boot_image {
core init ld.lib.so libc.lib.so vfs.lib.so lx_fs test-libc_vfs
libc_vfs
}
build_boot_image [list {*}[build_artifacts] libc_vfs]
#
# Execute test case

View File

@ -283,7 +283,7 @@ exec mkdir -p bin/lx_fs_notify/mnt
#
# Boot modules
#
build_boot_image { lx_fs test-rom_log test-file_writer lx_fs_notify }
build_boot_image [list {*}[build_artifacts] lx_fs_notify]
#
# build the test program for Linux

View File

@ -5,21 +5,10 @@
# \date 2011-11-24
#
#
# Build
#
build {
core init
test/lx_hybrid_ctors
}
build { core init lib/ld test/lx_hybrid_ctors }
create_boot_directory
#
# Generate config
#
install_config {
<config>
<parent-provides>
@ -38,28 +27,10 @@ install_config {
</config>
}
#
# Boot modules
#
# generic modules
set boot_modules {
core ld.lib.so init
test-lx_hybrid_ctors
}
build_boot_image $boot_modules
#
# Execute test case
#
build_boot_image [build_artifacts]
run_genode_until {child "test-lx_hybrid_ctors" exited with exit value 0.*\n} 10
#
# Compare output
#
grep_output {\[init -\> test-lx_hybrid_ctors\]}
compare_output_to {

View File

@ -1,21 +1,7 @@
#
# \brief Test thread-local errno works for hybrid Linux/Genode programs
# \author Norman Feske
# \date 2011-12-05
#
#
# Build
#
build { core init test/lx_hybrid_errno }
build { core init lib/ld test/lx_hybrid_errno }
create_boot_directory
#
# Generate config
#
install_config {
<config>
<parent-provides>
@ -27,24 +13,13 @@ install_config {
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="test-lx_hybrid_errno" ld="no">
<start name="test-lx_hybrid_errno" ld="no" caps="100">
<resource name="RAM" quantum="1M"/>
</start>
</config>
}
#
# Boot modules
#
# generic modules
set boot_modules { core ld.lib.so init test-lx_hybrid_errno }
build_boot_image $boot_modules
#
# Execute test case
#
build_boot_image [build_artifacts]
run_genode_until "--- finished thread-local errno test ---.*\n" 10

View File

@ -1,24 +1,7 @@
#
# \brief Test if the exception mechanism works in hybrid applications
# \author Christian Prochaska
# \date 2011-11-22
#
#
# Build
#
build {
core init
test/lx_hybrid_exception
}
build { core init lib/ld test/lx_hybrid_exception }
create_boot_directory
#
# Generate config
#
install_config {
<config>
<parent-provides>
@ -37,21 +20,7 @@ install_config {
</config>
}
#
# Boot modules
#
# generic modules
set boot_modules {
core ld.lib.so init
test-lx_hybrid_exception
}
build_boot_image $boot_modules
#
# Execute test case
#
build_boot_image [build_artifacts]
run_genode_until {child "test-lx_hybrid_exception" exited with exit value 0.*\n} 10

View File

@ -1,21 +1,7 @@
#
# \brief Test IPC from pthread created outside of Genode
# \author Norman Feske
# \date 2011-12-20
#
#
# Build
#
build { core init test/lx_hybrid_pthread_ipc }
build { core init lib/ld test/lx_hybrid_pthread_ipc }
create_boot_directory
#
# Generate config
#
install_config {
<config>
<parent-provides>
@ -34,17 +20,6 @@ install_config {
</config>
}
#
# Boot modules
#
# generic modules
set boot_modules { core ld.lib.so init test-lx_hybrid_pthread_ipc }
build_boot_image $boot_modules
#
# Execute test case
#
build_boot_image [build_artifacts]
run_genode_until "--- finished pthread IPC test ---.*\n" 10

View File

@ -6,24 +6,11 @@
assert_spec linux
#
# Build
#
set build_components { core init }
lappend_if [expr {$test_type eq "static"}] build_components test/lx_rmap/static
lappend_if [expr {$test_type eq "dynamic"}] build_components test/lx_rmap/dynamic
build $build_components
build [list core init lib/ld [test_build_target]]
create_boot_directory
#
# Config
#
set config {
install_config {
<config>
<parent-provides>
<service name="ROM"/>
@ -34,40 +21,17 @@ set config {
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>}
append_if [expr {$test_type eq "static"}] config {
<start name="test-lx_rmap_static">}
append_if [expr {$test_type eq "dynamic"}] config {
<start name="test-lx_rmap_dynamic">}
append config {
<default caps="100"/>
<start name="} [test_program_name] {">
<resource name="RAM" quantum="8M"/>
</start>
</config>}
install_config $config
#
# Boot modules
#
build_boot_image [build_artifacts]
set boot_modules { core ld.lib.so init }
run_genode_until "child \"[test_program_name]\" exited with exit value 0.*\n" 10
lappend_if [expr {$test_type eq "static"}] boot_modules test-lx_rmap_static
lappend_if [expr {$test_type eq "dynamic"}] boot_modules test-lx_rmap_dynamic
lappend_if [expr {$test_type eq "dynamic"}] boot_modules ld.lib.so
build_boot_image $boot_modules
#
# Execute test
#
if {$test_type eq "static"} {
run_genode_until {child "test-lx_rmap_static" exited with exit value 0.*\n} 10
} else {
run_genode_until {child "test-lx_rmap_dynamic" exited with exit value 0.*\n} 10
}
puts "Test succeeded"
# vi: set ft=tcl :

View File

@ -1,10 +1,5 @@
#
# \brief Test for Linux-specific region map (dynamic binary)
# \author Christian Helmuth
# \date 2013-09-06
#
set test_type "dynamic"
proc test_build_target { } { return "test/lx_rmap/static" }
proc test_program_name { } { return "test-lx_rmap_static" }
source ${genode_dir}/repos/base-linux/run/lx_rmap.inc

View File

@ -1,10 +1,5 @@
#
# \brief Test for Linux-specific region map (static binary)
# \author Christian Helmuth
# \date 2013-09-06
#
set test_type "static"
proc test_build_target { } { return "test/lx_rmap/dynamic" }
proc test_program_name { } { return "test-lx_rmap_dynamic" }
source ${genode_dir}/repos/base-linux/run/lx_rmap.inc

View File

@ -1,98 +0,0 @@
#
# \brief Test for assigning custom UIDs and GIDs to Genode processes
# \author Norman Feske
# \date 2012-11-21
#
build "core init test/printf"
assert_spec linux
create_boot_directory
install_config {
<config>
<parent-provides>
<service name="LOG"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="ROM"/>
</parent-provides>
<default-route>
<any-service><parent/></any-service>
</default-route>
<start name="init_55_66" uid="55" gid="66">
<binary name="init" />
<resource name="RAM" quantum="1M"/>
<config/>
</start>
<!-- we expect the GID of init_77 to equal the UID -->
<start name="init_77" uid="77">
<binary name="init" />
<resource name="RAM" quantum="1M"/>
<config>
<parent-provides>
<service name="LOG"/>
<service name="ROM"/>
</parent-provides>
<default-route>
<any-service><parent/></any-service>
</default-route>
<!-- we expect the GID and UID of init_sub_77 to inherit
its UID and GIDs from its parent policy. -->
<start name="init_sub_77">
<binary name="init" />
<resource name="RAM" quantum="1M"/>
<config/>
</start>
</config>
</start>
</config>
}
#
# Copy boot modules into run directory
#
# We cannot use the predefined 'build_boot_image' function here because
# this would create mere symlinks. However, we need to enable the setuid
# and setgid capabilities for core, which won't work if core were a symlink.
#
foreach binary { core ld.lib.so init } {
exec cp -H bin/$binary [run_dir] }
#
# Allow core to set arbitrary UIDs and GIDs
#
exec sudo setcap cap_setuid,cap_setgid=ep [run_dir]/core
#
# Execute Genode until the point where init_sub_77 is up
#
run_genode_until {\[init -> init_77 -> init_sub_77\].*No children to start.*\n} 10
#
# Obtain the list of Genode user processes starting with the name 'init'
#
set ps_output [exec ps -eo uid,gid,cmd | grep Genode | grep init]
puts "Genode user processes:\n$ps_output"
#
# Validate output of ps
#
# We are only interested in the lines for the init instances with the
# customized UIDs and GIDs.
#
if {![regexp {55\s*66 \[Genode\] init_55_66} $ps_output]
|| ![regexp {77\s*77 \[Genode\] init_77} $ps_output]
|| ![regexp {77\s*77 \[Genode\] init_77 -> init_sub_77} $ps_output]} {
puts stderr "Unexpected output of ps"
exit 1
}
puts "Test succeeded"

View File

@ -1,4 +1,4 @@
build "core init test/region_map_mmap timer test/signal"
build { core init lib/ld test/region_map_mmap timer test/signal }
create_boot_directory
@ -6,9 +6,6 @@ install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
@ -27,12 +24,17 @@ install_config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="test-signal">
<start name="test-signal" caps="400">
<resource name="RAM" quantum="1M"/>
</start>
</config>}
build_boot_image "core ld.lib.so init test-region_map_mmap timer test-signal"
build_boot_image [build_artifacts]
run_genode_until forever
run_genode_until {--- Signalling test finished ---.*\n} 30
grep_output {\[init -\> test-region_map_mmap\] Done.}
compare_output_to {
[init -> test-region_map_mmap] Done.
}

View File

@ -1,4 +1,4 @@
build "core init test/platform"
build { core init lib/ld test/platform }
set check_pat 1
if {[have_include power_on/qemu]} {
@ -37,7 +37,7 @@ append config {
install_config $config
build_boot_image "core ld.lib.so init test-platform"
build_boot_image [build_artifacts]
append qemu_args "-nographic -smp 2"

View File

@ -1,12 +1,12 @@
assert_spec okl4
build "core init"
build { core init lib/ld }
create_boot_directory
install_config "[exec cat [genode_dir]/repos/os/src/init/config.priority]"
build_boot_image "core ld.lib.so init"
build_boot_image [build_artifacts]
append qemu_args "-nographic "

View File

@ -1,4 +1,4 @@
build "core init test/log"
build { core init lib/ld test/log }
create_boot_directory
@ -20,7 +20,7 @@ install_config {
</config>
}
build_boot_image "core ld.lib.so init test-log"
build_boot_image [build_artifacts]
append qemu_args "-nographic "
append xen_args { sdl="0" }

View File

@ -1,4 +1,4 @@
build "core init test/migrate timer"
build { core init lib/ld test/migrate timer }
if {![have_include "power_on/qemu"]} {
puts "Run script is not supported on this platform"
@ -45,7 +45,7 @@ append config {
install_config $config
build_boot_image "core ld.lib.so init test-migrate timer"
build_boot_image [build_artifacts]
append qemu_args "-nographic "
append qemu_args "-smp 4,cores=4,threads=1"

View File

@ -10,7 +10,7 @@ if { [get_cmd_switch --autopilot] && [have_include "power_on/qemu"] } {
exit 0
}
build "core init test/smp"
build { core init lib/ld test/smp }
create_boot_directory
@ -32,7 +32,7 @@ install_config {
</config>
}
build_boot_image "core ld.lib.so init test-smp"
build_boot_image [build_artifacts]
if {[have_include "power_on/qemu"]} {
# in general we want to have at least 2 CPUs

View File

@ -1,4 +1,4 @@
build "core init test/sub_rm"
build { core init lib/ld test/sub_rm }
create_boot_directory
@ -30,7 +30,7 @@ append config {
install_config $config
build_boot_image "core ld.lib.so init test-sub_rm"
build_boot_image [build_artifacts]
append qemu_args "-nographic "

View File

@ -1,4 +1,4 @@
build "core init test/thread"
build { core init lib/ld test/thread }
create_boot_directory
@ -45,7 +45,7 @@ append config {
install_config $config
build_boot_image "core ld.lib.so init test-thread"
build_boot_image [build_artifacts]
append qemu_args "-nographic "

View File

@ -1,4 +1,4 @@
build { core init timer test/timeout_smp }
build { core init timer lib/ld test/timeout_smp }
create_boot_directory
@ -30,11 +30,14 @@ install_config {
</start>
</config>
}
build_boot_image { core ld.lib.so init timer test-timeout_smp }
build_boot_image [build_artifacts]
append qemu_args " -nographic"
run_genode_until "child \"test\" exited with exit value.*\n" 60
grep_output {\[init\] child "test" exited with exit value}
compare_output_to {[init] child "test" exited with exit value 0}

View File

@ -1,10 +1,7 @@
# build program images
build { core init timer test/timer_accuracy }
build { core init timer lib/ld test/timer_accuracy }
# create directory where boot files are written to
create_boot_directory
# define XML configuration for init
install_config {
<config prio_levels="2">
<parent-provides>
@ -31,10 +28,9 @@ install_config {
</start>
</config>
}
# build boot files from source binaries
build_boot_image { core ld.lib.so init timer test-timer_accuracy }
# configure Qemu
build_boot_image [build_artifacts]
append qemu_args " -nographic"
set err_cnt 0

View File

@ -1,4 +1,4 @@
build { core init timer test/timer_rate }
build { core init timer lib/ld test/timer_rate }
create_boot_directory
@ -33,11 +33,14 @@ install_config {
</start>
</config>
}
build_boot_image { core ld.lib.so init timer test-timer_rate }
build_boot_image [build_artifacts]
append qemu_args " -nographic"
run_genode_until "child \"test\" exited with exit value.*\n" 120
grep_output {\[init\] child "test" exited with exit value}
compare_output_to {[init] child "test" exited with exit value 0}

View File

@ -1,7 +1,7 @@
SRC_C = main.cc
C_WARNINGS = -Wall -Werror
BUILD_DIR = /tmp/bin
SHELL = bash
all:
mkdir -p $(BUILD_DIR)