From a29a998638d4a2e607242475626d7b599f68d1ed Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Sat, 7 Apr 2018 11:57:13 +0200 Subject: [PATCH] first try to integrate gtest poc with travis This is not intended to go into main source repo! --- .travis.yml | 3 +- 3rdParty/buildGoogletestLinux.sh | 58 ++++++++++++++++++++++++++++++ 3rdParty/buildLinuxDependencies.sh | 2 +- gtest/Makefile.gtest | 6 ++-- gtest/lib/Makefile.gtest | 6 ++-- gtest/sched/Makefile.gtest | 6 ++-- 6 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 3rdParty/buildGoogletestLinux.sh diff --git a/.travis.yml b/.travis.yml index 21b621687fc..0f80d187a51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,12 +71,13 @@ matrix: before_install: - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( sudo apt-get -qq update ) fi - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( sudo apt-get install freeglut3-dev libxmu-dev libxi-dev libfcgi-dev libxss-dev libnotify-dev libxcb-util0-dev libsqlite3-dev libgtk2.0-dev libwebkitgtk-dev mingw-w64 binutils-mingw-w64-i686 binutils-mingw-w64-x86-64 gcc-mingw-w64 gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 ) fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( pip install --user cpp-coveralls ) fi before_script: - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then ( ./_autosetup ) fi script: -- if [[ "${BOINC_TYPE}" == "libs" ]]; then ( ./configure --disable-server --disable-client --disable-manager && make ) fi +- if [[ "${BOINC_TYPE}" == "libs" ]]; then ( ./configure --disable-server --disable-client --disable-manager && make && cd gtest && make -f Makefile.gtest && make -f Makefile.gtest test ) fi - if [[ "${BOINC_TYPE}" == "server" ]]; then ( ./configure --disable-client --disable-manager && make ) fi - if [[ "${BOINC_TYPE}" == "client" ]]; then ( ./configure --disable-server --disable-manager && make ) fi - if [[ "${BOINC_TYPE}" == "apps" ]]; then ( ./configure --enable-apps --disable-server --disable-client --disable-manager && make ) fi diff --git a/3rdParty/buildGoogletestLinux.sh b/3rdParty/buildGoogletestLinux.sh new file mode 100644 index 00000000000..6d8b1eee131 --- /dev/null +++ b/3rdParty/buildGoogletestLinux.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# This file is part of BOINC. +# http://boinc.berkeley.edu +# Copyright (C) 2017 University of California +# +# BOINC is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# BOINC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BOINC. If not, see . + +# Script to build a wxWidgets GTK version for BOINC + +# Usage: +# cd [path]/wxWidgets-3.0.2/ +# source path_to_this_script [--clean] [--debug] [--prefix PATH] +# +# the --clean argument will force a full rebuild. +# the --debug argument will build the debug version of the library +# if --prefix is given as absolute path the library is installed into there + +doclean="" +debug_flag="" +lprefix="" +cmdline_prefix="" +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -clean|--clean) + doclean="yes" + ;; + -prefix|--prefix) + lprefix="$2" + cmdline_prefix="--prefix=${lprefix}" + shift + ;; + esac + shift # past argument or value +done + +cd googletest/make +make +if [ $? -ne 0 ]; then cd ..; return 1; fi +if [ "x${lprefix}" != "x" ]; then + (cp gtest_main.a ${lprefix}/lib && cp -r ../include/gtest ${lprefix}/include) + if [ $? -ne 0 ]; then cd ..; return 1; fi +fi + +cd ../.. +return 0 diff --git a/3rdParty/buildLinuxDependencies.sh b/3rdParty/buildLinuxDependencies.sh index 5115394e7c9..8f6981e4481 100755 --- a/3rdParty/buildLinuxDependencies.sh +++ b/3rdParty/buildLinuxDependencies.sh @@ -135,6 +135,6 @@ fi #download_and_build $DIRNAME $FILENAME $DOWNLOADURL $BUILDSCRIPT download_and_build "wxWidgets-3.0.2" "wxWidgets-3.0.2.tar.bz2" "https://sourceforge.net/projects/wxwindows/files/3.0.2/wxWidgets-3.0.2.tar.bz2" "${ROOTDIR}/3rdParty/buildWxLinux.sh ${wxoption}" - +download_and_build "googletest-release-1.8.0" "release-1.8.0.tar.gz" "https://github.com/google/googletest/archive/release-1.8.0.tar.gz" "${ROOTDIR}/3rdParty/buildGoogletestLinux.sh" # change back to root directory cd ${ROOTDIR} || exit 1 diff --git a/gtest/Makefile.gtest b/gtest/Makefile.gtest index c41c4bb583c..f6f26dba033 100644 --- a/gtest/Makefile.gtest +++ b/gtest/Makefile.gtest @@ -1,6 +1,6 @@ # Location of GTEST -GTEST_DIR = ../../googletest/googletest -GTEST_MAIN = ${GTEST_DIR}/make/gtest_main.a +GTEST_DIR = ../3rdParty/buildCache/linux +GTEST_MAIN = ${GTEST_DIR}/lib/gtest_main.a # BOINC Libraries BOINC_DIR = .. @@ -14,7 +14,7 @@ OTHER_INC = -I /usr/include/mysql CPPFLAGS = -isystem $(GTEST_DIR)/include ${BOINC_INC} ${OTHER_INC} # Flags passed to the C++ compiler. -CXXFLAGS = -g -Wall -Wextra -Werror +CXXFLAGS = -g -Wall -Wextra -Werror --coverage # Include all source files #cppsrc = $(wildcard *.cpp) \ diff --git a/gtest/lib/Makefile.gtest b/gtest/lib/Makefile.gtest index d62f0b48142..f0fa7808282 100644 --- a/gtest/lib/Makefile.gtest +++ b/gtest/lib/Makefile.gtest @@ -1,6 +1,6 @@ # Location of GTEST -GTEST_DIR = ../../../googletest/googletest -GTEST_MAIN = ${GTEST_DIR}/make/gtest_main.a +GTEST_DIR = ../../3rdParty/buildCache/linux +GTEST_MAIN = ${GTEST_DIR}/lib/gtest_main.a # BOINC Libraries BOINC_DIR = ../.. @@ -14,7 +14,7 @@ OTHER_INC = -I /usr/include/mysql CPPFLAGS = -isystem $(GTEST_DIR)/include ${BOINC_INC} ${OTHER_INC} # Flags passed to the C++ compiler. -CXXFLAGS = -g -Wall -Wextra -Werror +CXXFLAGS = -g -Wall -Wextra -Werror --coverage # Include all source files cppsrc = $(wildcard *.cpp) diff --git a/gtest/sched/Makefile.gtest b/gtest/sched/Makefile.gtest index acc845b1963..f44e8ca7d9a 100644 --- a/gtest/sched/Makefile.gtest +++ b/gtest/sched/Makefile.gtest @@ -1,6 +1,6 @@ # Location of GTEST -GTEST_DIR = ../../../googletest/googletest -GTEST_MAIN = ${GTEST_DIR}/make/gtest_main.a +GTEST_DIR = ../../3rdParty/buildCache/linux +GTEST_MAIN = ${GTEST_DIR}/lib/gtest_main.a # BOINC Libraries BOINC_DIR = ../.. @@ -14,7 +14,7 @@ OTHER_INC = -I /usr/include/mysql CPPFLAGS = -isystem $(GTEST_DIR)/include ${BOINC_INC} ${OTHER_INC} # Flags passed to the C++ compiler. -CXXFLAGS = -g -Wall -Wextra -Werror +CXXFLAGS = -g -Wall -Wextra -Werror --coverage # Include all source files cppsrc = $(wildcard *.cpp)