mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
parent
ff5175ec76
commit
604f4c666b
@ -719,7 +719,6 @@ set default_test_pkgs {
|
||||
test-tcp_bulk_lwip
|
||||
test-tcp_bulk_lxip
|
||||
test-terminal_crosslink
|
||||
test-timed_semaphore
|
||||
test-timer
|
||||
test-tls
|
||||
test-trace
|
||||
|
@ -1 +0,0 @@
|
||||
Test for the timed-semaphore.
|
@ -1,2 +0,0 @@
|
||||
_/src/init
|
||||
_/src/test-timed_semaphore
|
@ -1 +0,0 @@
|
||||
2020-02-03 7b7b3c7a824463cdabab57847e283e22b0783f53
|
@ -1,36 +0,0 @@
|
||||
<runtime ram="32M" caps="1000" binary="init">
|
||||
|
||||
<requires> <timer/> </requires>
|
||||
|
||||
<events>
|
||||
<timeout meaning="failed" sec="20" />
|
||||
<log meaning="succeeded">--- Timed semaphore test finished ---</log>
|
||||
<log meaning="failed" >Error: </log>
|
||||
</events>
|
||||
|
||||
<content>
|
||||
<rom label="ld.lib.so"/>
|
||||
<rom label="test-timed_semaphore"/>
|
||||
</content>
|
||||
|
||||
<config>
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="Timer"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<default caps="100"/>
|
||||
<start name="test-timed_semaphore">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
</start>
|
||||
</config>
|
||||
</runtime>
|
@ -1,9 +0,0 @@
|
||||
SRC_DIR = src/test/timed_semaphore
|
||||
include $(GENODE_DIR)/repos/base/recipes/src/content.inc
|
||||
|
||||
MIRROR_FROM_REP_DIR := src/lib/libc/internal/timed_semaphore.h
|
||||
|
||||
content: $(MIRROR_FROM_REP_DIR)
|
||||
|
||||
$(MIRROR_FROM_REP_DIR):
|
||||
$(mirror_from_rep_dir)
|
@ -1 +0,0 @@
|
||||
2020-02-03 594e3c8a2cf17fdd598b0fbddb77720d58e3f0c5
|
@ -1,3 +0,0 @@
|
||||
base
|
||||
os
|
||||
timer_session
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* \brief Test for the libc-internal timed semaphore
|
||||
* \author Stefan Kalkowski
|
||||
* \author Martin Stein
|
||||
* \date 2010-03-05
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-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.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <timer_session/connection.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/component.h>
|
||||
|
||||
/* libc-internal include */
|
||||
#include <timed_semaphore.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Libc;
|
||||
|
||||
|
||||
struct Test : Thread
|
||||
{
|
||||
struct Failed : Exception { };
|
||||
|
||||
Timeout_entrypoint timeout_ep;
|
||||
unsigned id;
|
||||
Timer::Connection wakeup_timer;
|
||||
uint64_t const wakeup_period;
|
||||
Timed_semaphore sem { timeout_ep };
|
||||
bool stop_wakeup { false };
|
||||
Lock wakeup_stopped { Lock::LOCKED };
|
||||
bool got_timeouts { false };
|
||||
|
||||
void entry() override
|
||||
{
|
||||
do {
|
||||
wakeup_timer.msleep(wakeup_period);
|
||||
sem.up();
|
||||
} while (!stop_wakeup);
|
||||
wakeup_stopped.unlock();
|
||||
}
|
||||
|
||||
Test(Env &env, bool timeouts, unsigned id, char const *brief)
|
||||
:
|
||||
Thread(env, "wakeup", 1024 * sizeof(addr_t)),
|
||||
timeout_ep(env), id(id), wakeup_timer(env),
|
||||
wakeup_period(timeouts ? 1000 : 100)
|
||||
{
|
||||
log("\nTEST ", id, ": ", brief, "\n");
|
||||
Thread::start();
|
||||
try { for (int i = 0; i < 10; i++) { sem.down(timeouts ? 100 : 1000); } }
|
||||
catch (Timeout_exception) { got_timeouts = true; }
|
||||
if (timeouts != got_timeouts) {
|
||||
throw Failed(); }
|
||||
|
||||
stop_wakeup = true;
|
||||
wakeup_stopped.lock();
|
||||
}
|
||||
|
||||
~Test() { log("\nTEST ", id, " finished\n"); }
|
||||
};
|
||||
|
||||
|
||||
struct Main
|
||||
{
|
||||
Constructible<Test> test { };
|
||||
|
||||
Main(Env &env)
|
||||
{
|
||||
log("--- Timed semaphore test ---");
|
||||
test.construct(env, false, 1, "without timeouts"); test.destruct();
|
||||
test.construct(env, true, 2, "with timeouts"); test.destruct();
|
||||
log("--- Timed semaphore test finished ---");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void Component::construct(Genode::Env &env) { static Main main(env); }
|
@ -1,4 +0,0 @@
|
||||
TARGET = test-timed_semaphore
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
||||
INC_DIR += $(REP_DIR)/src/lib/libc/internal
|
Loading…
x
Reference in New Issue
Block a user