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 347DA6C7D4; Wed, 3 Feb 2021 00:00:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 347DA6C7D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1612299628; bh=XzxpFbgRpFs8JmXkUwTLfMtOEvfI6SM9GF5DEKC6/iY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mBiYMMcNZx/qhq5/xcA25ppBBAvWDygD7ns4iN2rNVKS05p9FgPUKkOBqSuXDWgKp 4imuAPMrfa09YA4dIJaI4Tu1aPAcogns+Zp+E2f7YF61iuQi6dmIOeDH7PjEeCCoIG rVQ9lCebDIEPRGsOpdkr/I79tV21PL1kCeV8ChzQ= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 AF3DE63342 for ; Tue, 2 Feb 2021 23:57:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AF3DE63342 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1l72kC-0005mg-QT; Tue, 02 Feb 2021 23:57:53 +0300 To: Sergey Kaplun , Timur Safin Date: Tue, 2 Feb 2021 23:57:45 +0300 Message-Id: <7057011c43d41adab30dbd13621570418064d38d.1612291495.git.imun@tarantool.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD953AC099BC0052A9C4647521586BE7E6324520D2A088600D8182A05F5380850406C681A579A93A8F7B99EF80F50F67BCB4344DDEAC7FBEB2E7E6EE12F89CA4367 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE761966F250AC1AE21EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372338AE33E473C9B88638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCDAFBC183B389AD445B51E412E87877F7C973A19796DFC848389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C05A64D9A1E9CA65708941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B601F8F2FECC0250C8CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC426E46268278306375ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4931B544F03EFBC4D5789424AA0EF8DE9BAC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C823F58AE0C7795A91E1B0CA4EE72978A36BC0E3DF73964B39C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF31C0090ACECF247D699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3467D08F30473A58422EA959590C5EBBCE99885FF1E199A553DF2D8AECE95FD05EB98B4CCCD77F120F1D7E09C32AA3244CF0DEC3E0E7DE86CB0C65F97BD3B74264F165894D92D62706927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojCSo1BV1mVLb8uRIDAlI6pg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822FF0AE08B6656F5CD7D0BBFEDFCE61082A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit 5/5] test: run luacheck static analysis via CMake 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch introduces a separate target to run luacheck against all Lua chunks within LuaJIT repository except those explicitly ignored in .luacheckrc. There is also a single additional change over the 'luajit' std defaults: to suppress all false positives related to namespace introduced in 5a61e1ab54b5c66bfebd836db1ac47996611e065 ('misc: add C and Lua API for platform metrics'), this name is added to list. All Lua sources originally inherited from LuaJIT vanilla repository are ignored, to leave them coherent with the upstream. The new target is a dependency for the root target. Part of tarantool/tarantool#4862 Part of tarantool/tarantool#5470 Signed-off-by: Igor Munkin --- .gitignore | 1 + .luacheckrc | 11 +++++++++++ test/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 .luacheckrc diff --git a/.gitignore b/.gitignore index 35d2580..7902547 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ Makefile cmake_install.cmake compile_commands.json install_manifest.txt +luacheck.ok luajit-parse-memprof luajit.pc tests.ok diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..0a5d001 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,11 @@ +-- Use the default LuaJIT globals. +std = 'luajit' +-- This fork also introduces a new global for misc API namespace. +read_globals = { 'misc' } + +-- These files are inherited from the vanilla LuaJIT and need to +-- be coherent with the upstream. +exclude_files = { + 'dynasm/', + 'src/', +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f05dd90..c89efc2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,6 +3,36 @@ # See the rationale in the root CMakeLists.txt. cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +find_program(LUACHECK luacheck) +if(LUACHECK) + set(LUACHECK_RC ${PROJECT_SOURCE_DIR}/.luacheckrc) + set(LUACHECK_OK ${CMAKE_CURRENT_BINARY_DIR}/luacheck.ok) + file(GLOB_RECURSE LUACHECK_DEPS ${PROJECT_SOURCE_DIR}/*.lua) + add_custom_command( + COMMENT "Running luacheck static analysis" + OUTPUT ${LUACHECK_OK} + DEPENDS ${LUACHECK} ${LUACHECK_RC} ${LUACHECK_DEPS} + COMMAND + ${LUACHECK} ${PROJECT_SOURCE_DIR} + --codes + --config ${LUACHECK_RC} + && touch ${LUACHECK_OK} + # XXX: Filenames in .luacheckrc are considered relative to + # the working directory, hence luacheck should be run in the + # project root directory. + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) +else() + add_custom_command( + COMMENT "`luacheck' is not found, so ${PROJECT_NAME}-luacheck target is dummy" + OUTPUT luacheck.ok + COMMAND touch luacheck.ok + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif() + +add_custom_target(${PROJECT_NAME}-luacheck DEPENDS luacheck.ok) + add_subdirectory(tarantool-tests) add_custom_target(${PROJECT_NAME}-test DEPENDS @@ -24,5 +54,6 @@ if(LUAJIT_USE_TEST) add_custom_target(test DEPENDS ${PROJECT_NAME}-test + ${PROJECT_NAME}-luacheck ) endif() -- 2.25.0