sub_rm.run: use config rom for steering test

instead of compile time config enums.
This commit is contained in:
Alexander Boettcher 2017-08-10 21:32:21 +02:00 committed by Christian Helmuth
parent fd0b256f7c
commit 5aab244ce3
5 changed files with 14 additions and 47 deletions

View File

@ -1,22 +0,0 @@
/*
* \brief Linux-specific policy for sub_rm test
* \author Norman Feske
* \date 2011-11-22
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/*
* The Linux implementation of the RM service does not support attaching
* the same sub RM session twice. This configuration enables the respective
* error-handling test.
*/
enum { attach_twice_forbidden = true };
enum { support_attach_sub_any = false };

View File

@ -2,7 +2,7 @@ build "core init test/sub_rm"
create_boot_directory create_boot_directory
install_config { set config {
<config> <config>
<parent-provides> <parent-provides>
<service name="ROM"/> <service name="ROM"/>
@ -15,12 +15,19 @@ install_config {
<any-service> <parent/> </any-service> <any-service> <parent/> </any-service>
</default-route> </default-route>
<default caps="100"/> <default caps="100"/>
<start name="test-sub_rm"> <start name="test-sub_rm">}
append_if [have_spec linux] config {
<config attach_twice_forbidden="true" support_attach_sub_any="false"/>}
append config {
<resource name="RAM" quantum="10M"/> <resource name="RAM" quantum="10M"/>
</start> </start>
</config> </config>
} }
install_config $config
build_boot_image "core ld.lib.so init test-sub_rm" build_boot_image "core ld.lib.so init test-sub_rm"
append qemu_args "-nographic " append qemu_args "-nographic "

View File

@ -1,15 +0,0 @@
/*
* \brief Platform-specific policy for sub_rm test
* \author Norman Feske
* \date 2011-11-22
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
enum { attach_twice_forbidden = false };
enum { support_attach_sub_any = true };

View File

@ -14,13 +14,11 @@
#include <util/string.h> #include <util/string.h>
#include <base/log.h> #include <base/log.h>
#include <base/component.h> #include <base/component.h>
#include <base/attached_rom_dataspace.h>
#include <base/sleep.h> #include <base/sleep.h>
#include <rm_session/connection.h> #include <rm_session/connection.h>
#include <region_map/client.h> #include <region_map/client.h>
/* platform-specific test policy */
#include <config.h>
using namespace Genode; using namespace Genode;
@ -59,6 +57,8 @@ static void validate_pattern_at(char const *pattern, char const *ptr)
void Component::construct(Env &env) void Component::construct(Env &env)
{ {
Attached_rom_dataspace config(env, "config");
log("--- sub-rm test ---"); log("--- sub-rm test ---");
log("create RM connection"); log("create RM connection");
@ -89,7 +89,7 @@ void Component::construct(Env &env)
fill_ds_with_test_pattern(env, test_pattern(), ds, 0); fill_ds_with_test_pattern(env, test_pattern(), ds, 0);
fill_ds_with_test_pattern(env, test_pattern_2(), ds, 4096); fill_ds_with_test_pattern(env, test_pattern_2(), ds, 4096);
if (!support_attach_sub_any) { if (!config.xml().attribute_value("support_attach_sub_any", true)) {
log("attach RAM ds to any position at sub rm - this should fail"); log("attach RAM ds to any position at sub rm - this should fail");
try { try {
sub_rm.attach(ds, 0, 0, false, (addr_t)0); sub_rm.attach(ds, 0, 0, false, (addr_t)0);
@ -157,7 +157,7 @@ void Component::construct(Env &env)
catch (Region_map::Region_conflict) { catch (Region_map::Region_conflict) {
log("attaching conflicting region failed as expected"); } log("attaching conflicting region failed as expected"); }
if (attach_twice_forbidden) { if (config.xml().attribute_value("attach_twice_forbidden", false)) {
/* /*
* Try to double-attach the same sub RM session. This should fail * Try to double-attach the same sub RM session. This should fail
*/ */

View File

@ -1,6 +1,3 @@
TARGET = test-sub_rm TARGET = test-sub_rm
SRC_CC = main.cc SRC_CC = main.cc
LIBS = base LIBS = base
# find 'config.h' depending on the current platform
REP_INC_DIR += src/test/sub_rm