report_rom: deny requests for existing reports
If a requested report already exists the request is denied with Invalid_args. Further, I dusted the report_rom test and added it to the autopilot list.
This commit is contained in:
parent
9a326bed2d
commit
e2f2ac567e
|
@ -7,15 +7,15 @@ install_config {
|
||||||
<parent-provides>
|
<parent-provides>
|
||||||
<service name="ROM"/>
|
<service name="ROM"/>
|
||||||
<service name="RAM"/>
|
<service name="RAM"/>
|
||||||
<service name="CPU"/>
|
<service name="IRQ"/>
|
||||||
<service name="RM"/>
|
<service name="IO_MEM"/>
|
||||||
|
<service name="IO_PORT"/>
|
||||||
<service name="CAP"/>
|
<service name="CAP"/>
|
||||||
<service name="PD"/>
|
<service name="PD"/>
|
||||||
<service name="IRQ"/>
|
<service name="RM"/>
|
||||||
<service name="IO_PORT"/>
|
<service name="CPU"/>
|
||||||
<service name="IO_MEM"/>
|
|
||||||
<service name="SIGNAL"/>
|
|
||||||
<service name="LOG"/>
|
<service name="LOG"/>
|
||||||
|
<service name="SIGNAL"/>
|
||||||
</parent-provides>
|
</parent-provides>
|
||||||
<default-route>
|
<default-route>
|
||||||
<any-service> <parent/> <any-child/> </any-service>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
@ -26,15 +26,20 @@ install_config {
|
||||||
</start>
|
</start>
|
||||||
<start name="report_rom">
|
<start name="report_rom">
|
||||||
<resource name="RAM" quantum="2M"/>
|
<resource name="RAM" quantum="2M"/>
|
||||||
<provides> <service name="ROM" />
|
<provides> <service name="ROM"/> <service name="Report"/> </provides>
|
||||||
<service name="Report" /> </provides>
|
<config>
|
||||||
|
<rom>
|
||||||
|
<policy label="test-report_rom -> brightness"
|
||||||
|
report="test-report_rom -> brightness"/>
|
||||||
|
</rom>
|
||||||
|
</config>
|
||||||
</start>
|
</start>
|
||||||
<start name="test-report_rom">
|
<start name="test-report_rom">
|
||||||
<resource name="RAM" quantum="2M"/>
|
<resource name="RAM" quantum="2M"/>
|
||||||
<route>
|
<route>
|
||||||
<service name="ROM">
|
<service name="ROM">
|
||||||
<if-arg key="label" value="test-report_rom/brightness" />
|
<if-arg key="label" value="brightness"/>
|
||||||
<child name="report_rom" />
|
<child name="report_rom"/>
|
||||||
</service>
|
</service>
|
||||||
<any-service> <parent/> <any-child/> </any-service>
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
</route>
|
</route>
|
||||||
|
@ -56,15 +61,19 @@ compare_output_to {
|
||||||
[init -> test-report_rom] Reporter: brightness 10
|
[init -> test-report_rom] Reporter: brightness 10
|
||||||
[init -> test-report_rom] ROM client: request brightness report
|
[init -> test-report_rom] ROM client: request brightness report
|
||||||
[init -> test-report_rom] -> <brightness brightness="10"/>
|
[init -> test-report_rom] -> <brightness brightness="10"/>
|
||||||
|
[init -> test-report_rom]
|
||||||
[init -> test-report_rom] Reporter: updated brightness to 77
|
[init -> test-report_rom] Reporter: updated brightness to 77
|
||||||
[init -> test-report_rom] ROM client: wait for update notification
|
[init -> test-report_rom] ROM client: wait for update notification
|
||||||
[init -> test-report_rom] ROM client: got signal
|
[init -> test-report_rom] ROM client: got signal
|
||||||
[init -> test-report_rom] ROM client: request updated brightness report
|
[init -> test-report_rom] ROM client: request updated brightness report
|
||||||
[init -> test-report_rom] -> <brightness brightness="77"/>
|
[init -> test-report_rom] -> <brightness brightness="77"/>
|
||||||
|
[init -> test-report_rom]
|
||||||
[init -> test-report_rom] Reporter: close report session
|
[init -> test-report_rom] Reporter: close report session
|
||||||
[init -> test-report_rom] ROM client: wait for update notification
|
[init -> test-report_rom] ROM client: wait for update notification
|
||||||
[init -> test-report_rom] ROM client: detected vanished report
|
[init -> test-report_rom] ROM client: ROM is available despite report was closed - OK
|
||||||
[init -> test-report_rom] Reporter: start reporting (while the ROM client still listens)
|
[init -> test-report_rom] Reporter: start reporting (while the ROM client still listens)
|
||||||
[init -> test-report_rom] ROM client: wait for update notification
|
[init -> test-report_rom] ROM client: wait for update notification
|
||||||
|
[init -> test-report_rom] ROM client: try to open the same report again
|
||||||
|
[init -> test-report_rom] ROM client: catched Parent::Service_denied - OK
|
||||||
[init -> test-report_rom] --- test-report_rom finished ---
|
[init -> test-report_rom] --- test-report_rom finished ---
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,15 @@ struct Report::Session_component : Genode::Rpc_object<Session>, Rom::Writer
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rom::Module &_create_module(Rom::Module::Name const &name)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return _registry.lookup(*this, name);
|
||||||
|
} catch (...) {
|
||||||
|
throw Genode::Root::Invalid_args();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Session_component(Rom::Module::Name const &name, size_t buffer_size,
|
Session_component(Rom::Module::Name const &name, size_t buffer_size,
|
||||||
|
@ -60,7 +69,7 @@ struct Report::Session_component : Genode::Rpc_object<Session>, Rom::Writer
|
||||||
:
|
:
|
||||||
_registry(registry),
|
_registry(registry),
|
||||||
_ds(Genode::env()->ram_session(), buffer_size),
|
_ds(Genode::env()->ram_session(), buffer_size),
|
||||||
_module(_registry.lookup(*this, name)),
|
_module(_create_module(name)),
|
||||||
_verbose(verbose)
|
_verbose(verbose)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ int main(int argc, char **argv)
|
||||||
report_brightness(brightness_reporter, 10);
|
report_brightness(brightness_reporter, 10);
|
||||||
|
|
||||||
printf("ROM client: request brightness report\n");
|
printf("ROM client: request brightness report\n");
|
||||||
Attached_rom_dataspace brightness_rom("test-report_rom/brightness");
|
Attached_rom_dataspace brightness_rom("brightness");
|
||||||
|
|
||||||
ASSERT(brightness_rom.is_valid());
|
ASSERT(brightness_rom.is_valid());
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ int main(int argc, char **argv)
|
||||||
sig_rec.wait_for_signal();
|
sig_rec.wait_for_signal();
|
||||||
|
|
||||||
brightness_rom.update();
|
brightness_rom.update();
|
||||||
ASSERT(!brightness_rom.is_valid());
|
ASSERT(brightness_rom.is_valid());
|
||||||
printf("ROM client: detected vanished report\n");
|
printf("ROM client: ROM is available despite report was closed - OK\n");
|
||||||
|
|
||||||
printf("Reporter: start reporting (while the ROM client still listens)\n");
|
printf("Reporter: start reporting (while the ROM client still listens)\n");
|
||||||
brightness_reporter.enabled(true);
|
brightness_reporter.enabled(true);
|
||||||
|
@ -82,6 +82,16 @@ int main(int argc, char **argv)
|
||||||
printf("ROM client: wait for update notification\n");
|
printf("ROM client: wait for update notification\n");
|
||||||
sig_rec.wait_for_signal();
|
sig_rec.wait_for_signal();
|
||||||
|
|
||||||
|
try {
|
||||||
|
printf("ROM client: try to open the same report again\n");
|
||||||
|
Reporter again("brightness");
|
||||||
|
again.enabled(true);
|
||||||
|
PERR("expected Service_denied");
|
||||||
|
return -3;
|
||||||
|
} catch (Genode::Parent::Service_denied) {
|
||||||
|
printf("ROM client: catched Parent::Service_denied - OK\n");
|
||||||
|
}
|
||||||
|
|
||||||
printf("--- test-report_rom finished ---\n");
|
printf("--- test-report_rom finished ---\n");
|
||||||
|
|
||||||
sig_rec.dissolve(&sig_ctx);
|
sig_rec.dissolve(&sig_ctx);
|
||||||
|
|
|
@ -54,3 +54,4 @@ cpu_quota
|
||||||
stdcxx
|
stdcxx
|
||||||
nic_loopback
|
nic_loopback
|
||||||
platform
|
platform
|
||||||
|
report_rom
|
||||||
|
|
Loading…
Reference in New Issue