From 5aab244ce3da0c3c670c16f116a3582097784c93 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 10 Aug 2017 21:32:21 +0200 Subject: [PATCH] sub_rm.run: use config rom for steering test instead of compile time config enums. --- repos/base-linux/src/test/sub_rm/config.h | 22 ---------------------- repos/base/run/sub_rm.run | 11 +++++++++-- repos/base/src/test/sub_rm/config.h | 15 --------------- repos/base/src/test/sub_rm/main.cc | 10 +++++----- repos/base/src/test/sub_rm/target.mk | 3 --- 5 files changed, 14 insertions(+), 47 deletions(-) delete mode 100644 repos/base-linux/src/test/sub_rm/config.h delete mode 100644 repos/base/src/test/sub_rm/config.h diff --git a/repos/base-linux/src/test/sub_rm/config.h b/repos/base-linux/src/test/sub_rm/config.h deleted file mode 100644 index e52a673f34..0000000000 --- a/repos/base-linux/src/test/sub_rm/config.h +++ /dev/null @@ -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 }; - diff --git a/repos/base/run/sub_rm.run b/repos/base/run/sub_rm.run index e52a9190e2..c7573a446b 100644 --- a/repos/base/run/sub_rm.run +++ b/repos/base/run/sub_rm.run @@ -2,7 +2,7 @@ build "core init test/sub_rm" create_boot_directory -install_config { +set config { @@ -15,12 +15,19 @@ install_config { - + } + +append_if [have_spec linux] config { + } + +append config { } +install_config $config + build_boot_image "core ld.lib.so init test-sub_rm" append qemu_args "-nographic " diff --git a/repos/base/src/test/sub_rm/config.h b/repos/base/src/test/sub_rm/config.h deleted file mode 100644 index 69e1bb91d8..0000000000 --- a/repos/base/src/test/sub_rm/config.h +++ /dev/null @@ -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 }; diff --git a/repos/base/src/test/sub_rm/main.cc b/repos/base/src/test/sub_rm/main.cc index 7fe5eb7ec9..d8553b3161 100644 --- a/repos/base/src/test/sub_rm/main.cc +++ b/repos/base/src/test/sub_rm/main.cc @@ -14,13 +14,11 @@ #include #include #include +#include #include #include #include -/* platform-specific test policy */ -#include - using namespace Genode; @@ -59,6 +57,8 @@ static void validate_pattern_at(char const *pattern, char const *ptr) void Component::construct(Env &env) { + Attached_rom_dataspace config(env, "config"); + log("--- sub-rm test ---"); 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_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"); try { sub_rm.attach(ds, 0, 0, false, (addr_t)0); @@ -157,7 +157,7 @@ void Component::construct(Env &env) catch (Region_map::Region_conflict) { 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 */ diff --git a/repos/base/src/test/sub_rm/target.mk b/repos/base/src/test/sub_rm/target.mk index 977c857a49..f54a37dd2f 100644 --- a/repos/base/src/test/sub_rm/target.mk +++ b/repos/base/src/test/sub_rm/target.mk @@ -1,6 +1,3 @@ TARGET = test-sub_rm SRC_CC = main.cc LIBS = base - -# find 'config.h' depending on the current platform -REP_INC_DIR += src/test/sub_rm