Move test-runners has_feature() function to plugin loader
This commit is contained in:
@@ -20,37 +20,6 @@
|
||||
#include <library.h>
|
||||
#include <plugins/plugin_feature.h>
|
||||
|
||||
/**
|
||||
* Check if the plugin configuration provides a specific feature
|
||||
*/
|
||||
static bool has_feature(plugin_feature_t feature)
|
||||
{
|
||||
enumerator_t *plugins, *features;
|
||||
plugin_t *plugin;
|
||||
linked_list_t *list;
|
||||
plugin_feature_t *current;
|
||||
bool found = FALSE;
|
||||
|
||||
plugins = lib->plugins->create_plugin_enumerator(lib->plugins);
|
||||
while (plugins->enumerate(plugins, &plugin, &list))
|
||||
{
|
||||
features = list->create_enumerator(list);
|
||||
while (features->enumerate(features, ¤t))
|
||||
{
|
||||
if (plugin_feature_matches(&feature, current))
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
features->destroy(features);
|
||||
list->destroy(list);
|
||||
}
|
||||
plugins->destroy(plugins);
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
SRunner *sr;
|
||||
@@ -83,7 +52,8 @@ int main()
|
||||
srunner_add_suite(sr, threading_suite_create());
|
||||
srunner_add_suite(sr, utils_suite_create());
|
||||
srunner_add_suite(sr, vectors_suite_create());
|
||||
if (has_feature(PLUGIN_DEPENDS(PRIVKEY_GEN, KEY_ECDSA)))
|
||||
if (lib->plugins->has_feature(lib->plugins,
|
||||
PLUGIN_DEPENDS(PRIVKEY_GEN, KEY_ECDSA)))
|
||||
{
|
||||
srunner_add_suite(sr, ecdsa_suite_create());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user