This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/#91-rsa_double_free in repository https://gitbox.apache.org/repos/asf/celix.git
commit bd08d2d82980bb9536200e604ed373405c439f03 Author: Pepijn Noltes <[email protected]> AuthorDate: Mon Mar 9 13:57:15 2020 +0100 #91 Refactors rsa tests from cpputest to googletest, split up tests so that they can be run separately and fixes an issue with double frees in libdfi. --- .../remote_service_admin_dfi/CMakeLists.txt | 2 +- .../{test => gtest}/CMakeLists.txt | 10 +- .../{test => gtest}/client.properties.in | 0 .../{test => gtest}/config.properties.in | 0 .../{test => gtest}/server.properties.in | 0 .../remote_service_admin_dfi/gtest/src/main.cc | 26 +++ .../gtest/src/rsa_client_server_tests.cc | 190 +++++++++++++++++++++ .../src/rsa_tests.cpp => gtest/src/rsa_tests.cc} | 74 ++++---- .../{test => gtest}/src/tst_activator.c | 0 .../{test => gtest}/src/tst_service.h | 0 .../test/src/rsa_client_server_tests.cpp | 129 -------------- .../test/src/run_tests.cpp | 26 --- libs/dfi/src/dyn_type.c | 3 +- 13 files changed, 262 insertions(+), 198 deletions(-) diff --git a/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt b/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt index 3aa1936..d15ca97 100644 --- a/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt +++ b/bundles/remote_services/remote_service_admin_dfi/CMakeLists.txt @@ -48,7 +48,7 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI) ) if (ENABLE_TESTING) - add_subdirectory(test) + add_subdirectory(gtest) endif() diff --git a/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt b/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt similarity index 94% rename from bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt rename to bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt index 6355e95..793d167 100644 --- a/bundles/remote_services/remote_service_admin_dfi/test/CMakeLists.txt +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/CMakeLists.txt @@ -36,15 +36,17 @@ target_link_libraries(rsa_dfi_tst_bundle PRIVATE ${CPPUTEST_LIBRARY} calculator_ target_include_directories(rsa_dfi_tst_bundle PRIVATE src) add_executable(test_rsa_dfi - src/run_tests.cpp - src/rsa_tests.cpp - src/rsa_client_server_tests.cpp + src/main.cc + src/rsa_tests.cc + src/rsa_client_server_tests.cc ) target_include_directories(test_rsa_dfi PRIVATE src) -target_link_libraries(test_rsa_dfi PRIVATE CURL::libcurl ${CPPUTEST_LIBRARY} +target_link_libraries(test_rsa_dfi PRIVATE + CURL::libcurl Celix::framework Celix::rsa_common calculator_api + GTest::GTest ) get_property(rsa_bundle_file TARGET rsa_dfi PROPERTY BUNDLE_FILE) diff --git a/bundles/remote_services/remote_service_admin_dfi/test/client.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in similarity index 100% rename from bundles/remote_services/remote_service_admin_dfi/test/client.properties.in rename to bundles/remote_services/remote_service_admin_dfi/gtest/client.properties.in diff --git a/bundles/remote_services/remote_service_admin_dfi/test/config.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in similarity index 100% rename from bundles/remote_services/remote_service_admin_dfi/test/config.properties.in rename to bundles/remote_services/remote_service_admin_dfi/gtest/config.properties.in diff --git a/bundles/remote_services/remote_service_admin_dfi/test/server.properties.in b/bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in similarity index 100% rename from bundles/remote_services/remote_service_admin_dfi/test/server.properties.in rename to bundles/remote_services/remote_service_admin_dfi/gtest/server.properties.in diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/main.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/main.cc new file mode 100644 index 0000000..09731c4 --- /dev/null +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/main.cc @@ -0,0 +1,26 @@ +/** + *Licensed to the Apache Software Foundation (ASF) under one + *or more contributor license agreements. See the NOTICE file + *distributed with this work for additional information + *regarding copyright ownership. The ASF licenses this file + *to you under the Apache License, Version 2.0 (the + *"License"); you may not use this file except in compliance + *with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + *Unless required by applicable law or agreed to in writing, + *software distributed under the License is distributed on an + *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + *specific language governing permissions and limitations + *under the License. + */ + +#include <gtest/gtest.h> + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + int rc = RUN_ALL_TESTS(); + return rc; +} \ No newline at end of file diff --git a/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc new file mode 100644 index 0000000..9c42951 --- /dev/null +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_client_server_tests.cc @@ -0,0 +1,190 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "gtest/gtest.h" +#include <remote_constants.h> +#include <tst_service.h> +#include "celix_api.h" + +extern "C" { + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> + +#include "celix_launcher.h" +#include "framework.h" +#include "remote_service_admin.h" + + static celix_framework_t *serverFramework = NULL; + static celix_bundle_context_t *serverContext = NULL; + + static celix_framework_t *clientFramework = NULL; + static celix_bundle_context_t *clientContext = NULL; + + static void setupFm(void) { + //server + celix_properties_t *serverProps = celix_properties_load("server.properties"); + ASSERT_TRUE(serverProps != NULL); + serverFramework = celix_frameworkFactory_createFramework(serverProps); + ASSERT_TRUE(serverFramework != NULL); + serverContext = celix_framework_getFrameworkContext(serverFramework); + ASSERT_TRUE(serverContext != NULL); + + //client + celix_properties_t *clientProperties = celix_properties_load("client.properties"); + ASSERT_TRUE(clientProperties != NULL); + clientFramework = celix_frameworkFactory_createFramework(clientProperties); + ASSERT_TRUE(clientFramework != NULL); + clientContext = celix_framework_getFrameworkContext(clientFramework); + ASSERT_TRUE(clientContext != NULL); + } + + static void teardownFm(void) { + celix_frameworkFactory_destroyFramework(serverFramework); + celix_frameworkFactory_destroyFramework(clientFramework); + } + + static void testComplex(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool discovered = tst->isRemoteExampleDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + bool ok = tst->testRemoteComplex(tst->handle); + ASSERT_TRUE(ok); + }; + + static void testAction(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool discovered = tst->isRemoteExampleDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + bool ok = tst->testRemoteAction(tst->handle); + ASSERT_TRUE(ok); + }; + + static void testNumbers(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool discovered = tst->isRemoteExampleDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + bool ok = tst->testRemoteNumbers(tst->handle); + ASSERT_TRUE(ok); + }; + + static void testString(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool discovered = tst->isRemoteExampleDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + bool ok = tst->testRemoteString(tst->handle); + ASSERT_TRUE(ok); + }; + + static void testEnum(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool discovered = tst->isRemoteExampleDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + bool ok = tst->testRemoteEnum(tst->handle); + ASSERT_TRUE(ok); + }; + + static void testConstString(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool discovered = tst->isRemoteExampleDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + bool ok = tst->testRemoteConstString(tst->handle); + ASSERT_TRUE(ok); + }; + + static void testCalculator(void *handle __attribute__((unused)), void *svc) { + auto *tst = static_cast<tst_service_t *>(svc); + + bool ok; + + bool discovered = tst->isCalcDiscovered(tst->handle); + ASSERT_TRUE(discovered); + + ok = tst->testCalculator(tst->handle); + ASSERT_TRUE(ok); + }; + +} + +template<typename F> +static void test(F&& f) { + celix_service_use_options_t opts{}; + opts.filter.serviceName = TST_SERVICE_NAME; + opts.use = f; + opts.filter.ignoreServiceLanguage = true; + opts.waitTimeoutInSeconds = 2; + bool called = celix_bundleContext_useServiceWithOptions(clientContext, &opts); + ASSERT_TRUE(called); +} + +class RsaDfiClientServerTests : public ::testing::Test { +public: + RsaDfiClientServerTests() { + setupFm(); + } + ~RsaDfiClientServerTests() override { + teardownFm(); + } + +}; + + +TEST_F(RsaDfiClientServerTests, TestRemoteCalculator) { + test(testCalculator); +} + +TEST_F(RsaDfiClientServerTests, TestRemoteComplex) { + test(testComplex); +} + +TEST_F(RsaDfiClientServerTests, TestRemoteNumbers) { + test(testNumbers); +} + +TEST_F(RsaDfiClientServerTests, TestRemoteString) { + test(testString); +} + +TEST_F(RsaDfiClientServerTests, TestRemoteConstString) { + test(testConstString); +} + +TEST_F(RsaDfiClientServerTests, TestRemoteEnum) { + test(testEnum); +} + +TEST_F(RsaDfiClientServerTests, TestRemoteAction) { + test(testAction); +} diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc similarity index 82% rename from bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp rename to bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc index 334575a..b2fee66 100644 --- a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_tests.cpp +++ b/bundles/remote_services/remote_service_admin_dfi/gtest/src/rsa_tests.cc @@ -17,13 +17,12 @@ * under the License. */ +#include "gtest/gtest.h" + #include <remote_constants.h> #include "celix_api.h" #include "calculator_service.h" -#include <CppUTest/TestHarness.h> -#include <CppUTest/CommandLineTestRunner.h> - extern "C" { #include "remote_service_admin.h" @@ -38,15 +37,15 @@ extern "C" { static void setupFm(void) { celix_properties_t *fwProperties = celix_properties_load("config.properties"); - CHECK_TRUE(fwProperties != NULL); + ASSERT_TRUE(fwProperties != NULL); framework = celix_frameworkFactory_createFramework(fwProperties); - CHECK_TRUE(framework != NULL); + ASSERT_TRUE(framework != NULL); context = celix_framework_getFrameworkContext(framework); - CHECK_TRUE(context != NULL); + ASSERT_TRUE(context != NULL); calcSvcId = celix_bundleContext_findService(context, CALCULATOR_SERVICE); - CHECK_TRUE(calcSvcId >= 0L); + ASSERT_TRUE(calcSvcId >= 0L); } static void teardownFm(void) { @@ -59,12 +58,12 @@ extern "C" { celix_array_list_t *imported = celix_arrayList_create(); int rc = rsa->getExportedServices(rsa->admin, &exported); - CHECK_EQUAL(CELIX_SUCCESS, rc); - CHECK_EQUAL(0, celix_arrayList_size(exported)); + ASSERT_EQ(CELIX_SUCCESS, rc); + ASSERT_EQ(0, celix_arrayList_size(exported)); rc = rsa->getImportedEndpoints(rsa->admin, &imported); - CHECK_EQUAL(CELIX_SUCCESS, rc); - CHECK_EQUAL(0, celix_arrayList_size(imported)); + ASSERT_EQ(CELIX_SUCCESS, rc); + ASSERT_EQ(0, celix_arrayList_size(imported)); celix_arrayList_destroy(imported); celix_arrayList_destroy(exported); @@ -77,7 +76,7 @@ extern "C" { opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 0.25; bool called = celix_bundleContext_useServiceWithOptions(context, &opts); - CHECK_TRUE(called); + ASSERT_TRUE(called); } static void testExportServiceCallback(void *handle __attribute__((unused)), void *svc) { @@ -88,12 +87,12 @@ extern "C" { celix_array_list_t *svcRegistration = NULL; int rc = rsa->exportService(rsa->admin, strSvcId, NULL, &svcRegistration); - CHECK_EQUAL(CELIX_SUCCESS, rc); + ASSERT_EQ(CELIX_SUCCESS, rc); - CHECK_EQUAL(1, celix_arrayList_size(svcRegistration)); + ASSERT_EQ(1, celix_arrayList_size(svcRegistration)); rc = rsa->exportRegistration_close(rsa->admin,(export_registration_t *)(arrayList_get(svcRegistration,0))); - CHECK_EQUAL(CELIX_SUCCESS, rc); + ASSERT_EQ(CELIX_SUCCESS, rc); } @@ -104,7 +103,7 @@ extern "C" { opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 0.25; bool called = celix_bundleContext_useServiceWithOptions(context, &opts); - CHECK_TRUE(called); + ASSERT_TRUE(called); } static void testImportServiceCallback(void *handle __attribute__((unused)), void *svc) { @@ -122,28 +121,28 @@ extern "C" { celix_properties_set(props, OSGI_FRAMEWORK_OBJECTCLASS, "org.apache.celix.Example"); rc = endpointDescription_create(props, &endpoint); - CHECK_EQUAL(CELIX_SUCCESS, rc); + ASSERT_EQ(CELIX_SUCCESS, rc); rc = rsa->importService(rsa->admin, endpoint, ®); - CHECK_EQUAL(CELIX_SUCCESS, rc); - CHECK(reg != NULL); + ASSERT_EQ(CELIX_SUCCESS, rc); + ASSERT_TRUE(reg != NULL); service_reference_pt ref = NULL; rc = bundleContext_getServiceReference(context, (char *)"org.apache.celix.Example", &ref); - CHECK_EQUAL(CELIX_SUCCESS, rc); - CHECK(ref != NULL); + ASSERT_EQ(CELIX_SUCCESS, rc); + ASSERT_TRUE(ref != NULL); rc = bundleContext_ungetServiceReference(context, ref); - CHECK_EQUAL(CELIX_SUCCESS, rc); + ASSERT_EQ(CELIX_SUCCESS, rc); rc = endpointDescription_destroy(endpoint); - CHECK_EQUAL(CELIX_SUCCESS, rc); + ASSERT_EQ(CELIX_SUCCESS, rc); /* Cannot test. uses requesting bundles descriptor void *service = NULL; rc = bundleContext_getService(context, ref, &service); - CHECK_EQUAL(CELIX_SUCCESS, rc); - CHECK(service != NULL); + ASSERT_EQ(CELIX_SUCCESS, rc); + ASSERT_TRUE(service != NULL); */ } @@ -154,15 +153,15 @@ extern "C" { opts.filter.ignoreServiceLanguage = true; opts.waitTimeoutInSeconds = 0.25; bool called = celix_bundleContext_useServiceWithOptions(context, &opts); - CHECK_TRUE(called); + ASSERT_TRUE(called); } static void testBundles(void) { array_list_pt bundles = NULL; int rc = bundleContext_getBundles(context, &bundles); - CHECK_EQUAL(0, rc); - CHECK_EQUAL(3, arrayList_size(bundles)); //framework, rsa_dfi & calc + ASSERT_EQ(0, rc); + ASSERT_EQ(3, arrayList_size(bundles)); //framework, rsa_dfi & calc /* int size = arrayList_size(bundles); @@ -183,29 +182,30 @@ extern "C" { } - -TEST_GROUP(RsaDfiTests) { - void setup() { +class RsaDfiTests : public ::testing::Test { +public: + RsaDfiTests() { setupFm(); } - - void teardown() { + ~RsaDfiTests() override { teardownFm(); } + }; -TEST(RsaDfiTests, InfoTest) { + +TEST_F(RsaDfiTests, InfoTest) { testServices(); } -TEST(RsaDfiTests, ExportService) { +TEST_F(RsaDfiTests, ExportService) { testExportService(); } -TEST(RsaDfiTests, ImportService) { +TEST_F(RsaDfiTests, ImportService) { testImportService(); } -TEST(RsaDfiTests, TestBundles) { +TEST_F(RsaDfiTests, TestBundles) { testBundles(); } diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c b/bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_activator.c similarity index 100% rename from bundles/remote_services/remote_service_admin_dfi/test/src/tst_activator.c rename to bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_activator.c diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h b/bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_service.h similarity index 100% rename from bundles/remote_services/remote_service_admin_dfi/test/src/tst_service.h rename to bundles/remote_services/remote_service_admin_dfi/gtest/src/tst_service.h diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp deleted file mode 100644 index 74f7ef4..0000000 --- a/bundles/remote_services/remote_service_admin_dfi/test/src/rsa_client_server_tests.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - - -#include <remote_constants.h> -#include <tst_service.h> -#include "celix_api.h" - -#include <CppUTest/CommandLineTestRunner.h> -#include <CppUTest/TestHarness.h> - -extern "C" { - -#include <stdio.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <unistd.h> - -#include "celix_launcher.h" -#include "framework.h" -#include "remote_service_admin.h" - - static celix_framework_t *serverFramework = NULL; - static celix_bundle_context_t *serverContext = NULL; - - static celix_framework_t *clientFramework = NULL; - static celix_bundle_context_t *clientContext = NULL; - - static void setupFm(void) { - //server - celix_properties_t *serverProps = celix_properties_load("server.properties"); - CHECK_TRUE(serverProps != NULL); - serverFramework = celix_frameworkFactory_createFramework(serverProps); - CHECK_TRUE(serverFramework != NULL); - serverContext = celix_framework_getFrameworkContext(serverFramework); - CHECK_TRUE(serverContext != NULL); - - //client - celix_properties_t *clientProperties = celix_properties_load("client.properties"); - CHECK_TRUE(clientProperties != NULL); - clientFramework = celix_frameworkFactory_createFramework(clientProperties); - CHECK_TRUE(clientFramework != NULL); - clientContext = celix_framework_getFrameworkContext(clientFramework); - CHECK_TRUE(clientContext != NULL); - } - - static void teardownFm(void) { - celix_frameworkFactory_destroyFramework(serverFramework); - celix_frameworkFactory_destroyFramework(clientFramework); - } - - static void testCallback(void *handle __attribute__((unused)), void *svc) { - auto *tst = static_cast<tst_service_t *>(svc); - - bool ok; - - bool discovered = tst->isCalcDiscovered(tst->handle); - CHECK_TRUE(discovered); - - ok = tst->testCalculator(tst->handle); - CHECK_TRUE(ok); - - discovered = tst->isRemoteExampleDiscovered(tst->handle); - CHECK_TRUE(discovered); - - ok = tst->testRemoteComplex(tst->handle); - CHECK_TRUE(ok); - - ok = tst->testRemoteAction(tst->handle); - CHECK_TRUE(ok); - - ok = tst->testRemoteNumbers(tst->handle); - CHECK_TRUE(ok); - - ok = tst->testRemoteString(tst->handle); - CHECK_TRUE(ok); - - ok = tst->testRemoteConstString(tst->handle); - CHECK_TRUE(ok); - - //TODO fix for apple dfi handling, see issue #91 - //ok = tst->testRemoteEnum(tst->handle); - //CHECK_TRUE(ok); - }; - - static void test(void) { - celix_service_use_options_t opts{}; - opts.filter.serviceName = TST_SERVICE_NAME; - opts.use = testCallback; - opts.filter.ignoreServiceLanguage = true; - opts.waitTimeoutInSeconds = 2; - bool called = celix_bundleContext_useServiceWithOptions(clientContext, &opts); - CHECK_TRUE(called); - } - -} - - -TEST_GROUP(RsaDfiClientServerTests) { - void setup() { - setupFm(); - } - - void teardown() { - teardownFm(); - } -}; - -TEST(RsaDfiClientServerTests, Test1) { - test(); -} diff --git a/bundles/remote_services/remote_service_admin_dfi/test/src/run_tests.cpp b/bundles/remote_services/remote_service_admin_dfi/test/src/run_tests.cpp deleted file mode 100644 index efaee82..0000000 --- a/bundles/remote_services/remote_service_admin_dfi/test/src/run_tests.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <CppUTest/TestHarness.h> -#include "CppUTest/CommandLineTestRunner.h" - -int main(int argc, char** argv) { - MemoryLeakWarningPlugin::turnOffNewDeleteOverloads(); - return RUN_ALL_TESTS(argc, argv); -} \ No newline at end of file diff --git a/libs/dfi/src/dyn_type.c b/libs/dfi/src/dyn_type.c index 09cca39..4f93fb9 100644 --- a/libs/dfi/src/dyn_type.c +++ b/libs/dfi/src/dyn_type.c @@ -679,7 +679,8 @@ void dynType_deepFree(dyn_type *type, void *loc, bool alsoDeleteSelf) { char *text = NULL; switch (type->type) { case DYN_TYPE_REF: - dynType_deepFree(type->ref.ref, loc, alsoDeleteSelf); + //NOTE: do not recursively forward asloDeleteSelf, because this is already handled in this function) + dynType_deepFree(type->ref.ref, loc, false); break; case DYN_TYPE_COMPLEX : dynType_freeComplexType(type, loc);
