Disable lock tests on platforms without priorities

The implementations of the lock and C++ guards tests depend on
thread-execution priorities, which produces false negatives of the whole
thread test on platforms without priority support.
This commit is contained in:
Christian Helmuth 2017-06-16 16:27:56 +02:00 committed by Norman Feske
parent 5fec4a2166
commit 019528ee6a
2 changed files with 30 additions and 15 deletions

View File

@ -7,13 +7,25 @@ create_boot_directory
# supported.
#
proc pause_resume_supported { } {
if {[have_spec pistachio]} { return 0 }
if {[have_spec linux]} { return 0 }
if {[have_spec fiasco]} { return 0 }
return 1;
if {[have_spec pistachio]} { return false }
if {[have_spec linux]} { return false }
if {[have_spec fiasco]} { return false }
return true
}
set config {
#
# We skip the lock and C++ guard tests on kernels without priority support (as
# it is needed for the test implementation).
#
proc prio_supported { } {
if {[have_spec hw]} { return false }
if {[have_spec sel4]} { return false }
if {[have_spec linux]} { return false }
if {[have_spec fiasco]} { return false }
return true
}
append config {
<config prio_levels="2">
<parent-provides>
<service name="LOG"/>
@ -27,12 +39,7 @@ set config {
<start name="test-thread" caps="2000">
<resource name="RAM" quantum="10M"/>
<resource name="CPU" quantum="100"/>
<config>}
append_if [pause_resume_supported] config { <pause_resume/> }
append config {
</config>
<config pause_resume="} [pause_resume_supported] {" prio="} [prio_supported] {"/>
</start>
</config>
}

View File

@ -21,6 +21,7 @@
#include <util/reconstructible.h>
#include <cpu_session/connection.h>
#include <cpu_thread/client.h>
#include <cpu/memory_barrier.h>
using namespace Genode;
@ -407,6 +408,12 @@ static void test_locks(Genode::Env &env)
Lock_helper l5(env, "lock_low5", cpu_l, lock, lock_is_free, SYNC_STARTUP);
l5.start();
log(" spin for some time");
for (unsigned volatile i = 0; i < 8000000; ++i) memory_barrier();
log(" still spinning");
for (unsigned volatile i = 0; i < 8000000; ++i) memory_barrier();
log(" spinning done");
lock.lock();
log(" I'm the lock holder - still alive");
lock_is_free = true;
@ -648,10 +655,11 @@ void Component::construct(Env &env)
test_stack_alignment(env);
test_main_thread();
test_cpu_session(env);
test_locks(env);
test_cxa_guards(env);
if (config.xml().has_sub_node("pause_resume"))
if (config.xml().attribute_value("prio", false)) {
test_locks(env);
test_cxa_guards(env);
}
if (config.xml().attribute_value("pause_resume", false))
test_pause_resume(env);
test_create_as_many_threads(env);