From 23337eb6e77c74258e2e613a26203d2347bca41d Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Wed, 31 May 2017 16:08:08 +0200 Subject: [PATCH] run/timeout: run also on arm w/o hw and qemu On platforms were we do not have local time interpolation we can simply skip the first test stage in the timeout test. This way, we can at least test the rest. Fixes #2435 --- repos/os/run/timeout.run | 31 ++++++++++++++----------------- repos/os/src/test/timeout/main.cc | 21 ++++++++++++++------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/repos/os/run/timeout.run b/repos/os/run/timeout.run index 9cdde2ee81..38262de208 100644 --- a/repos/os/run/timeout.run +++ b/repos/os/run/timeout.run @@ -3,24 +3,18 @@ # # -# Do not run on QEMU as its time emulation is not precise enough +# Do not high precision time on ARM with kernels other than HW and on QEMU # -if {[get_cmd_switch --autopilot] && [have_include "power_on/qemu"]} { - puts "\nRunning timeout test in autopilot on Qemu is not recommended.\n" - exit 0 -} - +# On ARM, we do not have a component-local hardware time-source. The ARM +# performance counter has no reliable frequency as the ARM idle command +# halts the counter. Thus, we do not do local time interpolation on ARM. +# Except we're on the HW kernel. In this case we can read out the kernel +# time instead. On QEMU, the time emulation is not precise enough. # -# Do not run on ARM with kernels other than HW -# -# The ARM performance counter has no reliable frequency as the ARM idle command -# (often called on idle) halts the counter. Only on the HW kernel we have a syscall -# that enables us to avoid the use of the performance counter by reading the kernel -# time instead. -# -if {[expr [have_spec arm] && ![have_spec hw]]} { - puts "\n Run script is not supported on this platform.\n"; - exit 0 +proc high_precision_time { } { + if {[get_cmd_switch --autopilot] && [have_include "power_on/qemu"]} { return false } + if {[expr [have_spec arm] && ![have_spec hw]]} { return false } + return true } build "core init drivers/platform drivers/timer test/timeout test/cpufreq" @@ -31,7 +25,7 @@ build "core init drivers/platform drivers/timer test/timeout test/cpufreq" create_boot_directory -install_config { +append config { @@ -54,10 +48,13 @@ install_config { + } +install_config $config + build_boot_image "core ld.lib.so init timer test-timeout" # diff --git a/repos/os/src/test/timeout/main.cc b/repos/os/src/test/timeout/main.cc index d9c79be82c..d8ad9897ea 100644 --- a/repos/os/src/test/timeout/main.cc +++ b/repos/os/src/test/timeout/main.cc @@ -17,18 +17,20 @@ #include #include #include +#include using namespace Genode; struct Test { - Env &env; - unsigned &error_cnt; - Signal_transmitter done; - unsigned id; - Timer::Connection timer_connection { env }; - Timer::Connection timer { env }; + Env &env; + unsigned &error_cnt; + Signal_transmitter done; + unsigned id; + Timer::Connection timer_connection { env }; + Timer::Connection timer { env }; + Attached_rom_dataspace config { env, "config" }; Test(Env &env, unsigned &error_cnt, @@ -525,7 +527,12 @@ struct Fast_polling : Test main_ep(env, STACK_SIZE, "fast_polling_ep"), main_handler(main_ep, *this, &Fast_polling::main) { - Signal_transmitter(main_handler).submit(); + if (config.xml().attribute_value("high_precision_time", true)) { + Signal_transmitter(main_handler).submit(); + } else { + log("... skip test because it requires high precision time"); + Test::done.submit(); + } } };