Skip to content

Commit

Permalink
[tests] Skip midi in / out tests on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Oct 13, 2024
1 parent 0f43b64 commit 9374128
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
16 changes: 11 additions & 5 deletions tests/unit/midi_in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

TEST_CASE("creation", "[midi_in]")
{
#if defined(LIBREMIDI_CI)
SKIP("GH runners do not have MIDI support");
#endif

GIVEN("A default midi input")
{
libremidi::midi_in in(libremidi::input_configuration{.on_message = [](auto) {}});
Expand Down Expand Up @@ -96,7 +100,10 @@ TEST_CASE("creation", "[midi_in]")
TEST_CASE("poly aftertouch", "[midi_in]")
{
#if __has_include(<jack/jack.h>)
#if !defined(LIBREMIDI_CI)
#if defined(LIBREMIDI_CI)
SKIP("GH runners do not have MIDI support");
#endif

std::vector<libremidi::message> queue;
std::mutex qmtx;

Expand All @@ -106,11 +113,11 @@ TEST_CASE("poly aftertouch", "[midi_in]")

libremidi::midi_in midi{
libremidi::input_configuration{
.on_message
= [&](libremidi::message&& msg) {
.on_message =
[&](libremidi::message&& msg) {
std::lock_guard _{qmtx};
queue.push_back(std::move(msg));
}},
}},
libremidi::jack_input_configuration{.client_name = "libremidi-test"}};
midi.open_virtual_port("port");

Expand Down Expand Up @@ -144,5 +151,4 @@ TEST_CASE("poly aftertouch", "[midi_in]")
REQUIRE(mess.bytes == libremidi::channel_events::poly_pressure(0, 60, 100).bytes);
}
#endif
#endif
}
20 changes: 13 additions & 7 deletions tests/unit/midi_out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

TEST_CASE("creation", "[midi_out]")
{
#if defined(LIBREMIDI_CI)
SKIP("GH runners do not have MIDI support");
#endif

GIVEN("A default midi output")
{
libremidi::midi_out out;
Expand Down Expand Up @@ -61,11 +65,14 @@ TEST_CASE("sending messages with span", "[midi_out]")
midi.send_message(std::span<unsigned char>(data, 3));
}

#if !defined(LIBREMIDI_CI)
#if defined(__linux__)
#include <libremidi/backends/alsa_raw/config.hpp>
#if defined(__linux__)
#include <libremidi/backends/alsa_raw/config.hpp>
TEST_CASE("sending chunked messages", "[midi_out]")
{
#if defined(LIBREMIDI_CI)
SKIP("GH runners do not have MIDI support");
#endif

std::set<int> written_bytes;

libremidi::midi_out midi{
Expand All @@ -75,9 +82,9 @@ TEST_CASE("sending chunked messages", "[midi_out]")
.interval = std::chrono::milliseconds(100),
.size = 4096, // 4kb
.wait = [&](const std::chrono::microseconds&, int sz) {
written_bytes.insert(sz);
return true;
}}}};
written_bytes.insert(sz);
return true;
}}}};

if (auto ports
= libremidi::observer{{}, libremidi::alsa_raw_observer_configuration{}}.get_output_ports();
Expand All @@ -95,5 +102,4 @@ TEST_CASE("sending chunked messages", "[midi_out]")
WARN("No MIDI output found, skipping test");
}
}
#endif
#endif

0 comments on commit 9374128

Please sign in to comment.