Add one boost-based binary with all tests 83/234783/9
authorDariusz Michaluk <d.michaluk@samsung.com>
Thu, 28 May 2020 13:42:11 +0000 (15:42 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 6 Jul 2020 09:59:38 +0000 (11:59 +0200)
Change-Id: I23e3cf160e2e4fdf0f7dd95dafd366a0a35babd4

README.md
packaging/device-certificate-manager.spec
tests/CMakeLists.txt
tests/api_test.cpp
tests/device_certificate_manager_tests.cpp [new file with mode: 0644]

index f684e22..6b1deb5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ The DCM daemon does not need to be modified.
 
 ##Testing
 There is currently one general testing application and one KONAI SE specific tool:
-- *dcm_api_test*
+- *device-certificate-manager-tests*
 Testing application should be executed after implementing changes to the DCM or to the DCM backend repository.
 
 There is also one KONAI SE specific tool: *dcm_konaise_tool* used to test the KONAI SE backend implementation.
index 77b2120..6440ea5 100644 (file)
@@ -125,4 +125,4 @@ fi
 %files tests
 %manifest %{name}.manifest
 %license LICENSE
-%{_bindir}/dcm_api_test
+%{_bindir}/device-certificate-manager-tests
index 52995a2..7456e3a 100644 (file)
@@ -27,11 +27,15 @@ INCLUDE_DIRECTORIES(../src/dcm-client)
 ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
 ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
 
-ADD_EXECUTABLE(dcm_api_test api_test.cpp)
-TARGET_LINK_LIBRARIES(dcm_api_test
-       device-certificate-manager
-       ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
+SET(TARGET_TESTS "device-certificate-manager-tests")
+ADD_EXECUTABLE(${TARGET_TESTS}
+       device_certificate_manager_tests.cpp
+       api_test.cpp)
+
+TARGET_LINK_LIBRARIES(${TARGET_TESTS}
+       ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}
+       device-certificate-manager)
 
 INSTALL(TARGETS
-       dcm_api_test
+       ${TARGET_TESTS}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
index c06e027..29a3696 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2017 - 2018 Samsung Electronics All Rights Reserved.
+ * Copyright 2017 - 2020 Samsung Electronics 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.
@@ -16,9 +16,6 @@
  *
  ******************************************************************/
 
-#define BOOST_TEST_MODULE HW API test
-
-#include "device_certificate_manager.h"
 #include <iostream>
 #include <iomanip>
 #include <cstring>
 #include <boost/algorithm/hex.hpp>
 #include <boost/test/unit_test.hpp>
 
+#include "device_certificate_manager.h"
+
+BOOST_AUTO_TEST_SUITE(API_TEST)
+
 BOOST_AUTO_TEST_CASE(test01_dcm_create_key_context)
 {
     void *ctx;
@@ -184,3 +185,5 @@ BOOST_AUTO_TEST_CASE(test05_dcm_create_signature)
 
     free(signature);
 }
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/device_certificate_manager_tests.cpp b/tests/device_certificate_manager_tests.cpp
new file mode 100644 (file)
index 0000000..7d069f6
--- /dev/null
@@ -0,0 +1,36 @@
+/******************************************************************
+ *
+ * Copyright 2020 Samsung Electronics 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.
+ *
+ ******************************************************************/
+
+#define BOOST_TEST_MODULE DeviceCertificateManagerTests
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/unit_test_log.hpp>
+#include <boost/test/results_reporter.hpp>
+
+struct TestConfig {
+       TestConfig()
+       {
+               boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_test_units);
+               boost::unit_test::results_reporter::set_level(boost::unit_test::SHORT_REPORT);
+       }
+       ~TestConfig()
+       {
+       }
+};
+
+BOOST_GLOBAL_FIXTURE(TestConfig);