From bbcd3b0bd2c6dbc10e1bbf73f994179031c76c27 Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Wed, 15 Nov 2017 14:13:03 -0800 Subject: [PATCH] Suppress valgrind "unimplemented functionality" error Summary: Add ROCKSDB_VALGRIND_RUN macro and suppress false-positive "unimplemented functionality" throw by valgrind for steam hints. Another approach would be add a valgrind suppress file. Valgrind is suppose to print the suppression when given "--gen-suppressions=all" param, which is suppose to be the content for the suppression file. But it doesn't print. Closes https://github.com/facebook/rocksdb/pull/3174 Differential Revision: D6338786 Pulled By: yiwu-arbug fbshipit-source-id: 3559efa5f3b92d40d09ad6ac82bc7b59f86c75aa --- Makefile | 7 ++++++- env/io_posix.cc | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9769453c5..44ae69404 100644 --- a/Makefile +++ b/Makefile @@ -237,6 +237,11 @@ ifdef COMPILE_WITH_UBSAN PLATFORM_CXXFLAGS += -fsanitize=undefined -DROCKSDB_UBSAN_RUN endif +ifdef ROCKSDB_VALGRIND_RUN + PLATFORM_CCFLAGS += -DROCKSDB_VALGRIND_RUN + PLATFORM_CXXFLAGS += -DROCKSDB_VALGRIND_RUN +endif + ifndef DISABLE_JEMALLOC ifdef JEMALLOC PLATFORM_CXXFLAGS += -DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE @@ -870,7 +875,7 @@ ubsan_crash_test: $(MAKE) clean valgrind_test: - DISABLE_JEMALLOC=1 $(MAKE) valgrind_check + ROCKSDB_VALGRIND_RUN=1 DISABLE_JEMALLOC=1 $(MAKE) valgrind_check valgrind_check: $(TESTS) $(MAKE) DRIVER="$(VALGRIND_VER) $(VALGRIND_OPTS)" gen_parallel_tests diff --git a/env/io_posix.cc b/env/io_posix.cc index 2bbe80fe1..b00def45f 100644 --- a/env/io_posix.cc +++ b/env/io_posix.cc @@ -865,6 +865,8 @@ uint64_t PosixWritableFile::GetFileSize() { return filesize_; } void PosixWritableFile::SetWriteLifeTimeHint(Env::WriteLifeTimeHint hint) { #ifdef OS_LINUX +// Suppress Valgrind "Unimplemented functionality" error. +#ifndef ROCKSDB_VALGRIND_RUN if (hint == write_hint_) { return; } @@ -872,6 +874,7 @@ void PosixWritableFile::SetWriteLifeTimeHint(Env::WriteLifeTimeHint hint) { write_hint_ = hint; } #endif +#endif } Status PosixWritableFile::InvalidateCache(size_t offset, size_t length) {