diff --git a/repos/base/src/test/thread/main.cc b/repos/base/src/test/thread/main.cc index c2db3efac0..9840cce7be 100644 --- a/repos/base/src/test/thread/main.cc +++ b/repos/base/src/test/thread/main.cc @@ -657,6 +657,43 @@ static void test_cxa_guards(Env &env) log("running '", __func__, "' done"); } + +/********************************************* + ** Successive construction and destruction ** + *********************************************/ + +struct Create_destroy_helper : Thread +{ + enum { STACK_SIZE = 0x2000 }; + + unsigned const result_value; + unsigned volatile result { ~0U }; + + Create_destroy_helper(Env &env, unsigned result_value) + : Thread(env, "create_destroy", STACK_SIZE), + result_value(result_value) + { } + + void entry() + { + result = result_value; + } +}; + +static void test_successive_create_destroy_threads(Env &env) +{ + log("running '", __func__, "'"); + + for (unsigned i = 0; i < 500; i++) { + Create_destroy_helper thread(env, i); + thread.start(); + thread.join(); + if (thread.result != i) + throw -30; + } +} + + void Component::construct(Env &env) { log("--- thread test started ---"); @@ -676,6 +713,7 @@ void Component::construct(Env &env) test_pause_resume(env); test_create_as_many_threads(env); + test_successive_create_destroy_threads(env); } catch (int error) { Genode::error("error ", error); throw; diff --git a/repos/os/run/thread_join.run b/repos/os/run/thread_join.run deleted file mode 100644 index a1dfa82891..0000000000 --- a/repos/os/run/thread_join.run +++ /dev/null @@ -1,35 +0,0 @@ -build "core init drivers/timer test/thread_join" - -create_boot_directory - -install_config { - - - - - - - - - - - - - - - - - - - - - - - -} - -build_boot_image "core ld.lib.so init timer test-thread_join" - -append qemu_args "-nographic " - -run_genode_until {.*--- Thread join test finished ---.*\n} 20 diff --git a/repos/os/src/test/thread_join/main.cc b/repos/os/src/test/thread_join/main.cc deleted file mode 100644 index 2f6a7703a6..0000000000 --- a/repos/os/src/test/thread_join/main.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - * \brief Test for the 'Thread::join()' function - * \author Norman Feske - * \date 2012-11-16 - */ - -/* - * Copyright (C) 2012-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 -#include -#include - -using namespace Genode; - - -struct Worker : Thread -{ - Timer::Session &timer; - unsigned const result_value; - unsigned volatile result; - - void entry() - { - log("Worker thread is up"); - timer.msleep(250); - - log("Worker is leaving the entry function with result=", result_value); - result = result_value; - } - - Worker(Env &env, Timer::Session &timer, unsigned result_value) - : Thread(env, "worker", 1024 * sizeof(addr_t)), timer(timer), - result_value(result_value), result(~0) - { - Thread::start(); - } -}; - - -struct Main -{ - struct Worker_unfinished_after_join : Exception { }; - - Timer::Connection timer; - - Main(Env &env) : timer(env) - { - log("--- Thread join test ---"); - for (unsigned i = 0; i < 10; i++) { - - /* - * A worker thread is created in each iteration. Just before - * leaving the entry function, the worker assigns the result - * to 'Worker::result' variable. By validating this value, - * we determine whether the worker has finished or not. - */ - Worker worker(env, timer, i); - worker.join(); - if (worker.result != i) { - throw Worker_unfinished_after_join(); } - } - log("--- Thread join test finished ---"); - } -}; - - -void Component::construct(Genode::Env &env) { static Main main(env); } diff --git a/repos/os/src/test/thread_join/target.mk b/repos/os/src/test/thread_join/target.mk deleted file mode 100644 index ab9dd5a0f7..0000000000 --- a/repos/os/src/test/thread_join/target.mk +++ /dev/null @@ -1,3 +0,0 @@ -TARGET = test-thread_join -SRC_CC = main.cc -LIBS = base diff --git a/tool/autopilot.list b/tool/autopilot.list index 43080f2a8f..bf1e0dc2d9 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -88,7 +88,6 @@ sub_rm synced_interface tar_rom thread -thread_join timed_semaphore timeout timer