diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-07-05 21:33:19 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-07-05 21:33:19 +0200 |
commit | 8efbf61e66e30eb2acd3657d27f11d716f3ffe47 (patch) | |
tree | 467f65e79ed619ca4db0d695be1d034cc262b8ac | |
parent | b2fd37df6162ba555e0a2c36357c186b752240be (diff) | |
download | weechat-8efbf61e66e30eb2acd3657d27f11d716f3ffe47.zip |
tests: fix load of plugins in tests after a build with autotools
-rw-r--r-- | tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/tests.cpp | 24 |
2 files changed, 20 insertions, 7 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ee7ed0547..bc1449048 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -76,4 +76,5 @@ add_test(NAME unit WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND tests -v) set_property(TEST unit PROPERTY - ENVIRONMENT "WEECHAT_TESTS_ARGS=-r '/set weechat.plugin.path \"${PROJECT_BINARY_DIR}/src/plugins\"'") + ENVIRONMENT "WEECHAT_TESTS_ARGS=-p;" + "WEECHAT_EXTRA_LIBDIR=${PROJECT_BINARY_DIR}/src") diff --git a/tests/tests.cpp b/tests/tests.cpp index 41a03ca9a..f863e2056 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -39,6 +39,7 @@ extern "C" #include "src/plugins/plugin.h" #include "src/gui/gui-main.h" #include "src/gui/gui-buffer.h" +#include "src/gui/gui-chat.h" extern void gui_main_init (); extern void gui_main_loop (); @@ -125,6 +126,7 @@ main (int argc, char *argv[]) { int rc, length, weechat_argc; char *weechat_tests_args, *args, **weechat_argv; + struct t_gui_buffer *ptr_core_buffer; /* setup environment: English language, no specific timezone */ setenv ("LC_ALL", "en_US.UTF-8", 1); @@ -133,7 +135,7 @@ main (int argc, char *argv[]) /* build arguments for WeeChat */ weechat_tests_args = getenv ("WEECHAT_TESTS_ARGS"); length = strlen (argv[0]) + - 64 + /* -p --dir ... */ + 64 + /* --dir ... */ ((weechat_tests_args) ? 1 + strlen (weechat_tests_args) : 0) + 1; args = (char *)malloc (length); @@ -143,7 +145,7 @@ main (int argc, char *argv[]) return 1; } snprintf (args, length, - "%s -p --dir ./tmp_weechat_test%s%s", + "%s --dir ./tmp_weechat_test%s%s", argv[0], (weechat_tests_args) ? " " : "", (weechat_tests_args) ? weechat_tests_args : ""); @@ -157,11 +159,21 @@ main (int argc, char *argv[]) string_free_split (weechat_argv); free (args); - /* display WeeChat version */ - input_data (gui_buffer_search_main (), "/command core version"); + ptr_core_buffer = gui_buffer_search_main (); - /* auto-load plugins, only from path in option weechat.plugin.path */ - plugin_auto_load (0, NULL, 1, 0, 0); + /* display WeeChat version and directories */ + input_data (ptr_core_buffer, "/command core version"); + input_data (ptr_core_buffer, "/debug dirs"); + + /* auto-load plugins from WEECHAT_EXTRA_LIBDIR if no plugin were loaded */ + if (!weechat_plugins) + { + gui_chat_printf (NULL, + "Auto-loading plugins from path in " + "environment variable WEECHAT_EXTRA_LIBDIR (\"%s\")", + getenv ("WEECHAT_EXTRA_LIBDIR")); + plugin_auto_load (0, NULL, 0, 1, 0); + } /* run all tests */ printf ("\n"); |