From ca49e94a87417baa403ec5676112621bc59db5e2 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 11 Feb 2022 12:16:29 +0100 Subject: [PATCH] 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 --- repos/gems/run/depot_autopilot.run | 1 + repos/os/recipes/pkg/test-black_hole/README | 1 + repos/os/recipes/pkg/test-black_hole/archives | 3 + repos/os/recipes/pkg/test-black_hole/hash | 1 + repos/os/recipes/pkg/test-black_hole/runtime | 69 +++++++++++++++++++ .../os/recipes/src/test-black_hole/content.mk | 2 + repos/os/recipes/src/test-black_hole/hash | 1 + .../os/recipes/src/test-black_hole/used_apis | 7 ++ repos/os/src/test/black_hole/main.cc | 67 ++++++++++++++++++ repos/os/src/test/black_hole/target.mk | 3 + 10 files changed, 155 insertions(+) create mode 100644 repos/os/recipes/pkg/test-black_hole/README create mode 100644 repos/os/recipes/pkg/test-black_hole/archives create mode 100644 repos/os/recipes/pkg/test-black_hole/hash create mode 100644 repos/os/recipes/pkg/test-black_hole/runtime create mode 100644 repos/os/recipes/src/test-black_hole/content.mk create mode 100644 repos/os/recipes/src/test-black_hole/hash create mode 100644 repos/os/recipes/src/test-black_hole/used_apis create mode 100644 repos/os/src/test/black_hole/main.cc create mode 100644 repos/os/src/test/black_hole/target.mk diff --git a/repos/gems/run/depot_autopilot.run b/repos/gems/run/depot_autopilot.run index 700a0d880b..a03469ef7f 100644 --- a/repos/gems/run/depot_autopilot.run +++ b/repos/gems/run/depot_autopilot.run @@ -649,6 +649,7 @@ set default_test_pkgs { test-spark test-spark_exception test-spark_secondary_stack + test-black_hole test-clipboard test-depot_query_index test-ds_ownership diff --git a/repos/os/recipes/pkg/test-black_hole/README b/repos/os/recipes/pkg/test-black_hole/README new file mode 100644 index 0000000000..c09ec99d81 --- /dev/null +++ b/repos/os/recipes/pkg/test-black_hole/README @@ -0,0 +1 @@ +Test for the black-hole server diff --git a/repos/os/recipes/pkg/test-black_hole/archives b/repos/os/recipes/pkg/test-black_hole/archives new file mode 100644 index 0000000000..2827d74bce --- /dev/null +++ b/repos/os/recipes/pkg/test-black_hole/archives @@ -0,0 +1,3 @@ +_/src/init +_/src/test-black_hole +_/src/black_hole diff --git a/repos/os/recipes/pkg/test-black_hole/hash b/repos/os/recipes/pkg/test-black_hole/hash new file mode 100644 index 0000000000..0e309add6c --- /dev/null +++ b/repos/os/recipes/pkg/test-black_hole/hash @@ -0,0 +1 @@ +2022-02-11-b 774e0d8885fc800ca080f1ecfee487dcaec152ea diff --git a/repos/os/recipes/pkg/test-black_hole/runtime b/repos/os/recipes/pkg/test-black_hole/runtime new file mode 100644 index 0000000000..32a896e218 --- /dev/null +++ b/repos/os/recipes/pkg/test-black_hole/runtime @@ -0,0 +1,69 @@ + + + + + + + Finished + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repos/os/recipes/src/test-black_hole/content.mk b/repos/os/recipes/src/test-black_hole/content.mk new file mode 100644 index 0000000000..64922a26f0 --- /dev/null +++ b/repos/os/recipes/src/test-black_hole/content.mk @@ -0,0 +1,2 @@ +SRC_DIR = src/test/black_hole +include $(GENODE_DIR)/repos/base/recipes/src/content.inc diff --git a/repos/os/recipes/src/test-black_hole/hash b/repos/os/recipes/src/test-black_hole/hash new file mode 100644 index 0000000000..dd28c74b31 --- /dev/null +++ b/repos/os/recipes/src/test-black_hole/hash @@ -0,0 +1 @@ +2022-02-11-a 4f701d8c4696d6b6d267e352b6eec00affeeee7d diff --git a/repos/os/recipes/src/test-black_hole/used_apis b/repos/os/recipes/src/test-black_hole/used_apis new file mode 100644 index 0000000000..6c271c2f7a --- /dev/null +++ b/repos/os/recipes/src/test-black_hole/used_apis @@ -0,0 +1,7 @@ +base +os +blit +audio_in_session +audio_out_session +event_session +capture_session diff --git a/repos/os/src/test/black_hole/main.cc b/repos/os/src/test/black_hole/main.cc new file mode 100644 index 0000000000..c78815df8e --- /dev/null +++ b/repos/os/src/test/black_hole/main.cc @@ -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 + +/* os includes */ +#include +#include +#include +#include + +#include + +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_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 }; +} diff --git a/repos/os/src/test/black_hole/target.mk b/repos/os/src/test/black_hole/target.mk new file mode 100644 index 0000000000..fdfffed909 --- /dev/null +++ b/repos/os/src/test/black_hole/target.mk @@ -0,0 +1,3 @@ +TARGET := test-black_hole +SRC_CC += main.cc +LIBS += base blit