mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 07:16:37 +02:00
tests/scripts: make tests fail if a compiled scripting plugin fails to load
This commit is contained in:
@@ -63,6 +63,7 @@ Bug fixes::
|
||||
Tests::
|
||||
|
||||
* core: add tests on mouse events (issue #2082)
|
||||
* scripts: make tests fail if a compiled scripting plugin fails to load
|
||||
* scripts: add tests on constants
|
||||
|
||||
Build::
|
||||
|
||||
@@ -22,6 +22,31 @@ enable_language(CXX)
|
||||
remove_definitions(-DHAVE_CONFIG_H)
|
||||
include_directories(${CPPUTEST_INCLUDE_DIRS} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
||||
|
||||
if(ENABLE_PYTHON)
|
||||
add_definitions(-DHAVE_PYTHON)
|
||||
endif()
|
||||
if(ENABLE_PERL)
|
||||
add_definitions(-DHAVE_PERL)
|
||||
endif()
|
||||
if(ENABLE_RUBY)
|
||||
add_definitions(-DHAVE_RUBY)
|
||||
endif()
|
||||
if(ENABLE_LUA)
|
||||
add_definitions(-DHAVE_LUA)
|
||||
endif()
|
||||
if(ENABLE_TCL)
|
||||
add_definitions(-DHAVE_TCL)
|
||||
endif()
|
||||
if(ENABLE_GUILE)
|
||||
add_definitions(-DHAVE_GUILE)
|
||||
endif()
|
||||
if(ENABLE_JAVASCRIPT)
|
||||
add_definitions(-DHAVE_JAVASCRIPT)
|
||||
endif()
|
||||
if(ENABLE_PHP)
|
||||
add_definitions(-DHAVE_PHP)
|
||||
endif()
|
||||
|
||||
# unit tests (core)
|
||||
set(LIB_WEECHAT_UNIT_TESTS_CORE_SRC
|
||||
unit/core/test-core-arraylist.cpp
|
||||
|
||||
@@ -127,26 +127,41 @@ TEST(Scripts, API)
|
||||
{
|
||||
char path_testapigen[PATH_MAX], path_testapi[PATH_MAX];
|
||||
char *path_testapi_output_dir, str_command[(PATH_MAX * 2) + 128];
|
||||
char *test_scripts_dir, str_condition[128];
|
||||
char *test_scripts_dir, str_condition[128], str_error[128];
|
||||
struct timeval time_start, time_end;
|
||||
long long diff;
|
||||
const char *ptr_test_scripts_dir;
|
||||
const char *languages[][2] = {
|
||||
#ifdef HAVE_PYTHON
|
||||
{ "python", "py" },
|
||||
#endif
|
||||
#ifdef HAVE_PERL
|
||||
{ "perl", "pl" },
|
||||
#endif
|
||||
#ifdef HAVE_RUBY
|
||||
{ "ruby", "rb" },
|
||||
#endif
|
||||
#ifdef HAVE_LUA
|
||||
{ "lua", "lua" },
|
||||
#endif
|
||||
#ifdef HAVE_TCL
|
||||
{ "tcl", "tcl" },
|
||||
#endif
|
||||
#ifdef HAVE_GUILE
|
||||
{ "guile", "scm" },
|
||||
#endif
|
||||
#ifdef HAVE_JAVASCRIPT
|
||||
{ "javascript", "js" },
|
||||
#endif
|
||||
#ifdef HAVE_PYTHON
|
||||
{ "php", "php" },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
int i, turnoff_memleak;
|
||||
struct t_hdata *hdata;
|
||||
void *plugins;
|
||||
|
||||
|
||||
printf ("...\n");
|
||||
|
||||
ptr_test_scripts_dir = getenv ("WEECHAT_TESTS_SCRIPTS_DIR");
|
||||
@@ -199,12 +214,18 @@ TEST(Scripts, API)
|
||||
/* test the scripting API */
|
||||
for (i = 0; languages[i][0]; i++)
|
||||
{
|
||||
/* test if the plugin is loaded; if not, tests are skipped */
|
||||
/* test if the plugin is loaded */
|
||||
snprintf (str_condition, sizeof (str_condition),
|
||||
"${plugin.name} == %s",
|
||||
languages[i][0]);
|
||||
if (!hdata_search (hdata, plugins, str_condition, NULL, NULL, NULL, 1))
|
||||
continue;
|
||||
{
|
||||
/* plugin not loaded */
|
||||
snprintf (str_error, sizeof (str_error),
|
||||
"Plugin \"%s\" is not loaded",
|
||||
languages[i][0]);
|
||||
FAIL(str_error);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: fix memory leaks in javascript plugin
|
||||
|
||||
Reference in New Issue
Block a user