test/lx_hybrid: don't call glibc exit

This patch removes the use of the Entrypoint::schedule_suspend mechanism
and the call of glibc's exit from the lx_hybrid tests, for two reasons.

First, the interplay of atexit handlers executed by the glibc and
Genode's lx_hybrid library is complicated while bringing no benefits in
practice as lx_hybrid applications are usually servers that don't exit
anyway.

Second, the Entrypoint::schedule_suspend mechanism in not used by any
other component. By removing its use from the lx_hybrid tests, we can
remove this mechanism from the base library.

Issue #4940
This commit is contained in:
Norman Feske 2023-06-28 15:46:04 +02:00
parent e2836bf68a
commit 1fd1786122
4 changed files with 5 additions and 32 deletions

View File

@ -44,10 +44,6 @@ extern Testlib_testclass testlib_testobject;
Testapp_testclass testapp_testobject;
static int exit_status;
static void exit_on_suspended() { exit(exit_status); }
/*
* Component implements classical main function in construct.
*/
@ -63,6 +59,5 @@ void Component::construct(Genode::Env &env)
testapp_testobject.dummy();
log("--- returning from main ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
env.parent().exit(0);
}

View File

@ -42,15 +42,9 @@ struct Thread : Genode::Thread
};
static int exit_status;
static void exit_on_suspended() { exit(exit_status); }
struct Unexpected_errno_change { };
/*
* Component implements classical main function in construct.
*/
void Component::construct(Genode::Env &env)
{
Genode::log("--- thread-local errno test ---");
@ -75,6 +69,5 @@ void Component::construct(Genode::Env &env)
}
Genode::log("--- finished thread-local errno test ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
env.parent().exit(0);
}

View File

@ -23,13 +23,7 @@ using namespace Genode;
class Test_exception { };
static int exit_status;
static void exit_on_suspended() { exit(exit_status); }
/*
* Component implements classical main function in construct.
*/
void Component::construct(Genode::Env &env)
{
log("--- lx_hybrid exception test ---");
@ -42,6 +36,5 @@ void Component::construct(Genode::Env &env)
}
log("--- returning from main ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
env.parent().exit(0);
}

View File

@ -50,13 +50,6 @@ static void *pthread_entry(void *)
}
static int exit_status;
static void exit_on_suspended() { exit(exit_status); }
/*
* Component implements classical main function in construct.
*/
void Component::construct(Genode::Env &env)
{
Genode::log("--- pthread IPC test ---");
@ -69,6 +62,5 @@ void Component::construct(Genode::Env &env)
main_wait_lock()->block();
Genode::log("--- finished pthread IPC test ---");
exit_status = 0;
env.ep().schedule_suspend(exit_on_suspended, nullptr);
env.parent().exit(0);
}