From d342cde22c3ae936f5f9d3831ff425ecef7d28e5 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Tue, 16 Sep 2014 10:09:46 -0500 Subject: [PATCH] Improve error message when failing to activate a plugin. Also fix a unit test helper script that checks plugin availability. --- src/main.cc | 8 +++++++- testing/scripts/has-writer | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.cc b/src/main.cc index ddd65fafd5..55afe34c79 100644 --- a/src/main.cc +++ b/src/main.cc @@ -850,9 +850,15 @@ int main(int argc, char** argv) file_mgr->InitPreScript(); broxygen_mgr->InitPreScript(); + bool missing_plugin = false; + for ( set::const_iterator i = requested_plugins.begin(); i != requested_plugins.end(); i++ ) - plugin_mgr->ActivateDynamicPlugin(*i); + if ( ! plugin_mgr->ActivateDynamicPlugin(*i) ) + missing_plugin = true; + + if ( missing_plugin ) + reporter->FatalError("Failed to activate requested dynamic plugins."); plugin_mgr->ActivateDynamicPlugins(! bare_mode); diff --git a/testing/scripts/has-writer b/testing/scripts/has-writer index 4c5f38a6bb..d6cdf28d12 100755 --- a/testing/scripts/has-writer +++ b/testing/scripts/has-writer @@ -3,4 +3,4 @@ # Returns true if Bro has been compiled with support for writer type # $1. The type name must match the plugin name that "bro -N" prints. -bro -N $1 >/dev/null +bro -N | grep -q $1 >/dev/null