diff options
-rw-r--r-- | .travis.yml | 38 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | bindings/python/CMakeLists.txt | 20 | ||||
-rw-r--r-- | parameter/SelectionCriterionRule.cpp | 3 | ||||
-rw-r--r-- | skeleton-subsystem/SkeletonSubsystem.h | 2 | ||||
-rw-r--r-- | skeleton-subsystem/SkeletonSubsystemObject.cpp | 6 | ||||
-rw-r--r-- | tools/bash_completion/CMakeLists.txt | 30 | ||||
-rw-r--r-- | tools/bash_completion/remote-process | 131 | ||||
-rwxr-xr-x | tools/coverage/coverage.py | 12 |
10 files changed, 225 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d5e8b75 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,38 @@ +language: cpp +compiler: + - gcc +# - clang # not supported yet + +# install SWIG for bindings generation +before_install: + - sudo apt-get update -qq + - sudo apt-get install -y swig + +# how to build +script: + - cmake . && make -j && sudo make install + - make test + - cd skeleton-subsystem + - cmake . && make && sudo make install + +notifications: + email: + - david.wagner@intel.com + irc: + - "chat.freenode.net#parameter-framework" + +env: + global: + # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created + # via the "travis encrypt" command using the project repo's public key + - secure: "Y+iKBg65e4dleuMwxAo1XSl/QkF4AtCe35ltu2DhPbeMJCywBmu0aeDb04oEaZJL+BxP+KMoRqRjeoGI3W/sh0gAq03iQ+P4C8KwRb9fdYPPVwH3NP3fyN27gFBH9GS8uMth68o2KP/oO/aqNwii/KbMZtubp7MhY/wnvz4DLCQ=" + +addons: + coverity_scan: + project: + name: "dawagner/parameter-framework" + description: "Plugin-based and rule-based framework for managing parameters" + notification_email: david.wagner@intel.com + build_command_prepend: "cmake ." + build_command: "make -j 12" + branch_pattern: coverity_scan diff --git a/CMakeLists.txt b/CMakeLists.txt index 847d606..696e4a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ enable_testing() add_subdirectory(test/test-platform) add_subdirectory(test/test-fixed-point-parameter) +add_subdirectory(tools/bash_completion) add_subdirectory(tools/xmlGenerator) add_subdirectory(tools/xmlValidator) @@ -1,5 +1,7 @@ # parameter-framework +[![Build Status](https://travis-ci.org/01org/parameter-framework.svg?branch=master)](https://travis-ci.org/01org/parameter-framework) + ## Introduction The parameter-framework is a plugin-based and rule-based framework for handling diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index e9016b1..c159d96 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -26,25 +26,25 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FIND_PACKAGE(SWIG REQUIRED) -INCLUDE(${SWIG_USE_FILE}) +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) -FIND_PACKAGE(PythonLibs) -INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) +find_package(PythonLibs) +include_directories(${PYTHON_INCLUDE_PATH}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -SET_SOURCE_FILES_PROPERTIES(pfw.i PROPERTIES CPLUSPLUS ON) -SET_SOURCE_FILES_PROPERTIES(pfw.i PROPERTIES SWIG_FLAGS "-v" "-Wall" "-Werror") +set_property(SOURCE pfw.i PROPERTY CPLUSPLUS ON) +set_property(SOURCE pfw.i PROPERTY SWIG_FLAGS "-Wall" "-Werror") -SWIG_ADD_MODULE(PyPfw python pfw.i) -SWIG_LINK_LIBRARIES(PyPfw parameter ${PYTHON_LIBRARIES}) +swig_add_module(PyPfw python pfw.i) +swig_link_libraries(PyPfw parameter ${PYTHON_LIBRARIES}) include(FindPythonLibs) if(NOT PYTHONLIBS_FOUND) message(SEND_ERROR "python librarires not found. please instal python development packages") -endif(NOT PYTHONLIBS_FOUND) +endif() include_directories(${PROJECT_SOURCE_DIR}/parameter/include ${PYTHON_INCLUDE_DIRS}) diff --git a/parameter/SelectionCriterionRule.cpp b/parameter/SelectionCriterionRule.cpp index b6df7aa..c376bb3 100644 --- a/parameter/SelectionCriterionRule.cpp +++ b/parameter/SelectionCriterionRule.cpp @@ -106,7 +106,8 @@ bool CSelectionCriterionRule::parse(CRuleParser& ruleParser, string& strError) // Value if (!_pSelectionCriterion->getCriterionType()->getNumericalValue(strValue, _iMatchValue)) { - strError = "Value error: " + strError; + strError = "Value error: \"" + strValue + "\" is not part of criterion \"" + + _pSelectionCriterion->getCriterionName() + "\""; return false; } diff --git a/skeleton-subsystem/SkeletonSubsystem.h b/skeleton-subsystem/SkeletonSubsystem.h index 6f1af19..26cd659 100644 --- a/skeleton-subsystem/SkeletonSubsystem.h +++ b/skeleton-subsystem/SkeletonSubsystem.h @@ -34,7 +34,7 @@ class CSkeletonSubsystem : public CSubsystem { public: - CSkeletonSubsystem(const string& strName); + CSkeletonSubsystem(const std::string& strName); }; diff --git a/skeleton-subsystem/SkeletonSubsystemObject.cpp b/skeleton-subsystem/SkeletonSubsystemObject.cpp index 5c251db..5ecded9 100644 --- a/skeleton-subsystem/SkeletonSubsystemObject.cpp +++ b/skeleton-subsystem/SkeletonSubsystemObject.cpp @@ -43,6 +43,8 @@ #define base CFormattedSubsystemObject +using std::string; + CSkeletonSubsystemObject::CSkeletonSubsystemObject( const string& strMappingValue, CInstanceConfigurableElement* pInstanceConfigurableElement, @@ -105,7 +107,7 @@ bool CSkeletonSubsystemObject::sendToHW(string& strError) blackboardRead(pvValue, _uiScalarSize); // Send here the value - cout << "Sending to HW: " << _strMessage << endl; + std::cout << "Sending to HW: " << _strMessage << std::endl; } return true; @@ -122,7 +124,7 @@ bool CSkeletonSubsystemObject::receiveFromHW(string& strError) for (uiIndex = 0 ; uiIndex < _uiArraySize ; uiIndex++) { // Retreive here the value - cout << "Retreive from HW: " << _strMessage << endl; + std::cout << "Retreive from HW: " << _strMessage << std::endl; // Write Value in Blackboard blackboardWrite(pvValue, _uiScalarSize); diff --git a/tools/bash_completion/CMakeLists.txt b/tools/bash_completion/CMakeLists.txt new file mode 100644 index 0000000..9e66d57 --- /dev/null +++ b/tools/bash_completion/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (c) 2014, Intel Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +INSTALL(FILES remote-process + DESTINATION etc/bash_completion.d/) diff --git a/tools/bash_completion/remote-process b/tools/bash_completion/remote-process new file mode 100644 index 0000000..c1b55bf --- /dev/null +++ b/tools/bash_completion/remote-process @@ -0,0 +1,131 @@ +# Copyright (c) 2014, Intel Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# bash completion for remote-process +# +# Execute this file in bash with the built-in command "source", +# it will add autocompletion to remote-process. +# +# To permanently add this autocompletion, add "source this_file" +# in your .bashrc or copy this file in /etc/bash_completion.d/ + +function _remote-process () +{ + # Get current word + local cur prev words cword; + _init_completion || return; + + local options="" + if [ $cword -eq 1 ] + then # Completing the hostname + _known_hosts_real "$cur"; return + elif [ $cword -eq 2 ] # Completing tcp port + then + options='5000 5001 5008 5009 5019'; + else + _remoteProcessWrapper () { + "${words[0]}" "${words[1]}" "${words[2]}" "$@" |sed 's#\r##;/^$/d' + } + + # Get usage + local _parameterHelp=$(_remoteProcessWrapper help) + + if [ $cword -eq 3 ] + then # Completing command + options=$(echo "$_parameterHelp" | awk '{print $1}') + else # Completing command argument + local command=${words[3]} + + # Get current command argument types + # - keep in the help text only the line describing current command + # - delete => and posterior + # - replace space in balisa (<...>) by underscore then delete [<>] + local argumentTypes=$( echo "$_parameterHelp" | grep "$command" |\ + sed -e 's# *=>.*##' -e 's#^[^ ]* *##' \ + -e 's/> />#/g' -e 's# #_#g' -e 's/>#/> /g' -e 's#[<>]##g' ) + + local currentArgumentType=$(echo $argumentTypes | + awk '{print $('$cword'-3)}') + + # Take care of argument list type if it is the last argument + # Ex : setElementSequence <domain> <configuration> <elem path list> + if [ "$currentArgumentType" = "" ] && + expr "$argumentTypes" : '.*list' > /dev/null ; + then + # Set last argument type specified as the current type + currentArgumentType=$(echo "$argumentTypes" | awk '{print $NF}') + fi + + + case "${currentArgumentType}" in + elem_path*|param_path* ) + local incompletPath=$(echo "${cur}" | sed 's#[^/]*$##') + + local parameterCommand + if [ "$currentArgumentType" = elem_path_list ]; + then + # <elem path list> is the parameter path list + # of the domain specified by the second argument + parameterCommand="listDomainElements ${words[4]}" + else + # Otherwise suggest all parameter paths + parameterCommand="listParameters" + fi + # Get paths and delete everything after the first "/" + # following the current input (see complete -o filenames) + local options=$(_remoteProcessWrapper $parameterCommand ${incompletPath:-/} | + sed -re "s#(/?${incompletPath}[^/ ]*/?).*#\1#") + compopt -o filenames + + # If some options are folders, do not append a space + test "$(echo "$options" | sed '/[^/]$/d')" && compopt -o nospace + ;; + domain) + # Get all domain names + options=$(_remoteProcessWrapper listDomains | awk '{print $1}') + ;; + configuration) + # Get all configurations of the domain specified by + # the second argument. + # TODO: find the domain position using $argumentTypes + options=$(_remoteProcessWrapper listConfigurations "${words[4]}") + ;; + *\|*) + # Possible arguments are separated by "|". Ex : on|off + options=$(echo $currentArgumentType | sed -e 's#|# #g' -e 's#\*##g') + ;; + file_path) + _filedir; + ;; + esac + fi + fi + COMPREPLY+=( $(compgen -W "$options" -- "$cur") ) + + unset _remoteProcessWrapper +} && complete -F _remote-process remote-process diff --git a/tools/coverage/coverage.py b/tools/coverage/coverage.py index 0b9dd4c..1df02ae 100755 --- a/tools/coverage/coverage.py +++ b/tools/coverage/coverage.py @@ -204,14 +204,14 @@ class Element(): str(dumpedDescription) for dumpedDescription in self._dumpDescription(withCoverage, withNbUse)) - def exportToXML(self, domElement=None): + def exportToXML(self, document, domElement=None): if domElement == None: - domElement = xml.dom.minidom.Element(self.tag) + domElement = document.createElement(self.tag) self._XMLaddAttributes(domElement) for child in self.children : - domElement.appendChild(child.exportToXML()) + domElement.appendChild(child.exportToXML(document)) return domElement @@ -877,10 +877,10 @@ class Root(Element): def exportToXML(self): """Export tree to an xml document""" impl = xml.dom.minidom.getDOMImplementation() - newdoc = impl.createDocument(namespaceURI=None, qualifiedName=self.tag, doctype=None) - super().exportToXML(newdoc.documentElement) + document = impl.createDocument(namespaceURI=None, qualifiedName=self.tag, doctype=None) + super().exportToXML(document, document.documentElement) - return newdoc + return document # ============================ # Command line argument parser |