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 9C18270201; Sat, 6 Mar 2021 02:20:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9C18270201 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614986437; bh=V3AGSMFE04cI/qL5e/lXVHYuqyKMeTeGI2r/GXW7TrQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=JBbQgEUg2oxNrZXpUMdlXxJE9KaqUQXt9I576I2NAKskVQcdpgX/W5Qs+AUCwsZ9b +bqVEyXLmHFeyV9LVu5CckFJcavZ3pjWJgkTYg22Thv8QVNMU5qeAZTFrWIeiNaX94 2O35AvVdOzFFoA1yUT/k5cswG7zLJ2iCRC9Mkd/I= Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 0D5FC70201 for ; Sat, 6 Mar 2021 02:20:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0D5FC70201 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1lIJkJ-00038x-C6; Sat, 06 Mar 2021 02:20:36 +0300 To: Sergey Kaplun , Alexander Turenko Date: Sat, 6 Mar 2021 02:20:30 +0300 Message-Id: X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69B9676070C5F64E418DB309FBA590CF44700894C459B0CD1B91C759D3712C1E88F6D35DFF7F051DD396677C0ECB5D63E1DCE4EC1BF0D3C05BC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79A2E61952DECAF71EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637B97DA3EE4E90F98B8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCE6721B3320ED69CAEA3DF3391CCF0BD2F9B682B117323DC8389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0A29E2F051442AF778941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B652D31B9D28593E51CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FCB9CEE4F2B4A90F8475ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4930A3850AC1BE2E735F67BA0E7924E9B8DC4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20B2BFB33BE6C5446481410484038696C61 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CFC18DCDA8D01660490EC26B825CCB3AD7883428C43934B0E9C2B6934AE262D3EE7EAB7254005DCEDEC5C082DA6930ED81E0A4E2319210D9B64D260DF9561598F01A9E91200F654B06CE7B4E551862B828E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349EC559D073CA5B68388363F251FFBE480E923F8392612304A3AE834F7424CC511FA1FEF21C46C08B1D7E09C32AA3244CC6727D4C270CF75885A21061539196D3CE0B41342B755BCD927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXiRR0iLO9Wv+xBXdtDtB1UE X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822BFE2333FF69E365E3AF933AC5C85EC44A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit] test: fix luacheck invocation for non-real paths 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" Unfortunately, luacheck doesn't handle the working directory or one used in options if it is not a real path. As a result of this patch both PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR are resolved prior to be used within luacheck target custom command. The issue has been already fixed in Tarantool repo after applying af448464d15f60b87f1c9ef41a7816911c889459 ('tools: fix luacheck invocation in different cases'), and this patch is necessary, since is the dependency for Tarantool target. Relates to mpeterv/luacheck#208 Reported-by: Alexander Turenko Signed-off-by: Igor Munkin --- Branch: https://github.com/tarantool/luajit/tree/imun/luacheck-realpath CI is green on this branch (see the tick near the HEAD commit): https://github.com/tarantool/tarantool/tree/imun/fix-luacheck-invocation test/CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d166c9d8..c58a8ed5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,25 +5,33 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) find_program(LUACHECK luacheck) if(LUACHECK) - set(LUACHECK_RC ${PROJECT_SOURCE_DIR}/.luacheckrc) - file(GLOB_RECURSE LUACHECK_DEPS ${PROJECT_SOURCE_DIR}/*.lua) + # XXX: The tweak below relates to luacheck problem with paths. + # If the working directory or one used in luacheck options is + # not a real path, luacheck doesn't handle it the right way. + # Hence the paths used by luacheck in CMake ought to be resolved + # to the real ones. For more info, see the following issue. + # https://github.com/mpeterv/luacheck/issues/208 + get_filename_component(LUACHECK_SRCDIR "${PROJECT_SOURCE_DIR}" REALPATH) + get_filename_component(LUACHECK_BINDIR "${PROJECT_BINARY_DIR}" REALPATH) + set(LUACHECK_RC ${LUACHECK_SRCDIR}/.luacheckrc) + file(GLOB_RECURSE LUACHECK_DEPS ${LUACHECK_SRCDIR}/*.lua) add_custom_target(${PROJECT_NAME}-luacheck DEPENDS ${LUACHECK_RC} ${LUACHECK_DEPS} ) add_custom_command(TARGET ${PROJECT_NAME}-luacheck COMMENT "Running luacheck static analysis" COMMAND - ${LUACHECK} ${PROJECT_SOURCE_DIR} + ${LUACHECK} ${LUACHECK_SRCDIR} --codes --config ${LUACHECK_RC} # XXX: jit/vmdef.lua is an autogenerated Lua source, so # there is no need to run luacheck against it. Hence # explicitly exclude this file from the list for check. - --exclude-files ${LUAJIT_BINARY_DIR}/jit/vmdef.lua + --exclude-files ${LUACHECK_BINDIR}/src/jit/vmdef.lua # 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} + WORKING_DIRECTORY ${LUACHECK_SRCDIR} ) else() add_custom_target(${PROJECT_NAME}-luacheck) -- 2.25.0