mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-01 00:45:29 +00:00
parent
ff378a8c5b
commit
c783764d0b
1
repos/base/recipes/pkg/test-rm_stress/README
Normal file
1
repos/base/recipes/pkg/test-rm_stress/README
Normal file
@ -0,0 +1 @@
|
||||
Scenario that stresses region-map attachments
|
2
repos/base/recipes/pkg/test-rm_stress/archives
Normal file
2
repos/base/recipes/pkg/test-rm_stress/archives
Normal file
@ -0,0 +1,2 @@
|
||||
_/src/init
|
||||
_/src/test-rm_stress
|
1
repos/base/recipes/pkg/test-rm_stress/hash
Normal file
1
repos/base/recipes/pkg/test-rm_stress/hash
Normal file
@ -0,0 +1 @@
|
||||
2020-04-02 d6b3e6026d373f74858d7a1b4759aeb431e43afc
|
29
repos/base/recipes/pkg/test-rm_stress/runtime
Normal file
29
repos/base/recipes/pkg/test-rm_stress/runtime
Normal file
@ -0,0 +1,29 @@
|
||||
<runtime ram="32M" caps="1000" binary="init">
|
||||
|
||||
<events>
|
||||
<timeout meaning="failed" sec="45"/>
|
||||
<log meaning="succeeded">child "test-rm_stress" exited with exit value 0</log>
|
||||
<log meaning="failed">child "test-rm_stress" exited with exit value -1</log>
|
||||
</events>
|
||||
|
||||
<content>
|
||||
<rom label="ld.lib.so"/>
|
||||
<rom label="test-rm_stress"/>
|
||||
</content>
|
||||
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="RM"/>
|
||||
<service name="PD"/>
|
||||
<service name="LOG"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> </any-service>
|
||||
</default-route>
|
||||
<start name="test-rm_stress" caps="110">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
</start>
|
||||
</config>
|
||||
</runtime>
|
2
repos/base/recipes/src/test-rm_stress/content.mk
Normal file
2
repos/base/recipes/src/test-rm_stress/content.mk
Normal file
@ -0,0 +1,2 @@
|
||||
SRC_DIR = src/test/rm_stress
|
||||
include $(GENODE_DIR)/repos/base/recipes/src/content.inc
|
1
repos/base/recipes/src/test-rm_stress/hash
Normal file
1
repos/base/recipes/src/test-rm_stress/hash
Normal file
@ -0,0 +1 @@
|
||||
2020-04-02 39f4647992e33fba4b5aea0d490285e4cee797b1
|
1
repos/base/recipes/src/test-rm_stress/used_apis
Normal file
1
repos/base/recipes/src/test-rm_stress/used_apis
Normal file
@ -0,0 +1 @@
|
||||
base
|
70
repos/base/src/test/rm_stress/main.cc
Normal file
70
repos/base/src/test/rm_stress/main.cc
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* \brief Test program for stressing region-map attachments
|
||||
* \author Christian Helmuth
|
||||
* \date 2020-04-03
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/component.h>
|
||||
#include <base/log.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
struct X : Genode::Hex
|
||||
{
|
||||
template <typename T>
|
||||
explicit X(T value) : Genode::Hex(value, OMIT_PREFIX, PAD) { }
|
||||
};
|
||||
|
||||
|
||||
struct Page : Attached_ram_dataspace
|
||||
{
|
||||
unsigned char const color;
|
||||
|
||||
Page(Env &env, unsigned char color)
|
||||
:
|
||||
Attached_ram_dataspace(env.ram(), env.rm(), 0x1000),
|
||||
color(color)
|
||||
{
|
||||
memset(local_addr<void>(), color, size());
|
||||
|
||||
log("new page @ ", local_addr<void>(), " with color ", X(*local_addr<unsigned char>()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Env &env)
|
||||
{
|
||||
log("--- region-map attachment stress test ---");
|
||||
|
||||
Page page[] = { { env, 0xaa }, { env, 0x55 } };
|
||||
|
||||
enum { ROUNDS = 10000 };
|
||||
|
||||
for (unsigned r = 0; r < ROUNDS; ++r) {
|
||||
for (unsigned i = 0; i < sizeof(page)/sizeof(*page); ++i) {
|
||||
off_t const offset = 0;
|
||||
|
||||
unsigned char volatile const *v =
|
||||
env.rm().attach(page[i].cap(), page[i].size(), offset);
|
||||
|
||||
if (page[i].color != *v) {
|
||||
error("value @ ", v, " ", X(*v), " != ", X(page[i].color), " in round ", r);
|
||||
env.parent().exit(-1);
|
||||
}
|
||||
|
||||
env.rm().detach(Region_map::Local_addr(v));
|
||||
}
|
||||
}
|
||||
|
||||
env.parent().exit(0);
|
||||
}
|
3
repos/base/src/test/rm_stress/target.mk
Normal file
3
repos/base/src/test/rm_stress/target.mk
Normal file
@ -0,0 +1,3 @@
|
||||
TARGET = test-rm_stress
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
@ -707,6 +707,7 @@ set default_test_pkgs {
|
||||
test-rm_fault
|
||||
test-rm_fault_no_nox
|
||||
test-rm_nested
|
||||
test-rm_stress
|
||||
test-rom_block
|
||||
test-rom_filter
|
||||
test-rust
|
||||
|
Loading…
x
Reference in New Issue
Block a user