From 7c2489cc3dc798484e11a449fd0e305210de901b Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周六, 14 12月 2019 20:12:41 +0800
Subject: [PATCH] fix codacy warnings

---
 .travis.yml |  158 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 125 insertions(+), 33 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 1b67b9b..4cbd109 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,10 @@
              - libboost-system-dev
              - libboost-thread-dev
              - libboost-date-time-dev
+     script: 
+         - cmake --build . --target install
+         - ctest
+         - ctest -T memcheck        
    - os: linux
      dist: xenial
      name: "Ubuntu 16.04 - Travis CI VM"
@@ -39,62 +43,150 @@
              - libboost-system-dev
              - libboost-thread-dev
              - libboost-date-time-dev
-
+   - os: linux
+     dist: bionic
+     name: "Ubuntu 18.04 - Travis CI VM - Debug build"
+     addons:
+        apt:
+          packages:
+             - cmake
+             - valgrind
+             - libssl-dev
+             - zlib1g-dev
+             - libboost-dev
+             - libboost-test-dev
+             - libboost-filesystem-dev
+             - libboost-iostreams-dev
+             - libboost-program-options-dev
+             - libboost-system-dev
+             - libboost-thread-dev
+             - libboost-date-time-dev
+             - lcov
+     before_script:
+         - cd build && cmake -DCMAKE_INSTALL_PREFIX=../../install -DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON ..
+     script: 
+         - cmake --build . --target install
+         - ctest
+         - ctest -T memcheck
+     after_success:
+         # Create lcov report
+         - lcov --capture --directory . --output-file coverage.info
+         - lcov --remove coverage.info '/usr/include/*' '*/ini/*' '*/test/*' --output-file coverage.info # filter system-files
+         - lcov --list coverage.info # debug info
+         # Uploading report to CodeCov
+         - bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
+                  
    - os: linux
      dist: bionic
      name: "CentOS-7 Docker"
      before_script: 
         - docker run --name centos7_toconfigure -v `pwd`:/root/open-license-manager centos:centos7 /bin/bash -c 
-            "yum -y update && yum -y install cmake boost boost-devel boost-static openssl openssl-devel gcc-c++ valgrind valgrind-devel glibc-static centos-release-scl-rh && 
-              yum -y install devtoolset-3-gcc devtoolset-3-gcc-c++ && cd /root/open-license-manager && mkdir build && cd build && 
-              CC=/opt/rh/devtoolset-3/root/usr/bin/gcc XX=/opt/rh/devtoolset-3/root/usr/bin/g++ cmake .."
+            "yum -y update && yum -y install install centos-release-scl &&
+              yum -y install wget boost boost-devel boost-static openssl openssl-devel openssl-static glibc-static devtoolset-7-toolchain devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-valgrind-devel &&
+              wget https://cmake.org/files/v3.11/cmake-3.11.0.tar.gz && tar zxvf cmake-3.11.0.tar.gz && cd cmake-3.11.0 &&
+              export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc && export CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ &&  
+              ./bootstrap && make && make install && cd /root/open-license-manager/build && cmake .."
         - docker commit centos7_toconfigure centos7_configured
      script: 
         - docker run --name centos7_make -v `pwd`:/root/open-license-manager centos7_configured /bin/bash -c 
             "cd /root/open-license-manager/build && make && make install && VIRT_ENV=CONTAINER make test"
-            
+#   - os: linux
+#     dist: bionic
+#     name: "CentOS-8 Docker"
+#     before_script: 
+#        - docker run --name centos8_toconfigure -v `pwd`:/root/open-license-manager centos:centos8 /bin/bash -c \
+#            "yum -y update && yum -y groupinstall 'Development Tools' && 
+#             yum -y install wget cmake boost boost-devel openssl-devel zlib-devel && 
+#             dnf -y --enablerepo=PowerTools install boost-static && 
+#             wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz && 
+#             tar xzf OpenSSL_1_1_1d.tar.gz && cd openssl-OpenSSL_1_1_1d && 
+#             ./config && make -j 8 && make install && 
+#             cd /root/open-license-manager/build && cmake .."
+#        - docker commit centos8_toconfigure centos8_configured
+#     script: 
+#        - docker run --name centos8_make -v `pwd`:/root/open-license-manager centos8_configured /bin/bash -c \
+#            "cd /root/open-license-manager/build && make && make install && VIRT_ENV=CONTAINER make test"
+   - os: linux
+     dist: bionic
+     name: "Ubuntu 18.04 - MinGW cross-compile for Windows x64"
+     env:
+        - CTEST_OUTPUT_ON_FAILURE=1      
+        - WINEARCH=win64
+     addons:
+        apt:
+          packages:
+             - cmake 
+             - binutils-mingw-w64 
+             - mingw-w64 
+             - mingw-w64-tools 
+             - mingw-w64-x86-64-dev 
+             - wine64-development
+             - wine64-development-preloader
+             - wine-development
+             - wine64
+             - p7zip-full
+     before_script:
+        - cd build
+        - wget -c https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2
+        - tar xjf boost_1_71_0.tar.bz2
+        - sudo ln -s /usr/bin/x86_64-w64-mingw32-g++ /usr/local/bin/g++-mingw
+        - cd boost_1_71_0
+        - ./bootstrap.sh
+        - travis_wait 30 ./b2 toolset=gcc-mingw target-os=windows address-model=64 --with-date_time --with-test --with-filesystem --with-program_options --with-regex --with-serialization --with-system runtime-link=static --prefix=./dist release install
+        - cd ..
+        - wget --no-check-certificate https://bintray.com/vszakats/generic/download_file?file_path=openssl-1.0.2h-win64-mingw.7z -O openssl.7z
+        - 7z x openssl.7z
+        - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-ubuntu-mingw64.cmake -DCMAKE_INSTALL_PREFIX=../../install -DBOOST_ROOT=$PWD/boost_1_71_0/dist -DOPENSSL_ROOT_DIR=$PWD/openssl-1.0.2h-win64-mingw/ ..
    - os: windows
      name: "Widnows server 1803 - Visual Studio 15 2017 Win64 - (/MD)"
-     env:
-        - CACHE_NAME=boost
-     cache:
-         directories:
-             - "/C/local/boost"
      before_script:
-         - sc stop CryptSvc
-         - travis_wait 30 ./windows_download_boost.bat
-         - cd "/C/Users/travis/build/open-license-manager/open-license-manager"
-         - mkdir build
-         - cd build && cmake -G "Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:/local/boost" ..
-     script:
-          - cmake --build . --target install --config Release
-          - ctest -C Release
+         - travis_wait 40 ./scripts/windows_download_boost.bat
+         - cd "${TRAVIS_BUILD_DIR}/build"
+         - cmake -G "Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:/local/boost" ..
 
    - os: windows
      name: "Widnows server 1803 - Visual Studio 15 2017 Win64 - (/MT)"
+     before_script:
+         - travis_wait 40 ./scripts/windows_download_boost.bat
+         - cd "${TRAVIS_BUILD_DIR}"
+         - cd build && cmake -G "Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:/local/boost" -DSTATIC_RUNTIME=1 ..
+          
+   - os: windows
+     name: "Widnows server 1803 - MinGW Win64"
      env:
-        - CACHE_NAME=boost
+        - CACHE_NAME=boost-mingw
      cache:
+         name: boost-mingw
          directories:
              - "/C/local/boost"
      before_script:
-         #- Regsvr32.exe "C:\Widnows\System32\rsaenh.dll"
-         - travis_wait 30 ./windows_download_boost.bat
-         - cd "/C/Users/travis/build/open-license-manager/open-license-manager"
-         - mkdir build
-         - cd build && cmake -G "Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:/local/boost" -DSTATIC_RUNTIME=1 ..
-     script:
-          - cmake --build . --target install --config Release
-          - ctest -C Release
-           
+         - | 
+           if [ -d "/C/local/boost/lib" ]; then
+               echo "Boost already installed"
+           else
+               echo "Boost not cached, compiling it"
+               wget -q https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.7z
+               echo "Boost downloaded"
+               travis_wait 20 7z x boost_1_68_0.7z -oC:/local
+               cd "C:/local/boost_1_68_0"
+               ./bootstrap.bat gcc 
+               travis_wait 40 ./b2.exe -d0 --with-date_time --with-test --with-filesystem --with-program_options --with-regex --with-serialization --with-system runtime-link=static toolset=gcc --prefix=C:/local/boost install
+               echo "Boost installed"
+               cd /C/local/boost/lib
+               dir 
+           fi
+         - cd "${TRAVIS_BUILD_DIR}"
+         - cd build && cmake -G "MinGW Makefiles" -DBOOST_ROOT="C:/local/boost" -DBoost_ARCHITECTURE="-x64" -DCMAKE_CXX_COMPILER_ARCHITECTURE_ID="x64" -DCMAKE_SH="CMAKE_SH-NOTFOUND" ..
+     script: 
+         - travis_wait 20 cmake --build . --target install --config Release
+         - ctest -C Release
+
 env:
     - CTEST_OUTPUT_ON_FAILURE=1      
 before_script:
-    - mkdir build
     - cd build && cmake -DCMAKE_INSTALL_PREFIX=../../install ..
 
 script: 
-    - make 
-    - make install
-    - make test
-    
+    - cmake --build . --target install --config Release
+    - ctest -C Release
+    
\ No newline at end of file

--
Gitblit v1.9.1