1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 12:26:40 +02:00

tests/scripts: make tests fail if a compiled scripting plugin fails to load

This commit is contained in:
Sébastien Helleu
2024-03-17 13:45:39 +01:00
parent 1f47e7c4f8
commit c516ff64f2
3 changed files with 51 additions and 4 deletions
+25 -4
View File
@@ -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