From ef97df22f2d1b851ef7d8f69ba8107f8b2e1cb23 Mon Sep 17 00:00:00 2001 From: yangce Date: Sun, 1 Jan 2017 18:31:03 +0800 Subject: [PATCH 01/10] Use coveralls (#null) --- .travis.yml | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68080aba..02806c63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,15 @@ env: - PROTOBUF_VERSION=2.6.0 install: + - sudo pip install --user cpp-coveralls - echo | sudo apt-add-repository ppa:boost-latest/ppa - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - - sudo apt-get install -qq g++-4.8 - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + - sudo apt-get install -qq g++-4.8 lcov + - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.8 20 - sudo update-alternatives --config g++ + - sudo update-alternatives --config gcov - sudo apt-get install libboost-dev - wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-$PROTOBUF_VERSION.tar.gz @@ -44,22 +47,27 @@ install: before_script: - - echo 'SNAPPY_PATH=./thirdparty/snappy' > depends.mk - - echo 'PROTOBUF_PATH=./thirdparty/protobuf' >> depends.mk - - echo 'PROTOC=protoc' >> depends.mk - - echo 'PBRPC_PATH=./thirdparty/sofa-pbrpc/output' >> depends.mk - - echo 'TCMALLOC_PATH=./thirdparty' >> depends.mk - - echo 'COMMON_PATH=./common/output' >> depends.mk - - echo 'LEVELDB_PATH=./thirdparty' >> depends.mk + - export WORK_DIR=`pwd` + - echo $WORK_DIR + - echo "WORK_PATH=$WORK_DIR" > depends.mk + - echo "SNAPPY_PATH=$WORK_DIR/thirdparty/snappy" >> depends.mk + - echo "PROTOBUF_PATH=$WORK_DIR/thirdparty/protobuf" >> depends.mk + - echo "PROTOC=protoc" >> depends.mk + - echo "PBRPC_PATH=$WORK_DIR/thirdparty/sofa-pbrpc/output" >> depends.mk + - echo "TCMALLOC_PATH=$WORK_DIR/thirdparty" >> depends.mk + - echo "COMMON_PATH=$WORK_DIR/common/output" >> depends.mk + - echo "LEVELDB_PATH=$WORK_DIR/thirdparty" >> depends.mk script: make -j4 && make check && make test addons: - coverity_scan: - project: - name: "bluebore/bfs" - notification_email: yanshiguang02@baidu.com - build_command_prepend: "make clean" - build_command: "make -j4" - branch_pattern: master + coverity_scan: + project: + name: "bluebore/bfs" + notification_email: yanshiguang02@baidu.com + build_command_prepend: "make clean" + build_command: "make -j4" + branch_pattern: master +after_script: + - COVERALLS_REPO_TOKEN=TnLIOj8lpAgN6CjpeGSDpXsu5IF5Bmluo find . -name *.gc* | xargs rm -f && make clean && make -j4 && make check && sudo ~/.local/bin/cpp-coveralls -e src/chunkserver/test -e src/nameserver/test -e thirdparty/ -e thirdsrc/ -e ut/ -e src/proto --gcov-options '\-lpr' From d98df4e305f9ed13ce66244bf91c4bff1e1ebb9e Mon Sep 17 00:00:00 2001 From: yangce Date: Sun, 1 Jan 2017 18:34:12 +0800 Subject: [PATCH 02/10] Add coveralls badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6dff82e5..336243e5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [The Baidu File System](http://github.com/baidu/bfs) ====== - [![Build Status](https://travis-ci.org/baidu/bfs.svg?branch=master)](https://travis-ci.org/baidu/bfs) [![Build Status](https://scan.coverity.com/projects/8135/badge.svg)](https://scan.coverity.com/projects/myawan-bfs-1/) + [![Build Status](https://travis-ci.org/baidu/bfs.svg?branch=master)](https://travis-ci.org/baidu/bfs) [![Build Status](https://scan.coverity.com/projects/8135/badge.svg)](https://scan.coverity.com/projects/myawan-bfs-1/) [![Coverage Status](https://coveralls.io/repos/github/baidu/bfs/badge.svg?branch=master)](https://coveralls.io/github/baidu/bfs?branch=master) The Baidu File System (BFS) is a distributed file system designed to support real-time applications. Like many other distributed file systems, BFS is highly fault-tolerant. But different from others, BFS provides low read/write latency while maintaining high throughput rates. Together with [Galaxy](https://github.com/baidu/galaxy) and [Tera](http://github.com/baidu/tera), BFS supports many real-time products in Baidu, including Baidu webpage database, Baidu incremental indexing system, Baidu user behavior analysis system, etc. From 02e1036e091b9694604426ee7b2f5f851173c5e1 Mon Sep 17 00:00:00 2001 From: yangce Date: Sun, 1 Jan 2017 20:24:43 +0800 Subject: [PATCH 03/10] Update travis --- .travis.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 02806c63..99f7446d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,8 @@ install: - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install -qq g++-4.8 lcov - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 - - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.8 20 + - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 + - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.8 20 - sudo update-alternatives --config g++ - sudo update-alternatives --config gcov @@ -60,14 +60,5 @@ before_script: script: make -j4 && make check && make test -addons: - coverity_scan: - project: - name: "bluebore/bfs" - notification_email: yanshiguang02@baidu.com - build_command_prepend: "make clean" - build_command: "make -j4" - branch_pattern: master - after_script: - - COVERALLS_REPO_TOKEN=TnLIOj8lpAgN6CjpeGSDpXsu5IF5Bmluo find . -name *.gc* | xargs rm -f && make clean && make -j4 && make check && sudo ~/.local/bin/cpp-coveralls -e src/chunkserver/test -e src/nameserver/test -e thirdparty/ -e thirdsrc/ -e ut/ -e src/proto --gcov-options '\-lpr' + - COVERALLS_REPO_TOKEN=TnLIOj8lpAgN6CjpeGSDpXsu5IF5Bmluo find . -name *.gc* | xargs rm -f && make clean && make -j4 && make check && ~/.local/bin/cpp-coveralls -e src/chunkserver/test -e src/nameserver/test -e thirdparty/ -e thirdsrc/ -e ut/ -e src/proto --gcov-options '\-lpr' From ba18789987d24f1f031b087a1361217620f4fd0d Mon Sep 17 00:00:00 2001 From: yangce Date: Sun, 1 Jan 2017 20:43:06 +0800 Subject: [PATCH 04/10] Update makefile --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 33b4a375..2ec61eb0 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ OPT ?= -g2 -Werror # (B) Debug mode, w/ full line-level debugging symbols include depends.mk #CXX=/opt/compiler/gcc-4.8.2/bin/g++ -INCLUDE_PATH = -I./src -I$(PROTOBUF_PATH)/include \ +INCLUDE_PATH = -I$(WORK_PATH)/src -I$(PROTOBUF_PATH)/include \ -I$(PBRPC_PATH)/include \ -I$(LEVELDB_PATH)/include \ -I$(SNAPPY_PATH)/include \ @@ -20,9 +20,9 @@ LDFLAGS = -L$(PBRPC_PATH)/lib -lsofa-pbrpc \ -L$(GFLAG_PATH)/lib -lgflags \ -L$(GTEST_PATH)/lib -lgtest \ -L$(TCMALLOC_PATH)/lib -ltcmalloc_minimal \ - -L$(COMMON_PATH)/lib -lcommon -lpthread -lz -lrt + -L$(COMMON_PATH)/lib -lcommon -lpthread -lz -lrt -lgcov -CXXFLAGS = -std=c++11 -Wall -fPIC $(OPT) +CXXFLAGS = -std=c++11 -Wall -fPIC $(OPT) -fprofile-arcs -ftest-coverage FUSEFLAGS = -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I$(FUSE_PATH)/include FUSE_LL_FLAGS = -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I$(FUSE_LL_PATH)/include From 40e6a4933caa4b3814252fa1a06824cc58329732 Mon Sep 17 00:00:00 2001 From: yangce Date: Sun, 1 Jan 2017 21:06:47 +0800 Subject: [PATCH 05/10] Update travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 99f7446d..2939ff85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,4 +61,4 @@ before_script: script: make -j4 && make check && make test after_script: - - COVERALLS_REPO_TOKEN=TnLIOj8lpAgN6CjpeGSDpXsu5IF5Bmluo find . -name *.gc* | xargs rm -f && make clean && make -j4 && make check && ~/.local/bin/cpp-coveralls -e src/chunkserver/test -e src/nameserver/test -e thirdparty/ -e thirdsrc/ -e ut/ -e src/proto --gcov-options '\-lpr' + - COVERALLS_REPO_TOKEN=TnLIOj8lpAgN6CjpeGSDpXsu5IF5Bmluo find . -name *.gc* | xargs rm -f && make clean && make -j4 && make check && sudo ~/.local/bin/cpp-coveralls -e src/chunkserver/test -e src/nameserver/test -e thirdparty/ -e thirdsrc/ -e ut/ -e src/proto --gcov-options '\-lpr' From 00cb50336526542b37d1fa89c0e5a563151c21ea Mon Sep 17 00:00:00 2001 From: yangce Date: Sun, 1 Jan 2017 21:50:35 +0800 Subject: [PATCH 06/10] Update travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2939ff85..fa80b544 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,7 @@ before_script: - echo "TCMALLOC_PATH=$WORK_DIR/thirdparty" >> depends.mk - echo "COMMON_PATH=$WORK_DIR/common/output" >> depends.mk - echo "LEVELDB_PATH=$WORK_DIR/thirdparty" >> depends.mk + - cat depends.mk script: make -j4 && make check && make test From 311d89474043f0ead718f450c580fe4131bef968 Mon Sep 17 00:00:00 2001 From: yangce Date: Mon, 2 Jan 2017 11:02:30 +0800 Subject: [PATCH 07/10] Update travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fa80b544..3f98e2b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,8 @@ before_script: - echo "TCMALLOC_PATH=$WORK_DIR/thirdparty" >> depends.mk - echo "COMMON_PATH=$WORK_DIR/common/output" >> depends.mk - echo "LEVELDB_PATH=$WORK_DIR/thirdparty" >> depends.mk - - cat depends.mk + - sed -i "/-lpthread -lz -lrt/s/$/ -lgcov/g" Makefile + - sed -i "/CXXFLAGS =/s/$/ -fprofile-arcs -ftest-coverage/g" Makefile script: make -j4 && make check && make test From f9097ce84be4188b928d4da7aff36e850385f5b7 Mon Sep 17 00:00:00 2001 From: yangce Date: Mon, 2 Jan 2017 11:53:33 +0800 Subject: [PATCH 08/10] Update makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2ec61eb0..bd9babe7 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,9 @@ LDFLAGS = -L$(PBRPC_PATH)/lib -lsofa-pbrpc \ -L$(GFLAG_PATH)/lib -lgflags \ -L$(GTEST_PATH)/lib -lgtest \ -L$(TCMALLOC_PATH)/lib -ltcmalloc_minimal \ - -L$(COMMON_PATH)/lib -lcommon -lpthread -lz -lrt -lgcov + -L$(COMMON_PATH)/lib -lcommon -lpthread -lz -lrt -CXXFLAGS = -std=c++11 -Wall -fPIC $(OPT) -fprofile-arcs -ftest-coverage +CXXFLAGS = -std=c++11 -Wall -fPIC $(OPT) FUSEFLAGS = -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I$(FUSE_PATH)/include FUSE_LL_FLAGS = -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I$(FUSE_LL_PATH)/include From 8b75620817cfc73b76213bb906a5ed8072dd05b4 Mon Sep 17 00:00:00 2001 From: yangce Date: Mon, 2 Jan 2017 12:14:16 +0800 Subject: [PATCH 09/10] Recover coverity --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3f98e2b3..db3dbaa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,5 +62,14 @@ before_script: script: make -j4 && make check && make test +addons: + coverity_scan: + project: + name: "bluebore/bfs" + notification_email: yanshiguang02@baidu.com + build_command_prepend: "make clean" + build_command: "make -j4" + branch_pattern: master + after_script: - COVERALLS_REPO_TOKEN=TnLIOj8lpAgN6CjpeGSDpXsu5IF5Bmluo find . -name *.gc* | xargs rm -f && make clean && make -j4 && make check && sudo ~/.local/bin/cpp-coveralls -e src/chunkserver/test -e src/nameserver/test -e thirdparty/ -e thirdsrc/ -e ut/ -e src/proto --gcov-options '\-lpr' From 8af8998b81b3562792a2d5bab13f6f283987608b Mon Sep 17 00:00:00 2001 From: yangce Date: Mon, 2 Jan 2017 13:04:02 +0800 Subject: [PATCH 10/10] Update build script --- build.sh | 22 ++++++++++++---------- internal_build.sh | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/build.sh b/build.sh index a75db86b..e63a5a6a 100755 --- a/build.sh +++ b/build.sh @@ -171,19 +171,21 @@ cd ${WORK_DIR} # config depengs.mk ######################################## -echo "PBRPC_PATH=./thirdparty" > depends.mk -echo "PROTOBUF_PATH=./thirdparty" >> depends.mk -echo "PROTOC_PATH=./thirdparty/bin/" >> depends.mk +echo "WORK_PATH=${WORK_DIR}" > depends.mk +echo "PBRPC_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "PROTOBUF_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "PROTOC_PATH=${WORK_DIR}/thirdparty/bin/" >> depends.mk echo 'PROTOC=$(PROTOC_PATH)protoc' >> depends.mk -echo "PBRPC_PATH=./thirdparty" >> depends.mk -echo "BOOST_PATH=./thirdparty/boost_1_57_0" >> depends.mk -echo "GFLAG_PATH=./thirdparty" >> depends.mk -echo "GTEST_PATH=./thirdparty" >> depends.mk -echo "COMMON_PATH=./thirdparty" >> depends.mk -echo "TCMALLOC_PATH=./thirdparty" >> depends.mk +echo "PBRPC_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "GFLAG_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "GTEST_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "COMMON_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "TCMALLOC_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "SNAPPY_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "LEVELDB_PATH=${WORK_DIR}/thirdparty" >> depends.mk ######################################## -# build tera +# build bfs ######################################## make clean diff --git a/internal_build.sh b/internal_build.sh index 97db005e..25aecaec 100755 --- a/internal_build.sh +++ b/internal_build.sh @@ -174,15 +174,18 @@ cd ${WORK_DIR} # config depengs.mk ######################################## -echo "PBRPC_PATH=./thirdparty" > depends.mk -echo "PROTOBUF_PATH=./thirdparty" >> depends.mk -echo "PROTOC_PATH=./thirdparty/bin/" >> depends.mk +echo "WORK_PATH=${WORK_DIR}" > depends.mk +echo "PBRPC_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "PROTOBUF_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "PROTOC_PATH=${WORK_DIR}/thirdparty/bin/" >> depends.mk echo 'PROTOC=$(PROTOC_PATH)protoc' >> depends.mk -echo "PBRPC_PATH=./thirdparty" >> depends.mk -echo "GFLAG_PATH=./thirdparty" >> depends.mk -echo "GTEST_PATH=./thirdparty" >> depends.mk -echo "COMMON_PATH=./thirdparty" >> depends.mk -echo "TCMALLOC_PATH=./thirdparty" >> depends.mk +echo "PBRPC_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "GFLAG_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "GTEST_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "COMMON_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "TCMALLOC_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "SNAPPY_PATH=${WORK_DIR}/thirdparty" >> depends.mk +echo "LEVELDB_PATH=${WORK_DIR}/thirdparty" >> depends.mk ######################################## # build bfs