From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 5C5BD559614; Wed, 2 Aug 2023 11:18:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5C5BD559614 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1690964333; bh=rn6W60m+EtEqALDd37TUPKbsw5nn/wcmj3/y6TxjWIk=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=QytPKLuekDB693S1FGx4y5nqw/9MYOsmOFPMFcv2NokJmP7tuUjdCGu9BU2UZic2r iKGeQT0aKkNFHXXpNowTX/gE1rYtRGehsB0rEEu6Fi//Zb+ooZTEGAY8mVEWLQVUw2 JdHOdzPGrEuLkj5daztwOSL24QBJyzHCFcBjBPjU= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [95.163.41.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 561F6559602 for ; Wed, 2 Aug 2023 11:18:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 561F6559602 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1qR74F-008V40-0L; Wed, 02 Aug 2023 11:18:51 +0300 Message-ID: <63fb786f-b593-6da6-78b6-cfd9b2435740@tarantool.org> Date: Wed, 2 Aug 2023 11:18:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Maxim Kokryashkin , Sergey Bronnikov Cc: max.kokryashkin@gmail.com, tarantool-patches@dev.tarantool.org References: <27qwncp6oubrmexp6bwsur5nnm5xnlxaby3slxk4rrk2beyuin@5wtqxgcetnfk> In-Reply-To: <27qwncp6oubrmexp6bwsur5nnm5xnlxaby3slxk4rrk2beyuin@5wtqxgcetnfk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD93761F2630DFFAF416DDF8A3A1F98730F81C7E6AA5A500726182A05F538085040BE52EC1CB7088DE9E3B4D3BF31721EC9CFDA5A604DD9C6B45C92C474A260116D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7747FD4AFDBA6C67AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637603D0B7FC8E46DFC8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D82FAC40D4DF05DEA8337C1AEA1B50C92F117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520437C869540D2AB0FF04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE9647ADFADE5905B103CEA74F0D118906D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3AD0E433DBF1FBFA36E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C21E93C0F2A571C7B2E808ACE2090B5E1725E5C173C3A84C3E97D2AE7161E217F089D37D7C0E48F6C8AA50765F790063747074E5DE1517656EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A560F20554D367BF2754E45A9E2A5DDB513E15D5C58A09B520F87CCE6106E1FC07E67D4AC08A07B9B0632EDEA9CD5989A3CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFCED67A6A696D311BD903282DC573AA4F166EB225F77D174B0D5B89ACCAD2E787329B3AFCBA1AB93D8553022043D0BC9AE9BB0394B6CD4CE9D57CCD31CFACF7FFA74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojV0vAgLNnFufQWsb2PdPOBg== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769DDD6648B40C638A0E3B4D3BF31721EC9825871508D9F3970EBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/2 v2] cmake: add code coverage support X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Max On 8/2/23 11:06, Maxim Kokryashkin via Tarantool-patches wrote: > Hi, Sergey! > Thanks for the fixes! > LGTM, except for a few comments below. > > Side note: I see that coverage job in CI is red. Why is that > happening? This happened because from time to time total code coverage number changes a bit. It is really annoying, to solve this we need to increase the threshold in Coveralls service. > > On Tue, Aug 01, 2023 at 09:46:08PM +0300, Sergey Bronnikov via Tarantool-patches wrote: >> From: Sergey Bronnikov >> >> The patch adds building code coverage report using gcovr [1] and gcov. >> gcovr is a better version of lcov, see [2]. There were two new CMake >> targets added: LuaJIT-coverage proccess *.gcno and *.gcda files with > Typo: s/process/processes/ Fixed. >> gcov, builds a detailed HTML report and prints a summary, target >> coverage executes LuaJIT-tests and then runs LuaJIT-coverage. Target >> LuaJIT-coverage is useful for building code coverage report for a custom >> set of regression tests. >> >> ``` >> $ cmake -S . -B build -DENABLE_COVERAGE=ON >> $ cmake --build build --parallel --target coverage >> >> >> >> lines: 84.1% (26056 out of 30997) >> functions: 88.8% (2055 out of 2314) >> branches: 71.5% (14801 out of 20703) >> ``` >> >> 1. https://gcovr.com/ >> 2. https://gcovr.com/en/stable/faq.html#what-is-the-difference-between-lcov-and-gcovr >> --- >> CMakeLists.txt | 9 ++++++ >> cmake/CodeCoverage.cmake | 45 +++++++++++++++++++++++++++ >> test/CMakeLists.txt | 7 +++++ >> test/tarantool-c-tests/CMakeLists.txt | 6 +++- >> 4 files changed, 66 insertions(+), 1 deletion(-) >> create mode 100644 cmake/CodeCoverage.cmake >> >> diff --git a/CMakeLists.txt b/CMakeLists.txt >> index 6ef24bba..fe6582fa 100644 >> --- a/CMakeLists.txt >> +++ b/CMakeLists.txt >> @@ -116,6 +116,15 @@ if(LUAJIT_ENABLE_WARNINGS) >> ) >> endif() >> >> +set(LUAJIT_ENABLE_COVERAGE_DEFAULT OFF) >> +option(LUAJIT_ENABLE_COVERAGE >> + "Enable integration with gcovr, a code coverage program" >> + ${LUAJIT_ENABLE_COVERAGE_DEFAULT}) >> +if (LUAJIT_ENABLE_COVERAGE) >> + AppendFlags(CMAKE_C_FLAGS --coverage) >> + include(CodeCoverage) >> +endif(LUAJIT_ENABLE_COVERAGE) >> + >> # Auxiliary flags for main targets (libraries, binaries). >> AppendFlags(TARGET_C_FLAGS >> -D_FILE_OFFSET_BITS=64 >> diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake >> new file mode 100644 >> index 00000000..2be7d129 >> --- /dev/null >> +++ b/cmake/CodeCoverage.cmake >> @@ -0,0 +1,45 @@ >> +find_program(GCOVR gcovr) >> +find_program(GCOV gcov) >> + >> +set(COVERAGE_DIR "${PROJECT_BINARY_DIR}/coverage") >> +set(COVERAGE_HTML_REPORT "${COVERAGE_DIR}/luajit.html") >> +set(COVERAGE_XML_REPORT "${COVERAGE_DIR}/luajit.xml") >> + >> +if(NOT GCOVR OR NOT GCOV) >> + add_custom_target(${PROJECT_NAME}-coverage >> + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "LuaJIT-coverage is a dummy target" >> + ) >> + message(WARNING "Either `gcovr' or `gcov` not found, \ >> +so ${PROJECT_NAME}-coverage target is dummy") > Nit: Something is wrong with alignment here. No, it is intentionally. If you add indentation then these whitespaces will be added to a message. >>