black_hole: test recipe for the depot_autopilot

* Creates sessions to all supported services of the black hole component
* Test-drives the Event and Capture session with dummy input
* Adds the test to the default list of depot_autopilot.run
* Test-driving the Audio_in and Audio_out sessions is still missing and should
  be added via a dedicated commit

Ref #4419
This commit is contained in:
Martin Stein 2022-02-11 12:16:29 +01:00 committed by Norman Feske
parent 3966d6f16f
commit ca49e94a87
10 changed files with 155 additions and 0 deletions

View File

@ -649,6 +649,7 @@ set default_test_pkgs {
test-spark test-spark
test-spark_exception test-spark_exception
test-spark_secondary_stack test-spark_secondary_stack
test-black_hole
test-clipboard test-clipboard
test-depot_query_index test-depot_query_index
test-ds_ownership test-ds_ownership

View File

@ -0,0 +1 @@
Test for the black-hole server

View File

@ -0,0 +1,3 @@
_/src/init
_/src/test-black_hole
_/src/black_hole

View File

@ -0,0 +1 @@
2022-02-11-b 774e0d8885fc800ca080f1ecfee487dcaec152ea

View File

@ -0,0 +1,69 @@
<runtime ram="32M" caps="1000" binary="init">
<requires> <timer/> </requires>
<events>
<timeout meaning="failed" sec="10" />
<log meaning="succeeded">Finished</log>
</events>
<content>
<rom label="ld.lib.so"/>
<rom label="test-black_hole"/>
<rom label="black_hole"/>
</content>
<config>
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="Timer"/>
</parent-provides>
<start name="black_hole" caps="100">
<resource name="RAM" quantum="1M"/>
<provides>
<service name="Event"/>
<service name="Capture"/>
<service name="Audio_in"/>
<service name="Audio_out"/>
</provides>
<config>
<event/>
<capture/>
<audio_in/>
<audio_out/>
</config>
<route>
<service name="Timer"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
</route>
</start>
<start name="test-black_hole" caps="100">
<resource name="RAM" quantum="10M"/>
<route>
<service name="Event"> <child name="black_hole"/> </service>
<service name="Capture"> <child name="black_hole"/> </service>
<service name="Audio_in"> <child name="black_hole"/> </service>
<service name="Audio_out"> <child name="black_hole"/> </service>
<service name="ROM"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="CPU"> <parent/> </service>
</route>
</start>
</config>
</runtime>

View File

@ -0,0 +1,2 @@
SRC_DIR = src/test/black_hole
include $(GENODE_DIR)/repos/base/recipes/src/content.inc

View File

@ -0,0 +1 @@
2022-02-11-a 4f701d8c4696d6b6d267e352b6eec00affeeee7d

View File

@ -0,0 +1,7 @@
base
os
blit
audio_in_session
audio_out_session
event_session
capture_session

View File

@ -0,0 +1,67 @@
/*
* \brief Testing the functionality of the black hole component
* \author Martin Stein
* \date 2022-02-11
*/
/*
* Copyright (C) 2022 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.
*/
/* base includes */
#include <base/component.h>
/* os includes */
#include <event_session/connection.h>
#include <capture_session/connection.h>
#include <audio_in_session/connection.h>
#include <audio_out_session/connection.h>
#include <input/keycodes.h>
using namespace Genode;
namespace Test {
class Main;
}
class Test::Main
{
private:
Env &_env;
Event::Connection _event { _env };
Capture::Connection _capture { _env };
Capture::Area _capture_screen_size { 1, 1 };
Capture::Pixel _capture_pixels[1];
Surface<Capture::Pixel> _capture_surface { _capture_pixels, _capture_screen_size };
Capture::Connection::Screen _capture_screen { _capture, _env.rm(), _capture_screen_size };
Audio_in::Connection _audio_in { _env, "left" };
Audio_out::Connection _audio_out { _env, "left" };
public:
Main(Env &env) : _env { env }
{
_event.with_batch([&] (Event::Session_client::Batch &batch) {
batch.submit(Input::Press {Input::KEY_1 });
batch.submit(Input::Release {Input::KEY_2 });
batch.submit(Input::Relative_motion { 3, 4 });
});
_capture_screen.apply_to_surface(_capture_surface);
log("Finished");
}
};
void Component::construct(Env &env)
{
static Test::Main main { env };
}

View File

@ -0,0 +1,3 @@
TARGET := test-black_hole
SRC_CC += main.cc
LIBS += base blit