Small fixes and enhancements
authorPiotr Bartosiewicz <p.bartosiewi@partner.samsung.com>
Wed, 12 Mar 2014 12:58:54 +0000 (13:58 +0100)
committerJan Olszak <j.olszak@samsung.com>
Mon, 19 May 2014 11:47:14 +0000 (13:47 +0200)
[Issue#]        N/A
[Bug/Feature]   N/A
[Cause]         N/A
[Solution]      N/A
[Verification]  Build, install, run tests

Change-Id: Ibfdfc5a15826e53af0cf734054837121a1539121

CMakeLists.txt
packaging/security-containers.spec
src/server/config/daemon.json [moved from src/server/config/.daemon.json with 100% similarity]
src/server/include/scs-configuration.hpp
src/server/include/scs-exception.hpp
src/server/src/scs-container.cpp
src/server/unit_tests/ut-main.cpp
src/server/unit_tests/ut-scs-configuration.cpp
src/server/unit_tests/ut-scs-container.cpp
src/server/unit_tests/ut.hpp [new file with mode: 0644]

index 154f3fa..3172cac 100644 (file)
@@ -33,6 +33,7 @@ CONFIGURE_FILE(security-containers.pc.in security-containers.pc @ONLY)
 
 
 ## Compiler flags, depending on the build type #################################
+MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg")
 SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++0x -O0 -pg")
 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
@@ -43,9 +44,11 @@ SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++0x -O2 --coverage")
 
 ADD_DEFINITIONS("-fPIC")   # Position Independent Code
-ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
+ADD_DEFINITIONS("-Werror") # Make all warnings into errors
 ADD_DEFINITIONS("-Wall")   # Generate all warnings
 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
+ADD_DEFINITIONS("-pedantic") # Be pedantic
+ADD_DEFINITIONS("-pedantic-errors") # Make pedantic warnings into errors
 
 
 ## Subdirectories ##############################################################
@@ -62,7 +65,7 @@ INSTALL(FILES       ${CLIENT_FOLDER}/include/security-containers-client.h
 INSTALL(FILES       ${CMAKE_BINARY_DIR}/security-containers.pc
         DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
-INSTALL(FILES       ${SERVER_FOLDER}/config/.daemon.json
+INSTALL(FILES       ${SERVER_FOLDER}/config/daemon.json
         DESTINATION /etc/security-containers/config/)
 
 INSTALL(FILES       ${SERVER_FOLDER}/config/libvirt-config/xminimal.xml
index 30953e8..4f355fd 100644 (file)
@@ -18,7 +18,7 @@ between them. A process from inside a container can request a switch of context
 
 %files
 %attr(755,root,root) %{_bindir}/security-containers-server
-%config %attr(644,root,root) /etc/security-containers/config/.daemon.json
+%config %attr(644,root,root) /etc/security-containers/config/daemon.json
 %config %attr(400,root,root) /etc/security-containers/config/libvirt-config/*.xml
 
 %prep
@@ -26,9 +26,8 @@ between them. A process from inside a container can request a switch of context
 
 %build
 %cmake . -DVERSION=%{version} \
-         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
-         -DCMAKE_VERBOSE_MAKEFILE=ON
-make %{?jobs:-j%jobs}
+         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE}
+make -k %{?jobs:-j%jobs}
 
 %install
 %make_install
index df659dd..785dc91 100644 (file)
@@ -62,7 +62,7 @@ enum class ConfigProcessMode : int
                                     writeSubObj(obj, name, #name);
 
 /**
-    @breief Override this abstract class to enable reading/writing a class members from/to JSON
+    @brief Override this abstract class to enable reading/writing a class members from/to JSON
     format. Use the macros above to define config class. For example:
 
     struct Foo : public ConfigurationBase
@@ -97,7 +97,7 @@ public:
     /**
      * Parse config object from a string.
      * This method throws ConfigException when fails.
-     * @param   string      JSON string to be parsed
+     * @param   str      JSON string to be parsed
      */
     void parseStr(const std::string& str);
 
@@ -118,7 +118,7 @@ public:
     /**
      * Write cofig object to a file (in JSON format).
      * This method throws ConfigException when fails.
-     * @return  path        Target file path
+     * @param  path        Target file path
      */
     void saveToFile(const std::string& path) const;
 
index 4ecf63e..c51f699 100644 (file)
@@ -35,7 +35,7 @@ namespace security_containers {
  */
 struct ServerException: public std::runtime_error {
     ServerException(const std::string& mess = "Security Containers Server Exception"):
-        std::runtime_error(mess) {};
+        std::runtime_error(mess) {}
 };
 
 /**
@@ -43,7 +43,7 @@ struct ServerException: public std::runtime_error {
  */
 struct ConnectionException: public ServerException {
     ConnectionException(const std::string& mess = "Security Containers Connection Exception"):
-        ServerException(mess) {};
+        ServerException(mess) {}
 };
 
 /**
@@ -52,7 +52,7 @@ struct ConnectionException: public ServerException {
  */
 struct DomainOperationException: public ServerException {
     DomainOperationException(const std::string& mess = "Security Containers Domain Operation Exception"):
-        ServerException(mess) {};
+        ServerException(mess) {}
 };
 
 /**
@@ -61,7 +61,7 @@ struct DomainOperationException: public ServerException {
  */
 struct ConfigException: public ServerException {
     ConfigException(const std::string& mess = "Security Containers Configuration Exception"):
-        ServerException(mess) {};
+        ServerException(mess) {}
 };
 
 }
index 4dff0d8..bba0cc2 100644 (file)
@@ -66,7 +66,7 @@ void Container::connect()
         LOGE("Failed to open connection to lxc://");
         throw ConnectionException();
     }
-};
+}
 
 
 void Container::disconnect()
@@ -79,7 +79,7 @@ void Container::disconnect()
         LOGE("Error during unconnecting from libvirt");
     };
     mVir = NULL;
-};
+}
 
 
 void Container::start()
@@ -100,7 +100,7 @@ void Container::start()
         LOGE("Failed to start the container");
         throw DomainOperationException();
     }
-};
+}
 
 
 void Container::stop()
@@ -119,7 +119,7 @@ void Container::stop()
         LOGE("Error during domain stopping");
         throw DomainOperationException();
     }
-};
+}
 
 
 void Container::shutdown()
@@ -166,7 +166,7 @@ void Container::define(const std::string& configXML)
         LOGE("Error during domain defining");
         throw DomainOperationException();
     }
-};
+}
 
 
 void Container::undefine()
@@ -188,7 +188,7 @@ void Container::undefine()
     }
 
     mDom = NULL;
-};
+}
 
 
 void Container::suspend()
@@ -250,4 +250,4 @@ int Container::getState()
     return state;
 }
 
-} // namespace security_containers
\ No newline at end of file
+} // namespace security_containers
index e03a875..2205663 100644 (file)
@@ -24,6 +24,5 @@
  */
 
 
-#define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_MODULE Main
-#include <boost/test/unit_test.hpp>
+#include "ut.hpp"
index 1b9fb78..d646594 100644 (file)
  * @brief   Unit test of ConfigurationBase
  */
 
+#include "ut.hpp"
 #include "scs-configuration.hpp"
 
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-
 using namespace security_containers;
 
 BOOST_AUTO_TEST_SUITE(ConfigSuite)
index a74e9a2..93b8d90 100644 (file)
  * @brief   Unit tests of the Container class
  */
 
+#include "ut.hpp"
 #include "scs-container.hpp"
 #include "scs-exception.hpp"
 
 #include <memory>
 
-#define BOOST_TEST_DYN_LINK
-#include <boost/test/unit_test.hpp>
-
 
 BOOST_AUTO_TEST_SUITE(ContainerSuite)
 
diff --git a/src/server/unit_tests/ut.hpp b/src/server/unit_tests/ut.hpp
new file mode 100644 (file)
index 0000000..7327041
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Bumjin Im <bj.im@samsung.com>
+ *
+ *  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
+ */
+
+/**
+ * @file    ut.hpp
+ * @author  Piotr Bartosiewicz (p.bartosiewi@partner.samsung.com)
+ * @brief   Common unit tests include file
+ */
+
+#ifndef SECURITY_CONTAINERS_UT_HPP
+#define SECURITY_CONTAINERS_UT_HPP
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+
+#endif //SECURITY_CONTAINERS_UT_HPP