#include "tap/tap.h"
#include "common.h"
-#define NR_TESTS 33
+#define NR_TESTS 40
#define NON_EXISTING_PATH "/this/hopefully/does/not/exist/5bc75f8d-0dba-4043-a509-d7984b97e42b.so"
/* Those symbols are written to by some test plugins */
"bt_plugin_get_name() handles NULL correctly");
ok(!bt_plugin_get_description(NULL),
"bt_plugin_get_description() handles NULL correctly");
+ ok(bt_plugin_get_version(NULL, NULL, NULL, NULL, NULL) !=
+ BT_PLUGIN_STATUS_OK,
+ "bt_plugin_get_version() handles NULL correctly");
ok(!bt_plugin_get_author(NULL),
"bt_plugin_get_author() handles NULL correctly");
ok(!bt_plugin_get_license(NULL),
ok(strcmp(bt_plugin_get_description(plugin),
"Minimal Babeltrace plugin with no component classes") == 0,
"bt_plugin_get_description() returns the expected description");
+ ok(bt_plugin_get_version(plugin, NULL, NULL, NULL, NULL) !=
+ BT_PLUGIN_STATUS_OK,
+ "bt_plugin_get_version() fails when there's no version");
ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
"bt_plugin_get_author() returns the expected author");
ok(strcmp(bt_plugin_get_license(plugin), "Beerware") == 0,
struct bt_component_class *filter_comp_class;
struct bt_component *sink_component;
char *sfs_path = get_test_plugin_path(plugin_dir, "sfs");
+ unsigned int major, minor, patch;
+ const char *extra;
assert(sfs_path);
diag("sfs plugin test below");
plugins = bt_plugin_create_all_from_file(sfs_path);
assert(plugins && plugins[0]);
plugin = plugins[0];
+ ok(bt_plugin_get_version(plugin, &major, &minor, &patch, &extra) ==
+ BT_PLUGIN_STATUS_OK,
+ "bt_plugin_get_version() succeeds when there's a version");
+ ok(major == 1,
+ "bt_plugin_get_version() returns the expected major version");
+ ok(minor == 2,
+ "bt_plugin_get_version() returns the expected minor version");
+ ok(patch == 3,
+ "bt_plugin_get_version() returns the expected patch version");
+ ok(strcmp(extra, "yes") == 0,
+ "bt_plugin_get_version() returns the expected extra version");
ok(bt_plugin_get_component_class_count(plugin) == 3,
"bt_plugin_get_component_class_count() returns the expected value");
source_comp_class = bt_plugin_get_component_class_by_name_and_type(
- plugin, "source", BT_COMPONENT_TYPE_SOURCE);
+ plugin, "source", BT_COMPONENT_CLASS_TYPE_SOURCE);
ok(source_comp_class,
"bt_plugin_get_component_class_by_name_and_type() finds a source component class");
sink_comp_class = bt_plugin_get_component_class_by_name_and_type(
- plugin, "sink", BT_COMPONENT_TYPE_SINK);
+ plugin, "sink", BT_COMPONENT_CLASS_TYPE_SINK);
ok(sink_comp_class,
"bt_plugin_get_component_class_by_name_and_type() finds a sink component class");
filter_comp_class = bt_plugin_get_component_class_by_name_and_type(
- plugin, "filter", BT_COMPONENT_TYPE_FILTER);
+ plugin, "filter", BT_COMPONENT_CLASS_TYPE_FILTER);
ok(filter_comp_class,
"bt_plugin_get_component_class_by_name_and_type() finds a filter component class");
ok(!bt_plugin_get_component_class_by_name_and_type(plugin, "filter",
- BT_COMPONENT_TYPE_SOURCE),
+ BT_COMPONENT_CLASS_TYPE_SOURCE),
"bt_plugin_get_component_class_by_name_and_type() does not find a component class given the wrong type");
diag("> putting the plugin object here");