remove main function in unittest by using gtest_main
authorYoungjae Shin <yj99.shin@samsung.com>
Fri, 17 Sep 2021 05:30:48 +0000 (14:30 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 22 Sep 2021 22:47:57 +0000 (07:47 +0900)
Change-Id: I19ae4166eb86c241d3820f7dd2b0046107eace4f

subprojects/libbeyond-authenticator_ssl/test/CMakeLists.txt
subprojects/libbeyond-authenticator_ssl/test/unittest.cc [deleted file]
subprojects/libbeyond-generic-capi/test/CMakeLists.txt
subprojects/libbeyond-generic-capi/test/unittest.cc [deleted file]
subprojects/libbeyond-peer_nn/test/CMakeLists.txt
subprojects/libbeyond-peer_nn/test/unittest.cc
subprojects/libbeyond-tizen-capi/ut/CMakeLists.txt
subprojects/libbeyond-tizen-capi/ut/unittest.cc [deleted file]
subprojects/libbeyond/test/CMakeLists.txt
subprojects/libbeyond/test/unittest.cc [deleted file]

index e524e05b17e7a112e90b4f444e67a3c457f3b455..130c14627d0c1c6689474cb9cfede03829e7caaf 100644 (file)
@@ -4,7 +4,7 @@ PROJECT(${NAME}-authenticator_ssl-test CXX)
 
 AUX_SOURCE_DIRECTORY(. TEST_SRCS)
 ADD_EXECUTABLE(${PROJECT_NAME} ${TEST_SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest ${LOG_LIBRARIES} ${BEYOND_LIBRARIES})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest gtest_main ${LOG_LIBRARIES} ${BEYOND_LIBRARIES})
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 ADD_DEPENDENCIES(${PROJECT_NAME} ${DEPENDS_ON_BEYOND})
diff --git a/subprojects/libbeyond-authenticator_ssl/test/unittest.cc b/subprojects/libbeyond-authenticator_ssl/test/unittest.cc
deleted file mode 100644 (file)
index 863d1e7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed 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 <beyond/platform/beyond_platform.h>
-#include <beyond/private/beyond_private.h>
-#include <exception>
-#include <cerrno>
-#include <gtest/gtest.h>
-
-int main(int argc, char *argv[])
-{
-    int result = -1;
-
-    try {
-        testing::InitGoogleTest(&argc, argv);
-    } catch (std::exception &e) {
-        ErrPrint("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue': %s", e.what());
-    }
-
-    try {
-        result = RUN_ALL_TESTS();
-    } catch (std::exception &e) {
-        ErrPrint("catch `testing::internal::GoogleTestFailureException`: %s", e.what());
-    }
-
-    return result;
-}
index 27490873948f0c2ed4fc2cfdadbb25a69e15b679..932b4728b3e1291cf23313cfee484ca9840a62da 100644 (file)
@@ -12,7 +12,7 @@ INCLUDE_DIRECTORIES(
     ${PROJECT_ROOT_DIR}/subprojects/libbeyond-discovery_dns_sd/include
     ${PROJECT_ROOT_DIR}/subprojects/libbeyond-peer_nn/include
 )
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest ${LOG_LIBRARIES} ${NAME}-generic-capi)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest gtest_main ${LOG_LIBRARIES} ${NAME}-generic-capi)
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 ADD_DEPENDENCIES(${PROJECT_NAME} ${NAME}-generic-capi)
diff --git a/subprojects/libbeyond-generic-capi/test/unittest.cc b/subprojects/libbeyond-generic-capi/test/unittest.cc
deleted file mode 100644 (file)
index 863d1e7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed 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 <beyond/platform/beyond_platform.h>
-#include <beyond/private/beyond_private.h>
-#include <exception>
-#include <cerrno>
-#include <gtest/gtest.h>
-
-int main(int argc, char *argv[])
-{
-    int result = -1;
-
-    try {
-        testing::InitGoogleTest(&argc, argv);
-    } catch (std::exception &e) {
-        ErrPrint("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue': %s", e.what());
-    }
-
-    try {
-        result = RUN_ALL_TESTS();
-    } catch (std::exception &e) {
-        ErrPrint("catch `testing::internal::GoogleTestFailureException`: %s", e.what());
-    }
-
-    return result;
-}
index ce40e3d7747480b49ae886cfd6304b908450fd34..1b1977ecc72d647deada186f4702cc83e7c914c6 100644 (file)
@@ -8,7 +8,7 @@ INCLUDE_DIRECTORIES(
 
 AUX_SOURCE_DIRECTORY(. TEST_SRCS)
 ADD_EXECUTABLE(${PROJECT_NAME} ${TEST_SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest ${LOG_LIBRARIES} ${BEYOND_LIBRARIES})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest gtest_main ${LOG_LIBRARIES} ${BEYOND_LIBRARIES})
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 ADD_DEPENDENCIES(${PROJECT_NAME} ${DEPENDS_ON_BEYOND})
index 59034d64c47bf6f7f2b81e8ef4bac7cd889276a0..b8b21a8a42b8d740e79f1a3f4cc3cb5de27b311b 100644 (file)
@@ -312,24 +312,3 @@ const char *GetModelFilename(bool posenet)
     }
     return dirpath;
 }
-
-int main(int argc, char *argv[])
-{
-    int result = -1;
-
-    try {
-        testing::InitGoogleTest(&argc, argv);
-    } catch (std::exception &e) {
-        ErrPrint("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue': %s", e.what());
-    }
-
-    setenv("GST_PLUGIN_PATH", "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/", 1);
-
-    try {
-        result = RUN_ALL_TESTS();
-    } catch (std::exception &e) {
-        ErrPrint("catch `testing::internal::GoogleTestFailureException`: %s", e.what());
-    }
-
-    return result;
-}
index fd19b6c7d1aa2e758a488dda8930126a6452caff..3cd5c455057b7e8df0287759ee88ee29e3607e89 100644 (file)
@@ -10,7 +10,7 @@ INCLUDE_DIRECTORIES(
 
 AUX_SOURCE_DIRECTORY(. TEST_SRCS)
 ADD_EXECUTABLE(${PROJECT_NAME} ${TEST_SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest ${LOG_LIBRARIES} ${NAME}-tizen-capi ${PKGS_LDFLAGS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest gtest_main ${LOG_LIBRARIES} ${NAME}-tizen-capi ${PKGS_LDFLAGS})
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 ADD_DEPENDENCIES(${PROJECT_NAME} ${NAME}-tizen-capi)
diff --git a/subprojects/libbeyond-tizen-capi/ut/unittest.cc b/subprojects/libbeyond-tizen-capi/ut/unittest.cc
deleted file mode 100644 (file)
index 863d1e7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed 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 <beyond/platform/beyond_platform.h>
-#include <beyond/private/beyond_private.h>
-#include <exception>
-#include <cerrno>
-#include <gtest/gtest.h>
-
-int main(int argc, char *argv[])
-{
-    int result = -1;
-
-    try {
-        testing::InitGoogleTest(&argc, argv);
-    } catch (std::exception &e) {
-        ErrPrint("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue': %s", e.what());
-    }
-
-    try {
-        result = RUN_ALL_TESTS();
-    } catch (std::exception &e) {
-        ErrPrint("catch `testing::internal::GoogleTestFailureException`: %s", e.what());
-    }
-
-    return result;
-}
index b969cd56e42d620d265e6d934b9d9b7a5b435d3c..f9c7441c90d4c7b1d911072c4d21b2aaea34cca0 100644 (file)
@@ -9,7 +9,7 @@ INCLUDE_DIRECTORIES(
 
 AUX_SOURCE_DIRECTORY(. TEST_SRCS)
 ADD_EXECUTABLE(${PROJECT_NAME} ${TEST_SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest ${LOG_LIBRARIES} ${BEYOND_LIBRARIES})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} gtest gtest_main ${LOG_LIBRARIES} ${BEYOND_LIBRARIES})
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 ADD_DEPENDENCIES(${PROJECT_NAME} ${DEPENDS_ON_BEYOND})
diff --git a/subprojects/libbeyond/test/unittest.cc b/subprojects/libbeyond/test/unittest.cc
deleted file mode 100644 (file)
index 863d1e7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed 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 <beyond/platform/beyond_platform.h>
-#include <beyond/private/beyond_private.h>
-#include <exception>
-#include <cerrno>
-#include <gtest/gtest.h>
-
-int main(int argc, char *argv[])
-{
-    int result = -1;
-
-    try {
-        testing::InitGoogleTest(&argc, argv);
-    } catch (std::exception &e) {
-        ErrPrint("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue': %s", e.what());
-    }
-
-    try {
-        result = RUN_ALL_TESTS();
-    } catch (std::exception &e) {
-        ErrPrint("catch `testing::internal::GoogleTestFailureException`: %s", e.what());
-    }
-
-    return result;
-}