mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 23:42:32 +00:00
test-trace: test destruction of trace subjects
If the trace subjects are not properly destructed when the TRACE client disappears, enabled sources will be owned by a non-existing client. In other words, when a TRACE client disappears all sources owned by the client must be disabled. genodelabs/genode#4247
This commit is contained in:
parent
9898341d4a
commit
81d939f947
@ -1,3 +1,4 @@
|
||||
_/src/init
|
||||
_/src/top
|
||||
_/src/test-trace
|
||||
_/src/sequence
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<events>
|
||||
<timeout meaning="failed" sec="30" />
|
||||
<log meaning="succeeded">child "test-trace" exited with exit value 0</log>
|
||||
<log meaning="succeeded">child "sequence" exited with exit value 0</log>
|
||||
<log meaning="failed">Error: </log>
|
||||
</events>
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
<rom label="ld.lib.so"/>
|
||||
<rom label="top"/>
|
||||
<rom label="test-trace"/>
|
||||
<rom label="sequence"/>
|
||||
<rom label="null"/>
|
||||
</content>
|
||||
|
||||
@ -31,11 +32,30 @@
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
<default caps="100"/>
|
||||
<start name="test-trace">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<default caps="200"/>
|
||||
<start name="sequence">
|
||||
<resource name="RAM" quantum="15M"/>
|
||||
<config>
|
||||
<trace_policy label="init -> dynamic -> test-trace -> test-trace" module="null" />
|
||||
<start name="test-trace">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<config>
|
||||
<trace_policy label="init -> dynamic -> test-trace -> sequence -> test-trace" thread="test-thread" module="null" />
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="test-trace">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<config>
|
||||
<trace_policy label="init -> dynamic -> test-trace -> top" thread="ep" module="null" />
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="test-trace">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<config>
|
||||
<trace_policy label="init -> dynamic -> test-trace -> top" thread="ep" module="null" />
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
</start>
|
||||
<start name="top">
|
||||
|
@ -196,6 +196,7 @@ struct Test_tracing
|
||||
typedef Genode::String<64> String;
|
||||
String policy_label { };
|
||||
String policy_module { };
|
||||
String policy_thread { };
|
||||
|
||||
Rom_dataspace_capability policy_module_rom_ds { };
|
||||
|
||||
@ -232,6 +233,7 @@ struct Test_tracing
|
||||
Xml_node policy = config.xml().sub_node("trace_policy");
|
||||
policy.attribute("label").value(policy_label);
|
||||
policy.attribute("module").value(policy_module);
|
||||
policy.attribute("thread").value(policy_thread);
|
||||
|
||||
Rom_connection policy_rom(env, policy_module.string());
|
||||
policy_module_rom_ds = policy_rom.dataspace();
|
||||
@ -281,12 +283,20 @@ struct Test_tracing
|
||||
|
||||
for_each_subject(subjects, num_subjects, print_info);
|
||||
|
||||
auto check_untraced = [this] (Trace::Subject_id id, Trace::Subject_info info) {
|
||||
|
||||
if (info.state() != Trace::Subject_info::UNTRACED)
|
||||
error("Subject ", id.id, " is not UNTRACED");
|
||||
};
|
||||
|
||||
for_each_subject(subjects, num_subjects, check_untraced);
|
||||
|
||||
/* enable tracing for test-thread */
|
||||
auto enable_tracing = [this, &env] (Trace::Subject_id id,
|
||||
Trace::Subject_info info) {
|
||||
|
||||
if ( info.session_label() != policy_label
|
||||
|| info.thread_name() != "test-thread") {
|
||||
|| info.thread_name() != policy_thread) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -320,7 +330,7 @@ struct Test_tracing
|
||||
log("passed Tracing test");
|
||||
}
|
||||
else
|
||||
error("Thread '", thread_name, "' not found for session ", policy_label);
|
||||
error("Thread '", policy_thread, "' not found for session ", policy_label);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user