From b51458014a4aee0b4a3b7543d2415e25c481d472 Mon Sep 17 00:00:00 2001 From: Sirma Date: Thu, 28 Apr 2016 17:35:26 -0400 Subject: [PATCH] Service utils test changes --- .../testing/libs-to-dynamically-load.json | 4 ---- soa/service/testing/service_utils_test.cc | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) delete mode 100644 soa/service/testing/libs-to-dynamically-load.json diff --git a/soa/service/testing/libs-to-dynamically-load.json b/soa/service/testing/libs-to-dynamically-load.json deleted file mode 100644 index 4a0a58b18..000000000 --- a/soa/service/testing/libs-to-dynamically-load.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../bin/libcustom_preload_2.so", - "../bin/libcustom_preload_3" -] diff --git a/soa/service/testing/service_utils_test.cc b/soa/service/testing/service_utils_test.cc index a2e4a61db..2a8e70570 100644 --- a/soa/service/testing/service_utils_test.cc +++ b/soa/service/testing/service_utils_test.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -33,11 +34,22 @@ BOOST_AUTO_TEST_CASE( test_service_utils_preload ) else build_path = getenv("BIN"); - const string buildOptions(build_path + "/libcustom_preload_1.so," - "soa/service/testing/libs-to-dynamically-load"); + const char * test_file = "soa/service/testing/libs-to-dynamically-load"; + const char * test_file_with_extension = "soa/service/testing/libs-to-dynamically-load.json"; + const string buildOptions(build_path + "/libcustom_preload_1.so," + test_file); const string envOptions(build_path + "/libcustom_preload_4"); const string RtbkitPreload("RTBKIT_PRELOAD"); + // TEST FILE CREATION + std::remove(test_file_with_extension); + ofstream of(test_file_with_extension); + of << "[\n"; + of << "\t\"" << build_path << "/libcustom_preload_2.so\",\n"; + of << "\t\"" << build_path << "/libcustom_preload_3\"\n"; + of << "]"; + of.close(); + + BOOST_REQUIRE_EQUAL(TEST::DynamicLoading::custom_lib_1,0); BOOST_REQUIRE_EQUAL(TEST::DynamicLoading::custom_lib_2,0); BOOST_REQUIRE_EQUAL(TEST::DynamicLoading::custom_lib_3,0); @@ -52,4 +64,7 @@ BOOST_AUTO_TEST_CASE( test_service_utils_preload ) BOOST_REQUIRE_EQUAL(TEST::DynamicLoading::custom_lib_2,1); BOOST_REQUIRE_EQUAL(TEST::DynamicLoading::custom_lib_3,1); BOOST_REQUIRE_EQUAL(TEST::DynamicLoading::custom_lib_4,1); + + // TEST FILE REMOVAL + std::remove(test_file_with_extension); }