mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +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/init
|
||||||
_/src/top
|
_/src/top
|
||||||
_/src/test-trace
|
_/src/test-trace
|
||||||
|
_/src/sequence
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<events>
|
<events>
|
||||||
<timeout meaning="failed" sec="30" />
|
<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>
|
<log meaning="failed">Error: </log>
|
||||||
</events>
|
</events>
|
||||||
|
|
||||||
@ -12,6 +12,7 @@
|
|||||||
<rom label="ld.lib.so"/>
|
<rom label="ld.lib.so"/>
|
||||||
<rom label="top"/>
|
<rom label="top"/>
|
||||||
<rom label="test-trace"/>
|
<rom label="test-trace"/>
|
||||||
|
<rom label="sequence"/>
|
||||||
<rom label="null"/>
|
<rom label="null"/>
|
||||||
</content>
|
</content>
|
||||||
|
|
||||||
@ -31,11 +32,30 @@
|
|||||||
<default-route>
|
<default-route>
|
||||||
<any-service> <parent/> <any-child/> </any-service>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
</default-route>
|
</default-route>
|
||||||
<default caps="100"/>
|
<default caps="200"/>
|
||||||
<start name="test-trace">
|
<start name="sequence">
|
||||||
<resource name="RAM" quantum="10M"/>
|
<resource name="RAM" quantum="15M"/>
|
||||||
<config>
|
<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>
|
</config>
|
||||||
</start>
|
</start>
|
||||||
<start name="top">
|
<start name="top">
|
||||||
|
@ -196,6 +196,7 @@ struct Test_tracing
|
|||||||
typedef Genode::String<64> String;
|
typedef Genode::String<64> String;
|
||||||
String policy_label { };
|
String policy_label { };
|
||||||
String policy_module { };
|
String policy_module { };
|
||||||
|
String policy_thread { };
|
||||||
|
|
||||||
Rom_dataspace_capability policy_module_rom_ds { };
|
Rom_dataspace_capability policy_module_rom_ds { };
|
||||||
|
|
||||||
@ -232,6 +233,7 @@ struct Test_tracing
|
|||||||
Xml_node policy = config.xml().sub_node("trace_policy");
|
Xml_node policy = config.xml().sub_node("trace_policy");
|
||||||
policy.attribute("label").value(policy_label);
|
policy.attribute("label").value(policy_label);
|
||||||
policy.attribute("module").value(policy_module);
|
policy.attribute("module").value(policy_module);
|
||||||
|
policy.attribute("thread").value(policy_thread);
|
||||||
|
|
||||||
Rom_connection policy_rom(env, policy_module.string());
|
Rom_connection policy_rom(env, policy_module.string());
|
||||||
policy_module_rom_ds = policy_rom.dataspace();
|
policy_module_rom_ds = policy_rom.dataspace();
|
||||||
@ -281,12 +283,20 @@ struct Test_tracing
|
|||||||
|
|
||||||
for_each_subject(subjects, num_subjects, print_info);
|
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 */
|
/* enable tracing for test-thread */
|
||||||
auto enable_tracing = [this, &env] (Trace::Subject_id id,
|
auto enable_tracing = [this, &env] (Trace::Subject_id id,
|
||||||
Trace::Subject_info info) {
|
Trace::Subject_info info) {
|
||||||
|
|
||||||
if ( info.session_label() != policy_label
|
if ( info.session_label() != policy_label
|
||||||
|| info.thread_name() != "test-thread") {
|
|| info.thread_name() != policy_thread) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +330,7 @@ struct Test_tracing
|
|||||||
log("passed Tracing test");
|
log("passed Tracing test");
|
||||||
}
|
}
|
||||||
else
|
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