~alextee/zrythm-devel

fix tests compilation without installed plugins v1 APPLIED

Robert Panovics: 1
 fix tests compilation without installed plugins

 7 files changed, 58 insertions(+), 28 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~alextee/zrythm-devel/patches/31484/mbox | git am -3
Learn more about email & git

[PATCH] fix tests compilation without installed plugins Export this patch

Signed-off-by: Robert Panovics <robert.panovics@gmail.com>
---
 tests/actions/mixer_selections_action.c       | 38 +++++++++++++------
 tests/actions/tracklist_selections.c          | 16 ++++++--
 tests/actions/tracklist_selections_edit.c     | 11 ++++--
 tests/integration/recording.c                 | 14 +++----
 .../undo_redo_helm_track_creation.c           |  2 +
 tests/plugins/lv2_plugin.c                    |  3 +-
 tests/plugins/plugin.c                        |  2 +
 7 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/tests/actions/mixer_selections_action.c b/tests/actions/mixer_selections_action.c
index b2db0e299..1e316807d 100644
--- a/tests/actions/mixer_selections_action.c
+++ b/tests/actions/mixer_selections_action.c
@@ -18,6 +18,8 @@
#include "tests/helpers/plugin_manager.h"
#include "tests/helpers/project.h"

#if defined(HAVE_HELM) \
  || defined(HAVE_NO_DELAY_LINE)
static int num_master_children = 0;

static void
@@ -103,7 +105,7 @@ _test_copy_plugins (
   * plugins */
  if (is_instrument)
    {
#if 0
#  if 0
      if (!with_carla)
        {
          g_assert_true (
@@ -128,7 +130,7 @@ _test_copy_plugins (
      undo_manager_undo (UNDO_MANAGER, NULL);
      undo_manager_redo (UNDO_MANAGER, NULL);
      undo_manager_undo (UNDO_MANAGER, NULL);
#endif
#  endif
    }
  else
    {
@@ -146,6 +148,7 @@ _test_copy_plugins (

  g_usleep (100);
}
#endif

static void
test_copy_plugins (void)
@@ -225,6 +228,12 @@ test_midi_fx_slot_deletion (void)
  test_helper_zrythm_cleanup ();
}

#if defined(HAVE_HELM) \
  || defined(HAVE_LSP_COMPRESSOR) \
  || defined(HAVE_CARLA_RACK) \
  || (defined(HAVE_CARLA) && defined(HAVE_NOIZEMAKER)) \
  || defined(HAVE_SHERLOCK_ATOM_INSPECTOR) \
  || (defined(HAVE_UNLIMITED_MEM) && defined(HAVE_CALF_COMPRESSOR))
static void
_test_create_plugins (
  PluginProtocol prot,
@@ -235,7 +244,7 @@ _test_create_plugins (
{
  PluginSetting * setting = NULL;

#ifdef HAVE_SHERLOCK_ATOM_INSPECTOR
#  ifdef HAVE_SHERLOCK_ATOM_INSPECTOR
  if (string_is_equal (
        pl_uri, SHERLOCK_ATOM_INSPECTOR_URI))
    {
@@ -250,7 +259,7 @@ _test_create_plugins (
            "*Failed from water*");
        }
    }
#endif
#  endif

  switch (prot)
    {
@@ -263,7 +272,7 @@ _test_create_plugins (
        setting, F_NO_VALIDATE);
      break;
    case PROT_VST:
#ifdef HAVE_CARLA
#  ifdef HAVE_CARLA
      {
        PluginDescriptor ** descriptors =
          z_carla_discovery_create_descriptors_from_file (
@@ -272,7 +281,7 @@ _test_create_plugins (
          descriptors[0]);
        free (descriptors);
      }
#endif
#  endif
      break;
    default:
      break;
@@ -364,7 +373,7 @@ _test_create_plugins (

  test_project_save_and_reload ();

#ifdef HAVE_SHERLOCK_ATOM_INSPECTOR
#  ifdef HAVE_SHERLOCK_ATOM_INSPECTOR
  if (string_is_equal (
        pl_uri, SHERLOCK_ATOM_INSPECTOR_URI))
    {
@@ -378,10 +387,11 @@ _test_create_plugins (
      undo_manager_undo (UNDO_MANAGER, NULL);
      undo_manager_undo (UNDO_MANAGER, NULL);
    }
#endif
#  endif

  g_message ("done");
}
#endif

static void
test_create_plugins (void)
@@ -1267,6 +1277,9 @@ test_undoing_deletion_of_multiple_inserts (void)
  test_helper_zrythm_cleanup ();
}

#if defined(HAVE_HELM) \
  || defined(HAVE_CARLA_RACK) \
  || (defined(HAVE_CARLA) && defined(HAVE_NOIZEMAKER))
static void
_test_replace_instrument (
  PluginProtocol prot,
@@ -1274,7 +1287,7 @@ _test_replace_instrument (
  const char *   pl_uri,
  bool           with_carla)
{
#ifdef HAVE_LSP_COMPRESSOR
#  ifdef HAVE_LSP_COMPRESSOR
  PluginSetting * setting = NULL;

  switch (prot)
@@ -1288,7 +1301,7 @@ _test_replace_instrument (
        setting, F_NO_VALIDATE);
      break;
    case PROT_VST:
#  ifdef HAVE_CARLA
#    ifdef HAVE_CARLA
      {
        PluginDescriptor ** descriptors =
          z_carla_discovery_create_descriptors_from_file (
@@ -1297,7 +1310,7 @@ _test_replace_instrument (
          descriptors[0]);
        free (descriptors);
      }
#  endif
#    endif
      break;
    default:
      break;
@@ -1550,8 +1563,9 @@ _test_replace_instrument (
  test_project_save_and_reload ();

  plugin_setting_free (setting);
#endif /* HAVE LSP_COMPRESSOR */
#  endif /* HAVE LSP_COMPRESSOR */
}
#endif

static void
test_replace_instrument (void)
diff --git a/tests/actions/tracklist_selections.c b/tests/actions/tracklist_selections.c
index 2ba1221f1..8549357ce 100644
--- a/tests/actions/tracklist_selections.c
+++ b/tests/actions/tracklist_selections.c
@@ -114,6 +114,8 @@ test_create_ins_when_redo_stack_nonempty (void)
  test_helper_zrythm_cleanup ();
}

#if defined(HAVE_HELM) \
  || defined(HAVE_LSP_COMPRESSOR)
static void
_test_port_and_plugin_track_pos_after_duplication (
  const char * pl_bundle,
@@ -245,6 +247,7 @@ _test_port_and_plugin_track_pos_after_duplication (
  undo_manager_undo (UNDO_MANAGER, NULL);
  undo_manager_undo (UNDO_MANAGER, NULL);
}
#endif

static void
test_port_and_plugin_track_pos_after_duplication (
@@ -286,6 +289,7 @@ test_port_and_plugin_track_pos_after_duplication_with_carla (
}
#endif

#ifdef HAVE_HELM
static void
_test_undo_track_deletion (
  const char * pl_bundle,
@@ -374,6 +378,7 @@ _test_undo_track_deletion (
  /* let the engine run */
  g_usleep (1000000);
}
#endif

static void
test_undo_track_deletion (void)
@@ -1037,6 +1042,8 @@ test_no_visible_tracks_after_track_deletion (void)
  test_helper_zrythm_cleanup ();
}

#if defined(HAVE_HELM) \
  || defined(HAVE_LSP_COMPRESSOR)
static void
_test_move_tracks (
  const char * pl_bundle,
@@ -1184,7 +1191,7 @@ _test_move_tracks (
      &P_MASTER_TRACK->processor->stereo_in->r->id));

  /* TODO replace below */
#if 0
#  if 0
  /* verify fx track out ports */
  port_verify_src_and_dests (
    fx_track->channel->stereo_out->l);
@@ -1196,7 +1203,7 @@ _test_move_tracks (
    P_MASTER_TRACK->processor->stereo_in->l);
  port_verify_src_and_dests (
    P_MASTER_TRACK->processor->stereo_in->r);
#endif
#  endif

  /* unswap tracks */
  undo_manager_undo (UNDO_MANAGER, NULL);
@@ -1239,7 +1246,7 @@ _test_move_tracks (
      &fx_track->channel->stereo_out->r->id,
      &P_MASTER_TRACK->processor->stereo_in->r->id));

#if 0
#  if 0
  /* verify fx track out ports */
  port_verify_src_and_dests (
    fx_track->channel->stereo_out->l);
@@ -1251,8 +1258,9 @@ _test_move_tracks (
    P_MASTER_TRACK->processor->stereo_in->l);
  port_verify_src_and_dests (
    P_MASTER_TRACK->processor->stereo_in->r);
#endif
#  endif
}
#endif

static void
__test_move_tracks (bool with_carla)
diff --git a/tests/actions/tracklist_selections_edit.c b/tests/actions/tracklist_selections_edit.c
index 34cc49816..d68b47df2 100644
--- a/tests/actions/tracklist_selections_edit.c
+++ b/tests/actions/tracklist_selections_edit.c
@@ -24,6 +24,8 @@
#include "tests/helpers/plugin_manager.h"
#include "tests/helpers/project.h"

#if defined(HAVE_CHIPWAVE) || defined(HAVE_HELM) \
  || defined(HAVE_LSP_COMPRESSOR)
static Track *
get_ins_track (void)
{
@@ -226,23 +228,23 @@ _test_edit_tracks (

        Port * l =
          ins_track->channel->fader->stereo_out->l;
#if 0
#  if 0
        Port * ins_out_l =
          plugin_get_port_by_symbol (
          ins_track->channel->instrument,
          /*"lv2_audio_out_1");*/
          "lv2_audio_out_1");
#endif
#  endif
        for (nframes_t i = 0;
             i < AUDIO_ENGINE->block_length; i++)
          {
#if 0
#  if 0
            g_message (
              "[%u] %.16f", i, (double) l->buf[i]);
            g_message (
              "[%u i] %.16f", i,
              (double) ins_out_l->buf[i]);
#endif
#  endif
            if (l->buf[i] > 0.0001f)
              {
                has_signal = true;
@@ -472,6 +474,7 @@ _test_edit_tracks (
      break;
    }
}
#endif

static void
__test_edit_tracks (bool with_carla)
diff --git a/tests/integration/recording.c b/tests/integration/recording.c
index 263bb5931..971b55843 100644
--- a/tests/integration/recording.c
+++ b/tests/integration/recording.c
@@ -63,6 +63,7 @@ prepare (void)
  port_allocate_bufs (AUDIO_ENGINE->dummy_input->r);
}

#ifdef HAVE_HELM
static void
do_takes_no_loop_no_punch (
  Track * ins_track,
@@ -358,7 +359,7 @@ do_takes_loop_no_punch (
  transport_set_punch_mode_enabled (
    TRANSPORT, false);

#define FRAMES_BEFORE_LOOP 4
#  define FRAMES_BEFORE_LOOP 4

  /* move playhead to 4 ticks before loop */
  Position pos;
@@ -557,18 +558,18 @@ do_takes_loop_no_punch (
  g_assert_cmppos (&pos, &ap_obj->pos);
  g_assert_cmpfloat_with_epsilon (
    ap->fvalue, latch_val_at_start, 0.0001f);
#if 0
#  if 0
  ap = latch_r->aps[1];
  ap_obj = (ArrangerObject *) ap;
  position_from_frames (&pos, FRAMES_BEFORE_LOOP);
  g_assert_cmppos (&pos, &ap_obj->pos);
  g_assert_cmpfloat_with_epsilon (
    ap->fvalue, latch_val_at_start, 0.0001f);
#endif
#  endif

  /* TODO try the above steps again with data like
   * below */
#if 0
#  if 0
  /* send a MIDI event */
  Port * port = ins_track->processor->midi_in;
  midi_events_add_note_on (
@@ -689,9 +690,9 @@ do_takes_loop_no_punch (
  engine_process (AUDIO_ENGINE, CYCLE_SIZE);
  recording_manager_process_events (
    RECORDING_MANAGER);
#endif
#  endif

#undef FRAMES_BEFORE_LOOP
#  undef FRAMES_BEFORE_LOOP

  /* save and undo/redo */
  test_project_save_and_reload ();
@@ -724,7 +725,6 @@ test_recording_takes (
    ins_track, audio_track, master_track);
}

#ifdef HAVE_HELM
static void
test_recording (void)
{
diff --git a/tests/integration/undo_redo_helm_track_creation.c b/tests/integration/undo_redo_helm_track_creation.c
index 6973bb3c3..102e9326f 100644
--- a/tests/integration/undo_redo_helm_track_creation.c
+++ b/tests/integration/undo_redo_helm_track_creation.c
@@ -35,6 +35,7 @@
#include "tests/helpers/project.h"
#include "tests/helpers/zrythm.h"

#ifdef HAVE_HELM
static void
_test (
  const char * pl_bundle,
@@ -77,6 +78,7 @@ _test (
  /* let the engine run */
  g_usleep (1000000);
}
#endif

static void
test (void)
diff --git a/tests/plugins/lv2_plugin.c b/tests/plugins/lv2_plugin.c
index 8bc7eebc9..791437560 100644
--- a/tests/plugins/lv2_plugin.c
+++ b/tests/plugins/lv2_plugin.c
@@ -231,7 +231,7 @@ test_save_state_w_files (void)
  test_helper_zrythm_cleanup ();
#endif
}

#if defined(HAVE_SFIZZ) || defined(HAVE_DROPS)
static void
test_reloading_project_with_instrument (
  const char * pl_bundle,
@@ -267,6 +267,7 @@ test_reloading_project_with_instrument (

  test_helper_zrythm_cleanup ();
}
#endif

/**
 * Test a plugin with lots of parameters.
diff --git a/tests/plugins/plugin.c b/tests/plugins/plugin.c
index 63d71ecb9..3486ded5b 100644
--- a/tests/plugins/plugin.c
+++ b/tests/plugins/plugin.c
@@ -31,6 +31,7 @@

#include <lilv/lilv.h>

#ifdef HAVE_HELM
static void
_test_loading_non_existing_plugin (
  const char * pl_bundle,
@@ -68,6 +69,7 @@ _test_loading_non_existing_plugin (
  /* assert expected messages */
  g_test_assert_expected_messages ();
}
#endif

static void
test_loading_non_existing_plugin (void)
-- 
2.35.1
Thanks, applied as 3b67adc72ba3508c7f8c3bda5ac7fa7ce7becb13.