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 69BB7733EF1; Tue, 19 Dec 2023 11:16:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 69BB7733EF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1702973785; bh=tkdHwwyKW4qoE2q1tCtfX1d+lnq1m4PqMwXOi9ab/14=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xLTsekvoZF+qVF6sS+8Lc2fvxqHwqfeesmt6PJB5Bv2swwhTSzWA3o8KQkT+Yaxey kzBZpni26hHtt+Ys99IUYBJFf2iVnhnMZQB2T7n/BstUA7dzb6TXIAjIRzyV6hHGM2 tkKqYOCVfzQ41pAHJD3fCuZ9Ny0ByovvrxeO+uhQ= Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [95.163.41.64]) (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 05FB4733EF1 for ; Tue, 19 Dec 2023 11:16:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 05FB4733EF1 Received: by smtp41.i.mail.ru with esmtpa (envelope-from ) id 1rFVH5-00CqD3-0A; Tue, 19 Dec 2023 11:16:23 +0300 Message-ID: Date: Tue, 19 Dec 2023 11:16:22 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Maxim Kokryashkin , tarantool-patches@dev.tarantool.org, skaplun@tarantool.org, imun@tarantool.org References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD97533543916A0F71AA68A2013D7A14F583C78D87BDB1DAA53CD62213F67905E7A29007AFE0E13632B396AD1EB67A2ED7BBA0216447A62ADEF83DAA694144A5695 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75C385DEB91CEC222EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BB2557E27C12D3EF8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8050C308034E64C32CD411AB83DA6C999117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE9647ADFADE5905B1BFC1D8BB4B114D1ED8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE3F254576263B31EA92D242C3BD2E3F4C6C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C062BEEFFB5F8EA3E2E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FD2A95C73FD1EFF455E1C53F199C2BB95B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5E90E456B607D57E7B33801B201E3A02B537183508B3293F2F87CCE6106E1FC07E67D4AC08A07B9B0CE135D2742255B35CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF2AD387591C6F130DF30E82455BB669B7008A9545D049E13231CBB3DD541C8F92F397AE266BD3C14BE190DC598EAEA94F4AB2BE0655CADB9951A00A36DECE5B44A74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojgGTRFEPoGBQSHCCLnKqJRQ== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A7690877960AC117649BE30D83ECB11C36367962F9E9328436E1EBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v5 2/2] test: add tests for debugging extensions 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! many thanks for the patch! LGTM with a a number of minor comments, please see below. Sergey On 12/6/23 17:14, Maxim Kokryashkin wrote: > From: Maksim Kokryashkin > > This patch adds tests for LuaJIT debugging > extensions for lldb and gdb. > --- > .flake8rc | 4 + > src/luajit_dbg.py | 11 +- > test/CMakeLists.txt | 3 + > .../CMakeLists.txt | 102 +++++++ > .../debug-extension-tests.py | 262 ++++++++++++++++++ > 5 files changed, 376 insertions(+), 6 deletions(-) > create mode 100644 test/LuaJIT-debug-extensions-tests/CMakeLists.txt > create mode 100644 test/LuaJIT-debug-extensions-tests/debug-extension-tests.py > > if(LUAJIT_USE_TEST) > diff --git a/test/LuaJIT-debug-extensions-tests/CMakeLists.txt b/test/LuaJIT-debug-extensions-tests/CMakeLists.txt > new file mode 100644 > index 00000000..78eafd02 > --- /dev/null > +++ b/test/LuaJIT-debug-extensions-tests/CMakeLists.txt > @@ -0,0 +1,102 @@ > +add_custom_target(LuaJIT-gdb-extension-tests > + DEPENDS ${LUAJIT_TEST_BINARY} > +) > + > +add_custom_target(LuaJIT-lldb-extension-tests > + DEPENDS ${LUAJIT_TEST_BINARY} > +) > + > +set(DUMMY_GDB_MSG "LuaJIT-gdb-extension-tests is a dummy target") > +set(DUMMY_LLDB_MSG "LuaJIT-lldb-extension-tests is a dummy target") > + > +# Debug info is required for testing of extensions. > +if(NOT (CMAKE_BUILD_TYPE MATCHES Debug)) > + message(WARNING > + "not a DEBUG build, LuaJIT-lldb-extension-tests and " > + "LuaJIT-gdb-extension-tests are dummy" > + ) > + add_custom_command(TARGET LuaJIT-gdb-extension-tests > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${DUMMY_GDB_MSG} > + ) > + add_custom_command(TARGET LuaJIT-lldb-extension-tests > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${DUMMY_LLDB_MSG} > + ) > + return() > +endif() > + > +# MacOS asks for permission to debug a process even when the > +# machine is set into development mode. To solve the issue, > +# it is required to add relevant users to the `_developer` user > +# group in MacOS. Disabled for now. > +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED ENV{CI}) > + message(WARNING > + "Interactive debugging is unavailable for macOS CI builds," > + "LuaJIT-lldb-extension-tests is dummy" > + ) > + add_custom_command(TARGET LuaJIT-lldb-extension-tests > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${DUMMY_LLDB_MSG} > + ) > + return() > +endif() > + > +find_package(PythonInterp) CMake Warning (dev) at test/LuaJIT-debug-extensions-tests/CMakeLists.txt:30 (find_package):   Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules   are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use   the cmake_policy command to set the policy and suppress this warning. This warning is for project developers.  Use -Wno-dev to suppress it. See https://cmake.org/cmake/help/latest/policy/CMP0148.html Let's fix this warning. > +if(NOT PYTHONINTERP_FOUND) > + message(WARNING > + "`python` is not found, LuaJIT-lldb-extension-tests and " > + "LuaJIT-gdb-extension-tests are dummy" > + ) > + add_custom_command(TARGET LuaJIT-gdb-extension-tests > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${DUMMY_GDB_MSG} > + ) > + add_custom_command(TARGET LuaJIT-lldb-extension-tests > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${DUMMY_LLDB_MSG} > + ) > + return() > +endif() > + > +set(DEBUGGER_TEST_ENV > + "LUAJIT_TEST_BINARY=${LUAJIT_TEST_BINARY}" > + # Suppresses __pycache__ generation. > + "PYTHONDONTWRITEBYTECODE=1" > + "DEBUGGER_EXTENSION_PATH=${PROJECT_SOURCE_DIR}/src/luajit_dbg.py" > +) > + > +set(TEST_SCRIPT_PATH > + ${PROJECT_SOURCE_DIR}/test/LuaJIT-debug-extensions-tests/debug-extension-tests.py > +) > + > +find_program(GDB gdb) > +if(GDB) > + set(GDB_TEST_ENV ${DEBUGGER_TEST_ENV} > + "DEBUGGER_COMMAND=${GDB}" > + ) > + add_custom_command(TARGET LuaJIT-gdb-extension-tests > + COMMENT "Running luajit_dbg.py tests with gdb" Nit: I would omit a filename in a comment > + COMMAND > + ${GDB_TEST_ENV} ${PYTHON_EXECUTABLE} ${TEST_SCRIPT_PATH} > + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} > + ) > +else() > + message(WARNING "`gdb' is not found, so LuaJIT-gdb-extension-tests is dummy") > + add_custom_command(TARGET LuaJIT-gdb-extension-tests > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${DUMMY_GDB_MSG} > + ) > +endif() > + > +find_program(LLDB lldb) > +if(LLDB) > + set(LLDB_TEST_ENV ${DEBUGGER_TEST_ENV} > + "DEBUGGER_COMMAND=${LLDB}" > + ) > + add_custom_command(TARGET LuaJIT-lldb-extension-tests > + COMMENT "Running luajit_dbg.py tests with lldb" Nit: I would omit a filename in a comment > + > + > +for test_cls in TestCaseBase.__subclasses__(): > + test_cls.test = lambda self: self.check() > + > +if __name__ == '__main__': > + unittest.main(verbosity=2) there are three verbosity levels: quiet (0), default (1) and verbose (3). I would left a comment that "2" is a verbose level. Feel free to ignore.