genode/repos/dde_linux/run/nic_router_uplinks.run
Martin Stein a450110b97 run/nic_router_uplinks: use test component
So far, this test used dynamic_rom for the re-configuration of the nic router
and tested for the expected ping results by inspecting the log with the run
tool. However, this approach had two issues:

* Timing differs significantly on different targets and so the dynamic_rom had
  the difficult task of compensating with heuristics without bloating the test
  duration too much.

* In case of a failing test, it was difficult to determine the cause as the
  test kept running and produced output for quite some time and there was also
  no specific error message but only a generic timeout.

These two issues are now fixed by introducing a test component that listens to
the ping-result report and manages the nic router configuration. The new
component exits early on failure and provides information on the error
circumstances. Furthermore, the component advances to the next test step only
after having seen the expected result of the active test step and thereby
removes the need for heuristics about target timing.

Fixes #5192
2024-06-20 12:56:19 +02:00

191 lines
5.9 KiB
Plaintext

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 }
proc wifi_ssid {} {
return "$::env(GENODE_WIFI_SSID2)" }
proc wifi_psk {} {
return "$::env(GENODE_WIFI_PSK2)" }
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/pc_wifi \
[depot_user]/src/acpi \
[depot_user]/src/dynamic_rom \
[depot_user]/src/init \
[depot_user]/src/pc_nic \
[depot_user]/src/nic_router \
[depot_user]/src/pci_decode \
[depot_user]/src/platform \
[depot_user]/src/report_rom \
[depot_user]/src/pc_rtc
build { app/ping server/nic_router test/nic_router_uplinks }
install_config {
<config prio_levels="4">
<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"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>
<start name="report_rom" caps="200">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="ROM" />
<service name="Report" />
</provides>
<config>
<policy label="pci_decode -> system" report="acpi -> acpi"/>
<policy label="platform -> devices" report="pci_decode -> devices"/>
<policy label="router -> config" report="test -> router_config"/>
<policy label="test -> ping_result" report="ping -> result"/>
</config>
</start>
<start name="acpi" caps="250">
<resource name="RAM" quantum="4M"/>
</start>
<start name="pci_decode" caps="350">
<resource name="RAM" quantum="2M"/>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="system"> <child name="report_rom"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="platform" caps="100" managing_system="yes">
<resource name="RAM" quantum="2M"/>
<provides> <service name="Platform"/> </provides>
<route>
<service name="ROM" label="devices"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
<config>
<policy label_prefix="wifi" info="yes"> <pci class="WIFI"/> </policy>
<policy label_prefix="nic" info="yes"> <pci class="ETHERNET"/> </policy>
</config>
</start>
<start name="timer" priority="0">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="pc_rtc" priority="-1">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Rtc"/>
</provides>
</start>
<start name="nic" priority="-1" caps="250">
<binary name="pc_nic"/>
<resource name="RAM" quantum="8M"/>
<route>
<service name="Uplink"> <child name="router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="wifi" caps="600" priority="-1">
<resource name="RAM" quantum="32M"/>
<config ld_verbose="no">
<vfs>
<dir name="dev"> <log/> <rtc/> <null/>
<jitterentropy name="random"/>
<jitterentropy name="urandom"/>
</dir>
<dir name="config"> <ram/> </dir>
<dir name="firmware">
<tar name="wifi_firmware.tar"/>
</dir>
</vfs>
<libc stdout="/dev/null" stderr="/dev/null" rtc="/dev/rtc"/>
</config>
<route>
<service name="Uplink"> <child name="router"/> </service>
<service name="Rtc"> <any-child/> </service>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="wifi_config"> <child name="config_rom"/> </service>
<service name="ROM" label="wifi.lib.so"> <parent label="pc_wifi.lib.so"/> </service>
<service name="ROM" label="wifi_firmware.tar"> <parent label="pc_wifi_firmware.tar"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="config_rom" priority="-2">
<binary name="dynamic_rom"/>
<resource name="RAM" quantum="4M"/>
<provides><service name="ROM"/></provides>
<config>
<rom name="wifi_config">
<inline description="CONNECT">
<wifi_config connected_scan_interval="0" scan_interval="5" rfkill="no" verbose="no" verbose_state="no">
<network ssid="} [wifi_ssid] {" protection="WPA2" passphrase="} [wifi_psk] {"/>
</wifi_config>
</inline>
<sleep milliseconds="600000"/> <!-- 10 minutes -->
</rom>
</config>
</start>
<start name="router" caps="200" priority="-2">
<binary name="nic_router"/>
<resource name="RAM" quantum="10M"/>
<provides>
<service name="Nic"/>
<service name="Uplink"/>
</provides>
<route>
<service name="ROM" label="config"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="test" caps="200" priority="-2">
<binary name="test-nic_router_uplinks"/>
<resource name="RAM" quantum="1M"/>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<service name="ROM" label="ping_result"> <child name="report_rom"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ping" priority="-2">
<resource name="RAM" quantum="8M"/>
<config dst_ip="1.1.1.1"
period_sec="1"
report="yes"
count="999"/>
<route>
<service name="Report"> <child name="report_rom"/> </service>
<service name="Nic"> <child name="router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
append qemu_args " -nographic "
build_boot_image [build_artifacts]
run_genode_until "child \"test\" exited with exit value.*\n" 300
grep_output {\[init\] child "test" exited with exit value}
compare_output_to {[init] child "test" exited with exit value 0}