Sample engine build featuring 92/73592/3
authorDongsun Lee <ds73.lee@samsung.com>
Thu, 9 Jun 2016 00:03:02 +0000 (09:03 +0900)
committerKyungwook Tak <k.tak@samsung.com>
Thu, 9 Jun 2016 05:01:52 +0000 (14:01 +0900)
Change-Id: If874c62e3cb6de543a14b9fe37c5900b5d91f149
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
packaging/csr-framework.spec
test/CMakeLists.txt
test/internals/CMakeLists.txt
test/internals/test-main.cpp

index dff9141..817b7d8 100644 (file)
@@ -20,6 +20,8 @@
 %define with_detailed_base_url 0
 %define detailed_base_url %nil
 
+%define with_sample_engine 0
+
 Summary: A general purpose content screening and reputation solution
 Name: csr-framework
 Version: 2.0.0
@@ -168,6 +170,11 @@ test program of csr-framework
 %if 0%{?with_detailed_base_url}
     -DDETAILED_URL_BASE:STRING=%{detailed_base_url} \
 %endif
+%if 0%{?with_sample_engine}
+    -DWITH_SAMPLE_ENGINE:BOOL=ON \
+%else
+    -DWITH_SAMPLE_ENGINE:BOOL=OFF \
+%endif
 %if "%{platform_version}" == "3.0"
     -DPLATFORM_VERSION_3:BOOL=ON
 %else
@@ -190,9 +197,11 @@ cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}
 cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}.BSL-1.0
 cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-client
 cp LICENSE %{buildroot}%{ro_data_dir}/license/lib%{name}-common
+
 cp LICENSE %{buildroot}%{ro_data_dir}/license/%{name}-test
 cp LICENSE.BSL-1.0 %{buildroot}%{ro_data_dir}/license/%{name}-test.BSL-1.0
 
+
 mkdir -p %{buildroot}%{rw_db_dir}
 mkdir -p %{buildroot}%{ro_db_dir}
 cp data/scripts/*.sql %{buildroot}%{ro_db_dir}
@@ -316,6 +325,8 @@ fi
 %attr(-, %{service_user}, %{service_group}) %{test_dir}/*
 
 # sample engine related files
+%if 0%{?with_sample_engine}
 %{engine_dir}/lib%{service_name}-cs-engine.so
 %{engine_dir}/lib%{service_name}-wp-engine.so
 %attr(-, %{service_user}, %{service_group}) %{engine_rw_working_dir}/*
+%endif
index 2ee2f91..51bff22 100755 (executable)
@@ -17,7 +17,9 @@
 # @brief       build test program of csr-framework
 #
 ####################### sample engine #########################
-ADD_SUBDIRECTORY(engine)
+IF (WITH_SAMPLE_ENGINE)
+       ADD_SUBDIRECTORY(engine)
+ENDIF (WITH_SAMPLE_ENGINE)
 ###############################################################
 
 FIND_PACKAGE(Threads REQUIRED)
index cd135ce..ecf0752 100644 (file)
@@ -28,6 +28,16 @@ PKG_CHECK_MODULES(${TARGET_CSR_INTERNAL_TEST}_DEP
        pkgmgr-info
 )
 
+IF (WITH_SAMPLE_ENGINE)
+       ADD_DEFINITIONS("-DWITH_SAMPLE_ENGINE")
+       SET(SAMPLE_ENGINE_LINKED_SRCS
+               test-cs-loader.cpp
+               test-wp-loader.cpp
+               test-api-engine-content-screening.cpp
+               test-api-engine-web-protection.cpp
+       )
+ENDIF (WITH_SAMPLE_ENGINE)
+
 SET(${TARGET_CSR_INTERNAL_TEST}_SRCS
        ${CSR_FW_SRC_PATH}/common/exception.cpp
        ${CSR_FW_SRC_PATH}/db/connection.cpp
@@ -45,13 +55,11 @@ SET(${TARGET_CSR_INTERNAL_TEST}_SRCS
        test-db.cpp
        test-cpucore.cpp
        test-file-system.cpp
-       test-api-engine-content-screening.cpp
-       test-api-engine-web-protection.cpp
-       test-cs-loader.cpp
-       test-wp-loader.cpp
        test-package-info.cpp
 
        test-main.cpp
+
+       ${SAMPLE_ENGINE_LINKED_SRCS}
 )
 
 INCLUDE_DIRECTORIES(
@@ -75,6 +83,7 @@ SET_TARGET_PROPERTIES(${TARGET_CSR_INTERNAL_TEST}
                LINK_FLAGS "-pie -Wl,-rpath,${ENGINE_DIR}"
 )
 
+IF (WITH_SAMPLE_ENGINE)
 TARGET_LINK_LIBRARIES(${TARGET_CSR_INTERNAL_TEST}
        ${TARGET_CSR_TEST_COMMON}
        ${TARGET_CSR_COMMON}
@@ -84,5 +93,14 @@ TARGET_LINK_LIBRARIES(${TARGET_CSR_INTERNAL_TEST}
        -lboost_unit_test_framework
        -ldl
 )
+ELSE (WITH_SAMPLE_ENGINE)
+TARGET_LINK_LIBRARIES(${TARGET_CSR_INTERNAL_TEST}
+       ${TARGET_CSR_TEST_COMMON}
+       ${TARGET_CSR_COMMON}
+       ${${TARGET_CSR_INTERNAL_TEST}_DEP_LIBRARIES}
+       -lboost_unit_test_framework
+       -ldl
+)
+ENDIF (WITH_SAMPLE_ENGINE)
 
 INSTALL(TARGETS ${TARGET_CSR_INTERNAL_TEST} DESTINATION ${BIN_DIR})
index 2483018..9ba5318 100644 (file)
@@ -39,6 +39,9 @@ struct TestConfig {
        }
 };
 
+BOOST_GLOBAL_FIXTURE(TestConfig)
+
+#ifdef WITH_SAMPLE_ENGINE
 bool isEngineInitialized = false;
 struct Initializer {
        Initializer()
@@ -79,5 +82,5 @@ struct Initializer {
        }
 };
 
-BOOST_GLOBAL_FIXTURE(TestConfig)
 BOOST_GLOBAL_FIXTURE(Initializer)
+#endif