From c1dee726d51d3dea0d4e5d481b54279a0c7f82c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 13 Apr 2018 20:57:34 +0200 Subject: tests: turn off memory leak detection only when testing javascript API --- tests/scripts/test-scripts.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'tests/scripts') diff --git a/tests/scripts/test-scripts.cpp b/tests/scripts/test-scripts.cpp index 8f325bca1..817d97320 100644 --- a/tests/scripts/test-scripts.cpp +++ b/tests/scripts/test-scripts.cpp @@ -97,12 +97,6 @@ TEST_GROUP(Scripts) void setup() { - /* - * TODO: fix memory leaks in javascript plugin - * and keep memory leak detection enabled - */ - MemoryLeakWarningPlugin::turnOffNewDeleteOverloads(); - api_hook_print = hook_print (NULL, /* plugin */ NULL, /* buffer */ NULL, /* tags */ @@ -116,12 +110,6 @@ TEST_GROUP(Scripts) void teardown() { unhook (api_hook_print); - - /* - * TODO: fix memory leaks in javascript plugin - * and keep memory leak detection enabled - */ - MemoryLeakWarningPlugin::turnOnNewDeleteOverloads(); } }; @@ -148,7 +136,7 @@ TEST(Scripts, API) { "php", "php" }, { NULL, NULL } }; - int i; + int i, turnoff_memleak; printf ("...\n"); @@ -198,6 +186,15 @@ TEST(Scripts, API) /* test the scripting API */ for (i = 0; languages[i][0]; i++) { + /* + * TODO: fix memory leaks in javascript plugin + * and keep memory leak detection enabled + */ + turnoff_memleak = (strcmp (languages[i][0], "javascript") == 0); + + if (turnoff_memleak) + MemoryLeakWarningPlugin::turnOffNewDeleteOverloads(); + api_tests_ok = 0; api_tests_errors = 0; api_tests_count = 0; @@ -260,6 +257,9 @@ TEST(Scripts, API) * and 2 messages when it is unloaded, so total is 4) */ LONGS_EQUAL(0, api_tests_other); + + if (turnoff_memleak) + MemoryLeakWarningPlugin::turnOnNewDeleteOverloads(); } free (path_testapi_output_dir); -- cgit v1.2.3