Some fixes for gcc 4.8 and add to Travis (#6915)

Summary:
People keep breaking the gcc 4.8 compilation due to different
warnings for shadowing member functions with locals. Adding to Travis
to keep compatibility. (gcc 4.8 is default on CentOS 7.)
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6915

Test Plan: local and Travis

Reviewed By: siying

Differential Revision: D21842894

Pulled By: pdillinger

fbshipit-source-id: bdcd4385127ee5d1cc222d87e53fb3695c32a9d4
main
Peter Dillinger 5 years ago committed by Facebook GitHub Bot
parent 78e291b17e
commit 43f8a9dcce
  1. 16
      .travis.yml
  2. 9
      Makefile
  3. 8
      db/db_basic_test.cc
  4. 7
      file/random_access_file_reader_test.cc

@ -53,6 +53,7 @@ env:
- JOB_NAME=cmake-gcc9 # 3-5 minutes - JOB_NAME=cmake-gcc9 # 3-5 minutes
- JOB_NAME=cmake-gcc9-c++20 # 3-5 minutes - JOB_NAME=cmake-gcc9-c++20 # 3-5 minutes
- JOB_NAME=cmake-mingw # 3 minutes - JOB_NAME=cmake-mingw # 3 minutes
- JOB_NAME=make-gcc4.8
- JOB_NAME=status_checked - JOB_NAME=status_checked
matrix: matrix:
@ -65,6 +66,8 @@ matrix:
env: JOB_NAME=cmake-gcc9-c++20 env: JOB_NAME=cmake-gcc9-c++20
- os: osx - os: osx
env: JOB_NAME=cmake-mingw env: JOB_NAME=cmake-mingw
- os: osx
env: JOB_NAME=make-gcc4.8
- os: osx - os: osx
arch: ppc64le arch: ppc64le
- os: osx - os: osx
@ -72,9 +75,15 @@ matrix:
- os : linux - os : linux
arch: arm64 arch: arm64
env: JOB_NAME=cmake-mingw env: JOB_NAME=cmake-mingw
- os : linux
arch: arm64
env: JOB_NAME=make-gcc4.8
- os: linux - os: linux
arch: ppc64le arch: ppc64le
env: JOB_NAME=cmake-mingw env: JOB_NAME=cmake-mingw
- os: linux
arch: ppc64le
env: JOB_NAME=make-gcc4.8
- os: linux - os: linux
compiler: clang compiler: clang
# Exclude all but most unique cmake variants for pull requests, but build all in branches # Exclude all but most unique cmake variants for pull requests, but build all in branches
@ -225,6 +234,10 @@ install:
- if [ "${JOB_NAME}" == cmake-mingw ]; then - if [ "${JOB_NAME}" == cmake-mingw ]; then
sudo apt-get install -y mingw-w64 ; sudo apt-get install -y mingw-w64 ;
fi fi
- if [ "${JOB_NAME}" == make-gcc4.8 ]; then
sudo apt-get install -y g++-4.8 ;
CC=gcc-4.8 && CXX=g++-4.8;
fi
- if [[ "${JOB_NAME}" == cmake* ]] && [ "${TRAVIS_OS_NAME}" == linux ]; then - if [[ "${JOB_NAME}" == cmake* ]] && [ "${TRAVIS_OS_NAME}" == linux ]; then
CMAKE_DIST_URL="https://rocksdb-deps.s3-us-west-2.amazonaws.com/cmake/cmake-3.14.5-Linux-$(uname -m).tar.bz2"; CMAKE_DIST_URL="https://rocksdb-deps.s3-us-west-2.amazonaws.com/cmake/cmake-3.14.5-Linux-$(uname -m).tar.bz2";
TAR_OPT="--strip-components=1 -xj"; TAR_OPT="--strip-components=1 -xj";
@ -299,6 +312,9 @@ script:
mkdir build && cd build && cmake -DJNI=1 .. -DCMAKE_BUILD_TYPE=Release $OPT && make -j4 rocksdb rocksdbjni mkdir build && cd build && cmake -DJNI=1 .. -DCMAKE_BUILD_TYPE=Release $OPT && make -j4 rocksdb rocksdbjni
;; ;;
make-gcc4.8)
OPT=-DTRAVIS V=1 SKIP_LINK=1 make -j4 all && [ "Linking broken because libgflags compiled with newer ABI" ]
;;
status_checked) status_checked)
OPT=-DTRAVIS V=1 ASSERT_STATUS_CHECKED=1 make -j4 check_some OPT=-DTRAVIS V=1 ASSERT_STATUS_CHECKED=1 make -j4 check_some
;; ;;

@ -195,12 +195,16 @@ AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@; am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 = am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V)) AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
ifneq ($(SKIP_LINK), 1)
am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 = am__v_CCLD_1 =
else
am__v_CCLD_0 = @echo " !CCLD " $@; true skip
am__v_CCLD_1 = true skip
endif
AM_V_AR = $(am__v_AR_$(V)) AM_V_AR = $(am__v_AR_$(V))
am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY)) am__v_AR_ = $(am__v_AR_$(AM_DEFAULT_VERBOSITY))
am__v_AR_0 = @echo " AR " $@; am__v_AR_0 = @echo " AR " $@;
@ -212,6 +216,7 @@ LDFLAGS += -lrados
endif endif
AM_LINK = $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS) AM_LINK = $(AM_V_CCLD)$(CXX) $^ $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
# Detect what platform we're building on. # Detect what platform we're building on.
# Export some common variables that might have been passed as Make variables # Export some common variables that might have been passed as Make variables
# instead of environment variables. # instead of environment variables.

@ -2188,11 +2188,11 @@ TEST_F(DBBasicTest, SkipWALIfMissingTableFiles) {
class DBBasicTestMultiGet : public DBTestBase { class DBBasicTestMultiGet : public DBTestBase {
public: public:
DBBasicTestMultiGet(std::string test_dir, int num_cfs, bool compressed_cache, DBBasicTestMultiGet(std::string test_dir, int num_cfs, bool compressed_cache,
bool uncompressed_cache, bool compression_enabled, bool uncompressed_cache, bool _compression_enabled,
bool fill_cache, uint32_t compression_parallel_threads) bool _fill_cache, uint32_t compression_parallel_threads)
: DBTestBase(test_dir) { : DBTestBase(test_dir) {
compression_enabled_ = compression_enabled; compression_enabled_ = _compression_enabled;
fill_cache_ = fill_cache; fill_cache_ = _fill_cache;
if (compressed_cache) { if (compressed_cache) {
std::shared_ptr<Cache> cache = NewLRUCache(1048576); std::shared_ptr<Cache> cache = NewLRUCache(1048576);

@ -20,7 +20,7 @@ class RandomAccessFileReaderTest : public testing::Test {
fs_ = FileSystem::Default(); fs_ = FileSystem::Default();
test_dir_ = test::PerThreadDBPath("random_access_file_reader_test"); test_dir_ = test::PerThreadDBPath("random_access_file_reader_test");
ASSERT_OK(fs_->CreateDir(test_dir_, IOOptions(), nullptr)); ASSERT_OK(fs_->CreateDir(test_dir_, IOOptions(), nullptr));
alignment_ = GetAlignment(); ComputeAndSetAlignment();
} }
void TearDown() override { void TearDown() override {
@ -63,14 +63,13 @@ class RandomAccessFileReaderTest : public testing::Test {
return test_dir_ + "/" + fname; return test_dir_ + "/" + fname;
} }
size_t GetAlignment() { void ComputeAndSetAlignment() {
std::string f = "get_alignment"; std::string f = "get_alignment";
Write(f, ""); Write(f, "");
std::unique_ptr<RandomAccessFileReader> r; std::unique_ptr<RandomAccessFileReader> r;
Read(f, FileOptions(), &r); Read(f, FileOptions(), &r);
size_t alignment = r->file()->GetRequiredBufferAlignment(); alignment_ = r->file()->GetRequiredBufferAlignment();
EXPECT_OK(fs_->DeleteFile(Path(f), IOOptions(), nullptr)); EXPECT_OK(fs_->DeleteFile(Path(f), IOOptions(), nullptr));
return alignment;
} }
}; };

Loading…
Cancel
Save