Browse Source

re-fix AU plugin scan

agpl_proxy
Alexandros Theodotou 2 years ago
parent
commit
9e09e8f4f0
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 6
      src/plugins/carla/carla_discovery.c
  2. 2
      src/plugins/plugin_manager.c
  3. 1439
      tests/au_plugins.txt
  4. 55
      tests/plugins/carla_discovery.c

6
src/plugins/carla/carla_discovery.c

@ -155,6 +155,9 @@ z_carla_discovery_parse_plugin_info ( @@ -155,6 +155,9 @@ z_carla_discovery_parse_plugin_info (
const char * plugin_path,
char * results)
{
g_return_val_if_fail (
plugin_path && results, NULL);
PluginDescriptor ** descriptors =
calloc (1, sizeof (PluginDescriptor *));
int num_descriptors = 0;
@ -583,6 +586,8 @@ z_carla_discovery_create_au_descriptor_from_string ( @@ -583,6 +586,8 @@ z_carla_discovery_create_au_descriptor_from_string (
char * cur_str = g_strdup (all_plugins);
g_debug ("creating AU descriptor for %d", idx);
/* replace cur_str with the following parts */
for (int i = 0; i < idx; i++)
{
@ -597,6 +602,7 @@ z_carla_discovery_create_au_descriptor_from_string ( @@ -597,6 +602,7 @@ z_carla_discovery_create_au_descriptor_from_string (
string_get_substr_before_suffix (
cur_str, discovery_end_txt);
g_free (cur_str);
g_return_val_if_fail (plugin_info, NULL);
char id[50];
sprintf (id, "%d", idx);

2
src/plugins/plugin_manager.c

@ -1278,7 +1278,7 @@ plugin_manager_scan_plugins ( @@ -1278,7 +1278,7 @@ plugin_manager_scan_plugins (
{
PluginDescriptor * descriptor =
z_carla_discovery_create_au_descriptor_from_string (
&all_plugins, i);
all_plugins, (int) i);
if (descriptor)
{

1439
tests/au_plugins.txt

File diff suppressed because it is too large Load Diff

55
tests/plugins/carla_discovery.c

@ -29,6 +29,58 @@ @@ -29,6 +29,58 @@
#include <glib.h>
static void
test_mock_au_plugin_scan (void)
{
test_helper_zrythm_init ();
#ifdef HAVE_CARLA
g_message ("Scanning AU plugins...");
unsigned int au_count = 45;
GError * err = NULL;
char * contents = NULL;
char * filename =
g_build_filename (
TESTS_SRCDIR, "au_plugins.txt", NULL);
bool success =
g_file_get_contents (
filename, &contents, NULL, &err);
g_assert_true (success);
char * all_plugins = contents;
g_message ("all plugins %s", all_plugins);
g_message ("%u plugins found", au_count);
for (unsigned int i = 0; i < au_count; i++)
{
PluginDescriptor * descriptor =
z_carla_discovery_create_au_descriptor_from_string (
all_plugins, (int) i);
if (descriptor)
{
g_assert_cmpuint (
strlen (descriptor->category_str),
>, 1);
g_assert_cmpuint (
strlen (descriptor->category_str),
<, 40);
g_message (
"Scanned AU plugin %s",
descriptor->name);
}
else
{
g_message (
"Skipped AU plugin at %u", i);
}
plugin_descriptor_free (descriptor);
}
#endif
test_helper_zrythm_cleanup ();
}
static void
test_parse_plugin_info (void)
{
@ -155,6 +207,9 @@ main (int argc, char *argv[]) @@ -155,6 +207,9 @@ main (int argc, char *argv[])
#define TEST_PREFIX "/plugins/carla_discovery/"
g_test_add_func (
TEST_PREFIX "test mock AU plugin scan",
(GTestFunc) test_mock_au_plugin_scan);
g_test_add_func (
TEST_PREFIX "test parse plugin info",
(GTestFunc) test_parse_plugin_info);

Loading…
Cancel
Save