From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B1E564696C3 for ; Wed, 29 Apr 2020 12:29:06 +0300 (MSK) Date: Wed, 29 Apr 2020 12:28:55 +0300 From: Sergey Bronnikov Message-ID: <20200429092855.GA83580@pony.bronevichok.ru> References: <33ba1d50585e101aa025d899116c48d56be59202.1587372354.git.sergeyb@tarantool.org> <7A9E4292-A080-46A7-AFF2-084AD61A51EC@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7A9E4292-A080-46A7-AFF2-084AD61A51EC@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2] Add infrastructure for fuzzing testing and fuzzers List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko Cc: o.piskunov@tarantool.org, tml Hi, Serge thanks for review. See my answers inline. On 16:56 Fri 24 Apr , Serge Petrenko wrote: > > +option(ENABLE_FUZZER "Enable fuzzing testing" OFF) > > +if (ENABLE_FUZZER) > > + set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Testing") > > +endif () > > Maybe report some error on an attemt to set ENABLE_FUZZER=ON > when the compiler isn't clang? Then there’ll be no need to check > for CMAKE_CXX_COMPILER_ID in each test’s file. Agree, added check for compiler here. > > + > > option(ENABLE_ASAN "Enable AddressSanitizer, a fast memory error detector based on compiler instrumentation" OFF) > > if (ENABLE_ASAN) > > if (CMAKE_COMPILER_IS_GNUCC) > > diff --git a/src/lib/csv/CMakeLists.txt b/src/lib/csv/CMakeLists.txt > > index 3580e4da2..d5a3ed1f6 100644 > > --- a/src/lib/csv/CMakeLists.txt > > +++ b/src/lib/csv/CMakeLists.txt > > @@ -4,3 +4,14 @@ set(lib_sources > > > > set_source_files_compile_flags(${lib_sources}) > > add_library(csv STATIC ${lib_sources}) > > + > > +if (ENABLE_FUZZER AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") > > Is there such a thing as CMAKE_C_COMPILER_ID ? > If yes, then maybe check it instead of _CXX_ one ? Agree, replaced. > > + set(TestName "test_csv") > > + add_executable(${TestName} ${TestName}.c) > > + set_target_properties(${TestName} > > + PROPERTIES > > + COMPILE_FLAGS "-fsanitize=fuzzer,address -g -O1" > > + LINK_FLAGS "-fsanitize=fuzzer,address") > > + target_link_libraries(${TestName} PRIVATE csv) > > + set_target_properties(${TestName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") > > +endif () > > diff --git a/src/lib/csv/test_csv.c b/src/lib/csv/test_csv.c > > new file mode 100644 > > index 000000000..aa1703514 > > --- /dev/null > > +++ b/src/lib/csv/test_csv.c > > Maybe we should put all the tests to test/fuzzing/smth ? > Since we have test/unit/smth. I did it for convenience - it is more convenient when tests lie together with code. I don't know why we place tarantool unit tests and other tests in a single directory seperately with modules that they tests. These three tests (csv, uri and http) are related to small libraries and I don't see any reasons to place them outside of library dir. -- sergeyb@