From patchwork Fri Oct 21 09:44:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B935DC433FE for ; Fri, 21 Oct 2022 09:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbiJUJo5 (ORCPT ); Fri, 21 Oct 2022 05:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbiJUJop (ORCPT ); Fri, 21 Oct 2022 05:44:45 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D952F03B for ; Fri, 21 Oct 2022 02:44:44 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id bp11so3654792wrb.9 for ; Fri, 21 Oct 2022 02:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZAzJucFnMRyeHs/Ut9E5MxeuHuJxknekfU9e1yq0us4=; b=cmzF5MhTDKyNZ6LfWDg1c8OoZi1Z009qtstVlZVPLNxs2jcQigtG2JZH96IirxTxO4 UR/5LdZS5WUDvpUEn2vbnyYQbJyS7r9n4sancdKuOfRFlWXimS+xm70mwrX9Lxzlqt9P iK0g2ZL9SQZPIEbMtCywyKNr3RyCpfk6rXZSmOuDw2um4cPrXRoN8xEfJfiqE4pNvUzT qz5Ef/b1jKtV7gP2vT346+xDlMYkySlatd2zinsWBRtQWvFhuJoQnN5oO0C8ABuYcrDq ovWJFkhVdfRnslHoT7/Y+NUeK8VuQHAGelFFw7eONkYxuAb8EKNxy764TdDiMytBUhXI XhUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZAzJucFnMRyeHs/Ut9E5MxeuHuJxknekfU9e1yq0us4=; b=ue27wqlCcpT9lnNzwDhx/f+NHnGYh99rF0ecVC24jLSPperUZsx7Wc9G6/0H8RBq/p 7m01YZfAGcjRENDgkvzaqJLqonpfsnZPZx7kdghbLSHRuAngFiirS+GdZQsMcqze9PrR k76iTOFuW0a8TnfZLtlyUAA7cVb+WTtyzJWvv2Zr5Yub2AyK5BkyHZAurbGy9TTSpjHc K4XbpwUwjMzvqWUAXiQKCpNgMX69TaCuXLeYtb3k/+ujTAOubMZoLeXUazV6/D/qijSJ kwgSrpiA+WDnVJHtVeJzBCv5asUM6yBD5SK+wgk6oxWwMNTZJLQQnBqI1XkvzjoAI7H0 mbFg== X-Gm-Message-State: ACrzQf0oPGckuUfaxR5MHdHrQmr3gs3oVBznuG93+gVm9Dg5MCqVhk6y Hl/iFEGZb+F2RC5Q6bvn+PaZ+coPbmPK5g== X-Google-Smtp-Source: AMsMyM5TuB5oH7RfVza7x3HPwGMMKVkdJkpN1Z8Nkaweevg/R9u29aIy9PHdiWy8fiVWXKsSDsDW3w== X-Received: by 2002:adf:c601:0:b0:230:7cfa:b3fe with SMTP id n1-20020adfc601000000b002307cfab3femr11619984wrg.344.1666345482695; Fri, 21 Oct 2022 02:44:42 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:41 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 1/9] cmake: don't copy chainlint.pl to build directory Date: Fri, 21 Oct 2022 11:44:14 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When [1] made this copy of "chainlint.sed" the script was invoked in the test-lib.sh as: [...] sed -f "$GIT_BUILD_DIR/t/chainlint.sed" [...] But when [2] replaced "chainlint.sed" with a "chainlint.pl" it also replaced that "$GIT_BUILD_DIR" with "$TEST_DIRECTORY", invoking it as: "$PERL_PATH" "$TEST_DIRECTORY/chainlint.pl" "$0" So this line could have been deleted in [2] but wasn't. Let's do that now. 1. 7f5397a07c6 (cmake: support for testing git when building out of the source tree, 2020-06-26) 2. 23a14f30166 (test-lib: replace chainlint.sed with chainlint.pl, 2022-09-01) Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 787738e6fa3..fd0c6ef4971 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1083,7 +1083,6 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n" "file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})") #misc copies - file(COPY ${CMAKE_SOURCE_DIR}/t/chainlint.pl DESTINATION ${CMAKE_BINARY_DIR}/t/) file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/) file(COPY ${CMAKE_SOURCE_DIR}/mergetools/tkdiff DESTINATION ${CMAKE_BINARY_DIR}/mergetools/) file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-prompt.sh DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) From patchwork Fri Oct 21 09:44:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F498C433FE for ; Fri, 21 Oct 2022 09:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbiJUJpD (ORCPT ); Fri, 21 Oct 2022 05:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbiJUJor (ORCPT ); Fri, 21 Oct 2022 05:44:47 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03712357CC for ; Fri, 21 Oct 2022 02:44:46 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id bh7-20020a05600c3d0700b003c6fb3b2052so1618534wmb.2 for ; Fri, 21 Oct 2022 02:44:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qSvc5V+ula3OLaS92rj7OLVYmWSqPp/M2w75EqGBo7g=; b=qL6U+iPC3I5J8IFF6+zsNN5bSqg0qwckVmXRKaSn25e2JZue5eUM/nFwVjLPx9/cQu BRE5ZJ/oC5oOAavuZXfIny2ha2wDthyHpJpxxmqSHmXL9M2tMNIwD+FOFXJAttAbFfYc zlQdmetGTzTO0Skfeslxp1cunFpbT9jtTlqmJO9Dn1UZ/ia79YNXrGVszyz98TanrmPn b9gTAETC8aeabnNaR1NsaWYnSXV18is2AC9BAyVqf0TdhgK3r/1ijVbHuuwsYN4vGdmK FH1aiXCy7ynji02yAu0DaqYXoVBL1eTnZt34AvglVeIZtZZTm9Z4RmJg5+jT7+ueejau DLzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qSvc5V+ula3OLaS92rj7OLVYmWSqPp/M2w75EqGBo7g=; b=TuKjY9PMSIOQLzVQ/2mYfP3qpC6ktaOa63oNzttxUfIlzfjxpfDfs3yCG/e3+N7cXN rXPo1ecbWxJeIqy1+nUpGr7eSzgqoHJI9s3FyG9LMQGW2E5olC+AR7b/LVLTohcTC+5j rvSNrG3cS0JByzOtqlt5l8c9+mWzCTbko7ShuLuiQepYHE7qCGHXLlSTuJTkTmvJzGcl OhyY2Iry1ORsne0FeY4O3Kv3OGC7Laba+dPD/a7Z7Is9D3ybXEb+zNLKhQVf7r9ogLu7 08VXkaJP4GIjmqVIZ6kdHdQrCBzKWjAaR+kzcBq8HqLuXTUt6pzTssqkr9dnrSOvrWRV n4Vw== X-Gm-Message-State: ACrzQf18qcSnCfUnERJdp0aT8u71UbvoETicUFfIp14jF+7iALfswSz4 5Ezr0MN8hGyMWqJcMuTLIbBrrS85aootsQ== X-Google-Smtp-Source: AMsMyM4/DeHGz1duHYr80AzTYe3m/Chb9vZ6DpVi57bBLDC83mmX4E8IKZegAe8f/jhT4Q7TMbe6iA== X-Received: by 2002:a05:600c:4e0e:b0:3c6:fbc5:e2c3 with SMTP id b14-20020a05600c4e0e00b003c6fbc5e2c3mr14098704wmq.120.1666345483988; Fri, 21 Oct 2022 02:44:43 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:43 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 2/9] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4 Date: Fri, 21 Oct 2022 11:44:15 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The cmake recipe added in [1] did not create the bin-wrappers/* directory, and thus fell back on running the tests with the equivalent of "--no-bin-wrappers". Thus the. "t/test-lib.sh" would be unable to find "bin-wrappers/git", and we'd fall back on "GIT_EXEC_PATH=$GIT_BUILD_DIR" using the fallback behavior added in [2]: $ ./t0001-init.sh /t/../contrib/buildsystems/out/bin-wrappers/git is not executable; using GIT_EXEC_PATH Or rather, this is what would have happened on *nix, but until [3] there wasn't any non-Windows support for "cmake". On Windows it didn't matter that the bin-wrappers weren't made executable, since there's no executable bit, instead the emulation layer looks at whether a file has a shebang. But with [3] we've effectively used the semi-equivalent of "--no-bin-wrappers" unintentionally on *nix, and furthermore because we didn't make these executable In addition, we'd fail any test that needed to invoke one of our built shell, perl or Python scripts on *nix. E.g. t0012-help.sh would fail on a test that tried to invoke "git web--browse". I.e. the equivalent of this (in the "out" directory) would happen: $ ./git --exec-path=$PWD web--browse git: 'web--browse' is not a git command. See 'git --help'. Which we can fix by "chmod +x"-ing the built "git-web--browse": $ chmod +x git-web--browse $ ./git --exec-path=$PWD web--browse usage: git web--browse [--browser=browser|--tool=browser] [--config=conf.var] url/file ... The same goes for e.g. the "git-p4" tests, which would fail because our built "git-p4" wasn't executable, etc. This change should ideally use file(CHMOD ...), but that's much newer than our required cmake version[1]. 1. a30e4c531d9 (Merge branch 'ss/cmake-build', 2020-08-11) 2. e4597aae659 (run test suite without dashed git-commands in PATH, 2009-12-02) 3. f31b6244950 (Merge branch 'yw/cmake-updates', 2022-06-07) 4. https://cmake.org/cmake/help/latest/command/file.html#chmod Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index fd0c6ef4971..464c41a1fdf 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -836,6 +836,7 @@ foreach(script ${git_shell_scripts}) string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}") string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/${script}) endforeach() #perl scripts @@ -851,12 +852,14 @@ foreach(script ${git_perl_scripts}) string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/${script}) endforeach() #python script file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) +execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/git-p4) #perl modules file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") @@ -995,6 +998,7 @@ foreach(script ${wrapper_scripts}) string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) + execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/bin-wrappers/${script}) endforeach() foreach(script ${wrapper_test_scripts}) @@ -1002,12 +1006,14 @@ foreach(script ${wrapper_test_scripts}) string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) + execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/bin-wrappers/${script}) endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content}) +execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver) #options for configuring test options option(PERL_TESTS "Perform tests that use perl" ON) From patchwork Fri Oct 21 09:44:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA46C433FE for ; Fri, 21 Oct 2022 09:45:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbiJUJpP (ORCPT ); Fri, 21 Oct 2022 05:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJUJou (ORCPT ); Fri, 21 Oct 2022 05:44:50 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A77684D4E0 for ; Fri, 21 Oct 2022 02:44:47 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id m29-20020a05600c3b1d00b003c6bf423c71so4646287wms.0 for ; Fri, 21 Oct 2022 02:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cz0cCGYVraKe+/v8uEtLjpfkjbjbNPYRObn3gUUIYtM=; b=KMyXh7EbNQ5Yo2Lgg+cfjE0g9A8MmQIJJVvGjc8Cjc6DuVn6MjZs89nBCa/NrT1AeF Sw9dZjXCPxSuhVWGtmXvLRfyDVC4ttuUwdgdR6Oh6xixHmVe6cFOFCz5zu2cAPoWtFHf xeCSFzeG987RZDDJut83RzWDwmgtbFjXQydAs4E5Ji/wMr5rn+VkQJjj0k7R+wi4SF+H yVs+czMAIWCILoi48ddlOPRBq+uciAVvI3z6nw0njHpBfxQFvMJXn3yBe0zUAS54Ky01 3Y9LHKa3yu9Md2Hal3CslDi0OKLvBIv3ga8QHzm0X0BWC1OOtDftHb9zZLesvma9VNEq uOtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cz0cCGYVraKe+/v8uEtLjpfkjbjbNPYRObn3gUUIYtM=; b=yBIMy1Gz1vjdjtWr/S4tu6ltq0nLJ0qFxA/Yk3b46ozp9Li7ZQwImSpBvDTagqmet+ sO7+OtKvdOw5l+a/WlHZMvtK7AZQ47ZzkNKmAs3dGY11xaysFjhoOlxhFui/b9ilg9HP NBGDVlH+8TmYPVGwgWbSOwqLJYtPLV0pyzDIA98ViRdu0tyz/2z5CaQdfrryYlmsyc7d kMpBAKBHnHQydANvMB0hIauRVJlqG/y0rR7BKf5MFmoyvaF4TsLdeObv5nDO8GuJkVNb K6A6DG0VMFd4YBLY1KIwtyHiZ0ua9iUK99HZxkryXSbvi622fogQCn+E6re5u25e3x0f +Z+g== X-Gm-Message-State: ACrzQf0sAKzYmtErohyA+1+MYkHsq6jgJbANQs+uVIDyYrJS+xV3uCxQ UBiJNVsKqqJEfo9JHv7CKUCfmXn4LYS1YA== X-Google-Smtp-Source: AMsMyM42q4ZpEyly674ALUUam4u26WoIbhbMPhnKtRAbbOP4nht9rdCM2ao0wNbp1PW300HK51W6ug== X-Received: by 2002:a05:600c:3781:b0:3a6:804a:afc with SMTP id o1-20020a05600c378100b003a6804a0afcmr32724610wmr.27.1666345485218; Fri, 21 Oct 2022 02:44:45 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:44 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 3/9] cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable Date: Fri, 21 Oct 2022 11:44:16 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When git is built and tested with cmake & ctest we usually do that outside of the top-level source directory. E.g. cmake -S contrib/buildsystems -B contrib/buildsystems/out make -C contrib/buildsystems/out ctest -j$(nproc) --test-dir contrib/buildsystems/out Since the test-lib.sh makes assumptions about the TEST_DIRECTORY being the "t" subdirectory of the top-level "$GIT_BUILD_DIR", the cmake recipe has needed to copy various assets to that "contrib/buildsystems/out" directory. Let's instead teach the test-lib.sh that there's such a thing as the "$GIT_SOURCE_DIR" distinct from the "$GIT_BUILD_DIR". Just as the "$TEST_DIRECTORY" always points to our actual "t" directory (not the "[...]/out/t" cmake creates), this new "$GIT_SOURCE_DIR" will always be the top-level source directory. So even though the "GIT_BUILD_DIR=(.*)" line in t/test-lib.sh will still be altered by CMakeLists.txt, that recipe will no longer need to copy over various things from our source directory, as the tests now know where to find those assets. Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 5 ----- t/lib-gettext.sh | 2 +- t/lib-gitweb.sh | 2 +- t/t7609-mergetool--lib.sh | 2 +- t/t9902-completion.sh | 14 +++++++------- t/t9903-bash-prompt.sh | 2 +- t/test-lib.sh | 12 ++++++++++-- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 464c41a1fdf..84f5132f1ee 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1088,11 +1088,6 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh content NEWLINE_CONSUME)\n" "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n" "file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})") - #misc copies - file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/) - file(COPY ${CMAKE_SOURCE_DIR}/mergetools/tkdiff DESTINATION ${CMAKE_BINARY_DIR}/mergetools/) - file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-prompt.sh DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) - file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-completion.bash DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) endif() file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh index cc6bb2cdeaa..dcd6e9c3f75 100644 --- a/t/lib-gettext.sh +++ b/t/lib-gettext.sh @@ -7,7 +7,7 @@ . ./test-lib.sh GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" -GIT_PO_PATH="$GIT_BUILD_DIR/po" +GIT_PO_PATH="$GIT_SOURCE_DIR/po" export GIT_TEXTDOMAINDIR GIT_PO_PATH if test -n "$GIT_TEST_INSTALLED" diff --git a/t/lib-gitweb.sh b/t/lib-gitweb.sh index 1f32ca66ea5..6f68df247af 100644 --- a/t/lib-gitweb.sh +++ b/t/lib-gitweb.sh @@ -49,7 +49,7 @@ EOF error "Cannot find gitweb at $GITWEB_TEST_INSTALLED." say "# Testing $SCRIPT_NAME" else # normal case, use source version of gitweb - SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl" + SCRIPT_NAME="$GIT_SOURCE_DIR/gitweb/gitweb.perl" fi export SCRIPT_NAME } diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh index 8b1c3bd39f2..2090d12a489 100755 --- a/t/t7609-mergetool--lib.sh +++ b/t/t7609-mergetool--lib.sh @@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'mergetool --tool=vimdiff creates the expected layout' ' - . "$GIT_BUILD_DIR"/mergetools/vimdiff && + . "$GIT_SOURCE_DIR"/mergetools/vimdiff && run_unit_tests ' diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 43de868b800..1bd4cae92fe 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -33,7 +33,7 @@ complete () GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr rebase ls-files' GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout rebase' -. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" +. "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" # We don't need this function to actually join words or do anything special. # Also, it's cleaner to avoid touching bash's internal completion variables. @@ -2567,7 +2567,7 @@ test_expect_success 'sourcing the completion script clears cached commands' ' ( __git_compute_all_commands && verbose test -n "$__git_all_commands" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && verbose test -z "$__git_all_commands" ) ' @@ -2576,7 +2576,7 @@ test_expect_success 'sourcing the completion script clears cached merge strategi ( __git_compute_merge_strategies && verbose test -n "$__git_merge_strategies" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && verbose test -z "$__git_merge_strategies" ) ' @@ -2587,7 +2587,7 @@ test_expect_success 'sourcing the completion script clears cached --options' ' verbose test -n "$__gitcomp_builtin_checkout" && __gitcomp_builtin notes_edit && verbose test -n "$__gitcomp_builtin_notes_edit" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && verbose test -z "$__gitcomp_builtin_checkout" && verbose test -z "$__gitcomp_builtin_notes_edit" ) @@ -2599,7 +2599,7 @@ test_expect_success 'option aliases are not shown by default' ' test_expect_success 'option aliases are shown with GIT_COMPLETION_SHOW_ALL' ' ( - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && GIT_COMPLETION_SHOW_ALL=1 && export GIT_COMPLETION_SHOW_ALL && test_completion "git clone --recurs" <<-\EOF --recurse-submodules Z @@ -2610,7 +2610,7 @@ test_expect_success 'option aliases are shown with GIT_COMPLETION_SHOW_ALL' ' test_expect_success 'plumbing commands are excluded without GIT_COMPLETION_SHOW_ALL_COMMANDS' ' ( - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && sane_unset GIT_TESTING_PORCELAIN_COMMAND_LIST && # Just mainporcelain, not plumbing commands @@ -2622,7 +2622,7 @@ test_expect_success 'plumbing commands are excluded without GIT_COMPLETION_SHOW_ test_expect_success 'all commands are shown with GIT_COMPLETION_SHOW_ALL_COMMANDS (also main non-builtin)' ' ( - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && GIT_COMPLETION_SHOW_ALL_COMMANDS=1 && export GIT_COMPLETION_SHOW_ALL_COMMANDS && sane_unset GIT_TESTING_PORCELAIN_COMMAND_LIST && diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index d459fae6551..06f0abfc294 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -10,7 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./lib-bash.sh -. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" +. "$GIT_SOURCE_DIR/contrib/completion/git-prompt.sh" actual="$TRASH_DIRECTORY/actual" c_red='\\[\\e[31m\\]' diff --git a/t/test-lib.sh b/t/test-lib.sh index 6ca68311eb9..d2e5dee6c89 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -41,7 +41,13 @@ then # elsewhere TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY fi -GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" + +# The GIT_{SOURCE,BUILD}_DIR is always the same, except when +# CMakeLists.txt replaces the "GIT_BUILD_DIR" line with the path to +# its build directory. +GIT_SOURCE_DIR="${TEST_DIRECTORY%/t}" +GIT_BUILD_DIR="$GIT_SOURCE_DIR" + if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2 @@ -1437,7 +1443,7 @@ then make_valgrind_symlink $file done # special-case the mergetools loadables - make_symlink "$GIT_BUILD_DIR"/mergetools "$GIT_VALGRIND/bin/mergetools" + make_symlink "$GIT_SOURCE_DIR"/mergetools "$GIT_VALGRIND/bin/mergetools" OLDIFS=$IFS IFS=: for path in $PATH @@ -1490,6 +1496,8 @@ GIT_CONFIG_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.." export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM GIT_CEILING_DIRECTORIES +MERGE_TOOLS_DIR="$GIT_SOURCE_DIR/mergetools" +export MERGE_TOOLS_DIR if test -z "$GIT_TEST_CMP" then From patchwork Fri Oct 21 09:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CB8EC4332F for ; Fri, 21 Oct 2022 09:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbiJUJpE (ORCPT ); Fri, 21 Oct 2022 05:45:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbiJUJou (ORCPT ); Fri, 21 Oct 2022 05:44:50 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A274F679 for ; Fri, 21 Oct 2022 02:44:49 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id iv17so1803227wmb.4 for ; Fri, 21 Oct 2022 02:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o9+HH8WhbvTFqa2GaTipptruhLSRoUinWGbJ30MnGcA=; b=h5sODOZleyE/mZgfpb+cwohbFXY3ujci+Dw45ncKpdf+7Bfnc2Q7uIaZ2M07p9+H9f 2utvawWGOIQsuDcd+Fw2YMKzy1K62/2GJAhWwqz6BkizEDGx16ZXtFeAQRHQfpZQVtsK 4DGuyAj0bGekDgf4ONYomcZyGIlVtFBcU5iTwXppvcYM9ahTkY8fxqun/CnMTPIAn1oZ On+Rs50PrViTt6L1BxB5Aj5AclGPTuZ8tby44iXQxlv1Xy+DVZNaksher1c5CtyH+y5R erGntz47RHmCjRvuf/uBQnkVoCV/mnvKq1v6eMcmSnwf0sYAanPBot238Qo4fRaAD+0H fBkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o9+HH8WhbvTFqa2GaTipptruhLSRoUinWGbJ30MnGcA=; b=luC4+4OWLUxY0hsyy7Q1QNbjHDDOM/yyAQ8AfYETWQ8HaFn34fgcOuaN/aUd9IzhcQ dAbMbRJlQZnUQK9dosNBkmsz7SHYsZ0/9sWo6T+EbsrCdlli0FLBmKeMEbR0/FdYL+AB yZsQujWtii7Rrf03GnGT/GnYaaJMiG37jtnoA+tNWm4RkaTWG//ORtRlaVCx/U3CA57m n+BKk30DRXLFoFdepZVNGneQiDNwGWCG8qipZGSmKfLIJbqZy3WGlUBEVzxge6ZCGJZr +qtBRmDibZzzPddwtDe3y1txxSAs8X3m2AO3pN7wyoqWUVWeoi7p+g2NnVOxuFD7yXJt S65Q== X-Gm-Message-State: ACrzQf3kXVM43iLpiez/R1t231CGlFzbTLKdNJ17D/xtVM1kxwo2PQAw VD1T8AscB7FMgqbFcLjNPZ/avst49SG24w== X-Google-Smtp-Source: AMsMyM4KrF/4T1UUZp/CqO5OnCXtulf5AFAbBCfW4+f312LLPXYgFi/tOiLIP7Q40K5shnwIlif45A== X-Received: by 2002:a05:600c:5488:b0:3b5:634:731 with SMTP id iv8-20020a05600c548800b003b506340731mr31691776wmb.188.1666345487125; Fri, 21 Oct 2022 02:44:47 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:45 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 4/9] cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh Date: Fri, 21 Oct 2022 11:44:17 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When we build with libpcre2 which cmake has supported since [1] we need to set "USE_LIBPCRE2='YesPlease'" (or similar) in "GIT-BUILD-OPTIONS". Without this e.g. t7810-grep.sh will fail, as it has tests that rely on the behavior of !PCRE2. The reason this hasn't been noticed is that the Windows CI doesn't have access to libpcre2. 1. 80431510a2b (cmake: add pcre2 support, 2022-05-24) Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 84f5132f1ee..725b3f2ac82 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1063,6 +1063,9 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n") +if(PCRE2_FOUND) + file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "USE_LIBPCRE2='YesPlease'\n") +endif() file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n") From patchwork Fri Oct 21 09:44:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28B8BC4332F for ; Fri, 21 Oct 2022 09:45:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbiJUJpI (ORCPT ); Fri, 21 Oct 2022 05:45:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbiJUJox (ORCPT ); Fri, 21 Oct 2022 05:44:53 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B31F53D3B for ; Fri, 21 Oct 2022 02:44:50 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id t4so1797314wmj.5 for ; Fri, 21 Oct 2022 02:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X7rTc9afT8kKVrl1GEBHFdGlVFf9240J6lL2o5/MyKE=; b=dy+1dB9SsVYkOOy7Qpv83qXCf3dc5599rEArqf5UDU8QuavKyPChWuc/SWy3xF0YSr 0W2XMOIGhWr3hZYU6dL/+jB9Cr3SF4ArCL79VPG0gd5cG+KNSxKwTn0uYPzbM1CAC23w 1aHhMN31sKpm3Ayb/qVvI2TOwab7zDLW0u4hFQ6w2PSVDR+zVQvZ8pXk1A+XQfHLN35D FLVyld0TNx/T0Jarr77gNU784VlDEhBeUwDYuazt7RyXP6x86P0lmB3dyz7Znyf1Fo+T mZeSTcjTW8byRV41TB2JGKc9uBHhmDV9ITWDibebyixBL45b3MG35RYGgYl2NV/rdR5p nQaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X7rTc9afT8kKVrl1GEBHFdGlVFf9240J6lL2o5/MyKE=; b=cyQKahG9wI0vlYZNvK/kCScFFkPfZ4e3tIK+vXYGtfGjTQ4CUX1Mh8An0dQ1vxtd1H hhmuijFaVI6jNoxuuZ/gwkeih3dIZoXBdJjUU8Olb4HIYraN4BRkh8CnCKbv1beB8QKz 82UKWpH6LReD9PiOL93bwnio2aQsI1AANCyW603nxR/nAz0QmkvyuqnzAsHLgMPjJpDq ZcgP7y15FEMacLuz5Zn9dsV31j+jZEv198E//lmBdiKJMK4Wme0ufjDShTmZiUTgX/v3 bsitC/jjUSl/FyLelEuylhSf8QsbmL3vBDP0ek62r1Eo6km0oabRBa7m6W+wMx8E91XR 0paw== X-Gm-Message-State: ACrzQf10o3GGTEhLtdWUfpfbKYpe+fDvOqwNraz8+qNXRwCiNlIKtv7J ZkIXRZjmRJOdCvU23BrpH4Z5u9LqNkHL1g== X-Google-Smtp-Source: AMsMyM6Aedu/BpVjtL8UBxz4WJ8TUvCiOFSIinFCVQmE009/kNMl9SzFyjoUJT6DnENez4zBmy9zgQ== X-Received: by 2002:a05:600c:5122:b0:3c6:fcce:e4e2 with SMTP id o34-20020a05600c512200b003c6fccee4e2mr13247703wms.65.1666345488979; Fri, 21 Oct 2022 02:44:48 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:48 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 5/9] test-lib.sh: support a "GIT_TEST_BUILD_DIR" Date: Fri, 21 Oct 2022 11:44:18 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Compliment the existing GIT_TEST_INSTALLED variable added in [1] with one that allows for testing a git built in a directory that's not "../". Instead of "test this installed git" ("GIT_TEST_INSTALLED"), this new "GIT_TEST_BUILD_DIR" is a "test this built directory over there". E.g. this will pass all tests: git clone --depth=1 https://github.com/git/git.git git1 cp -R git1 git2 make -C git1 [apply this change to git2] (cd git2 && GIT_TEST_BUILD_DIR="$PWD/../git1" make -C t prove) 1. 6720721e152 (test-lib.sh: Allow running the test suite against installed git, 2009-03-16) Signed-off-by: Ævar Arnfjörð Bjarmason --- t/README | 3 +++ t/test-lib.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/t/README b/t/README index 979b2d4833d..fc0daef2e41 100644 --- a/t/README +++ b/t/README @@ -231,6 +231,9 @@ override the location of the dashed-form subcommands (what GIT_EXEC_PATH would be used for during normal operation). GIT_TEST_EXEC_PATH defaults to `$GIT_TEST_INSTALLED/git --exec-path`. +Similar to GIT_TEST_INSTALLED, GIT_TEST_BUILD_DIR can be pointed to +another git.git checkout's build directory, to test its built binaries +against the tests in this checkout. Skipping Tests -------------- diff --git a/t/test-lib.sh b/t/test-lib.sh index d2e5dee6c89..41b1ddc96ff 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -47,6 +47,10 @@ fi # its build directory. GIT_SOURCE_DIR="${TEST_DIRECTORY%/t}" GIT_BUILD_DIR="$GIT_SOURCE_DIR" +if test -n "$GIT_TEST_BUILD_DIR" +then + GIT_BUILD_DIR="$GIT_TEST_BUILD_DIR" +fi if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then From patchwork Fri Oct 21 09:44:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74514C4332F for ; Fri, 21 Oct 2022 09:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbiJUJpL (ORCPT ); Fri, 21 Oct 2022 05:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbiJUJo4 (ORCPT ); Fri, 21 Oct 2022 05:44:56 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA0F75B114 for ; Fri, 21 Oct 2022 02:44:52 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id j7so4017779wrr.3 for ; Fri, 21 Oct 2022 02:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A8a07RweeAC4SY9M9CTA6fM/wGrBUzjtws6yKUa3toc=; b=KUE+BdAtTZLEUH75Nai1GLgfMkPmds/qaKCpjUcJvZEqrSEfCUhFZmVLpbKXyV+y/o 8V/LB6ZMsmnNNcIWNiMqu2A0slvYOhJWXRYf00aJ67Y9tSIAAQsYQdhQPC9YYu1l2Ilc Upe1k7VJu1PA17x9aaGjgWKgdqodkS2WZvx+lk9R2zFMxz9YkDOyXd9XXftlpfNK0lgj KQ9U4e4hSSxrnUDic2AXjmWUKRhoHRcqVmQRgzKOSV7VmD+JOkvflojmFQjYOtpuUPqa AKmvRr1IU0/GzgE5dnaALEt7bZAESYsNQDOTRed2BWnUf/o11POBghw3VEmw2X1MqtrD L4oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A8a07RweeAC4SY9M9CTA6fM/wGrBUzjtws6yKUa3toc=; b=c34rkDFVoHc7woSvCh17DHrTvGVio5080cdCLiSo8YuT/YDnnIGbpkYDxyD1+1fxoU RRgi+q0OqQ/pJsAhGvl4CkaKFE4rMER/0ugOItvgnDXiTL02VmV9VIyTF2Zp9XfoLt0N jOXrPCTW38gWcV3wRBqe+fjaH/G8NsKo3FQ61TviEiDfm83U/qYHx77NRp3KiwZSAeUB 9pUnuSBgxlpztg+P/5fFTTkj24Gf6k5tMic0xCvlXdnX+QM4o3VsdoYlj6fyLmQUQ+iS Un85rENdJQ3Qgyk7OlvB9rYsAs3seQCk1ouS2ZwRex+wx/a9gjggG+vYr+zffq5b8Ejn +rtw== X-Gm-Message-State: ACrzQf3KwIj2TDYqyKAaLyx+5rB+HFiOLKD/L7HhfX+J18qNJk/BYW9g CUtV+HErujDJuyG7Y/zCjqVT6NbUiLyoWQ== X-Google-Smtp-Source: AMsMyM5DzttYKCM2gXfEQ3LZ9w3tAzZQuGghHUIsREp1N1dUnRD6FJqwRiWffWA0M8hcoPA91bY2kQ== X-Received: by 2002:adf:fac5:0:b0:235:af88:d8db with SMTP id a5-20020adffac5000000b00235af88d8dbmr5363310wrs.700.1666345490113; Fri, 21 Oct 2022 02:44:50 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:49 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin Subject: [PATCH 6/9] cmake: use GIT_TEST_BUILD_DIR instead of editing hack Date: Fri, 21 Oct 2022 11:44:19 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When cmake builds git in "contrib/buildsystems/out" it will create a "t/" directory there containing only the "t/helper/test-tool", but for running the tests with "cmake" it cd's to the "real" t/ directory, and runs the tests from there. To get the test-lib.sh to locate "git" and other binaries in "../contrib/buildsystems/out/" rather than "../" we have since [1] been editing the "GIT_BUILD_DIR" assignment in test-lib.sh in-place. This has meant that when testing cmake we've had to "git reset --hard" before running "make" again. What this build infrastructure really wanted was some feature like the "GIT_TEST_BUILD_DIR" variable added in the preceding commit, so let's make use of it. Even though "ctest" will work with this approach, one advantage of the previous arrangement was that we could: A. Build with cmake B. cd t C. Run a test And have the test itself know to locate and use the cmake binaries, this workflow was documented in [2]. The "t/test-lib".sh modification here is so that we can support this use-case. As [3] notes "contrib/buildsystems/out" isn't just the directory that happens to be documented in "contrib/buildsystems/CMakeLists.txt", but the one that VS will use when building git. To make it clear what's happening we emit a "setup: " from the test-lib.sh to note that we used this fallback method: $ ./t0001-init.sh setup: had no ../git, but found & used cmake built git in ../contrib/buildsystems/out/git ok 1 - plain [...] Note: the "On Windows[...]" part of this is lifted from [4]. 1. 7f5397a07c6 (cmake: support for testing git when building out of the source tree, 2020-06-26) 2. f2f1250c47f (cmake (Windows): recommend using Visual Studio's built-in CMake support, 2020-09-30) 3. 3eccc7b99d4 (cmake: ignore files generated by CMake as run in Visual Studio, 2020-09-25) 4. https://lore.kernel.org/git/5b0c2a150e9fce1ca0284d65628b42ed5a7aad9a.1666090745.git.gitgitgadget@gmail.com/ Signed-off-by: Johannes Schindelin Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 15 +-------------- t/test-lib.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 725b3f2ac82..91b7009f4fd 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1080,25 +1080,12 @@ if(USE_VCPKG) file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") endif() -#Make the tests work when building out of the source tree -get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE) -if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) - file(RELATIVE_PATH BUILD_DIR_RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CMakeCache.txt) - string(REPLACE "/CMakeCache.txt" "" BUILD_DIR_RELATIVE ${BUILD_DIR_RELATIVE}) - #Setting the build directory in test-lib.sh before running tests - file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake - "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh GIT_BUILD_DIR_REPL REGEX \"GIT_BUILD_DIR=(.*)\")\n" - "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh content NEWLINE_CONSUME)\n" - "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n" - "file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})") -endif() - file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") #test foreach(tsh ${test_scipts}) add_test(NAME ${tsh} - COMMAND ${SH_EXE} ${tsh} + COMMAND env GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR} ${SH_EXE} ${tsh} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t) endforeach() diff --git a/t/test-lib.sh b/t/test-lib.sh index 41b1ddc96ff..284b619708a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -47,9 +47,21 @@ fi # its build directory. GIT_SOURCE_DIR="${TEST_DIRECTORY%/t}" GIT_BUILD_DIR="$GIT_SOURCE_DIR" +GIT_AUTO_CONTRIB_BUILDSYSTEMS_OUT= if test -n "$GIT_TEST_BUILD_DIR" then GIT_BUILD_DIR="$GIT_TEST_BUILD_DIR" +elif ! test -x "$GIT_BUILD_DIR/git" && + test -x "$GIT_BUILD_DIR/contrib/buildsystems/out/git" +then + GIT_BUILD_DIR="$GIT_SOURCE_DIR/contrib/buildsystems/out" + GIT_AUTO_CONTRIB_BUILDSYSTEMS_OUT=t + # On Windows, we must convert Windows paths lest they contain a colon + case "$(uname -s)" in + *MINGW*) + GIT_BUILD_DIR="$(cygpath -au "$GIT_BUILD_DIR")" + ;; + esac fi if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" @@ -1630,6 +1642,13 @@ remove_trash_directory "$TRASH_DIRECTORY" || { BAIL_OUT 'cannot prepare test area' } +# Emitting this now because earlier we didn't have "say", but not in +# anything using lib-subtest.sh +if test -n "$GIT_AUTO_CONTRIB_BUILDSYSTEMS_OUT" && test -t 1 +then + say "setup: had no ../git, but found & used cmake built git in ../contrib/buildsystems/out/git" +fi + remove_trash=t if test -z "$TEST_NO_CREATE_REPO" then From patchwork Fri Oct 21 09:44:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014536 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69561C433FE for ; Fri, 21 Oct 2022 09:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbiJUJpR (ORCPT ); Fri, 21 Oct 2022 05:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbiJUJo5 (ORCPT ); Fri, 21 Oct 2022 05:44:57 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA3895B120 for ; Fri, 21 Oct 2022 02:44:53 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id az22-20020a05600c601600b003c6b72797fdso1596064wmb.5 for ; Fri, 21 Oct 2022 02:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XYcE6xGeUwBbeECJtV5C8gwPnWc3fhgSUo3uW37+SmY=; b=p58YkrXaVzUdsFZ3vSbecTRZ5404nzawsl7KlKpZWKXIc4TZFCs1AatqL6+8OpNq2A 0kTTHLC96LYMQkjTTonSoFrzqgwqJ/ezoRP/2iIHoU2jyahMVOcKLp2IKxN+48Y2tRrj u85cJN/qeg1RdBhRGFveeXHsnRFI+7aG1zLWNVEESX6vU4aRoXbc4SPhRzxOolvfO1xy i/jUH8px7oKhx2hkxCq/pLJ9prbmKdtAPm84T2CtnVtvvnqsnDKQzErMj4/y9i17uDSu 2zm9BTWOgtsr/+E+YCiVypmaxEY3BrtSBVCFRlRDcD8m+SotQMcQGgP8cFLwy9Ti6v4t TgoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XYcE6xGeUwBbeECJtV5C8gwPnWc3fhgSUo3uW37+SmY=; b=0zIg84UXQJn64t8Igb88GQTOcaQaWaefh58jqhLHt7rWziIHiiLKxXuCr7+0TYTTE9 sx9EwxzmUt/CgdV7JjYypSGmN4HHHHgWHhJQYGfX9tUhQhFMPmbQLCG5PGLplNzBrf1h msxmUqu4iM2eiye+dQuUWaympsa692CzmGrVM7LccvvUURj7DxRcRJKcmj58O9t9hl7n oUBtKGXrpVoibZ0aA88uVhbAAl2iNaWGxrFFIrw/atMPTYXAAj9wXS7I1HF/PHDUlIl9 Ysm5b5/jXzwSCpu4k3XgOJM7Y7puwS/ZA4AAX/6HwaL7SKCEOwlkYKqB5vDk0mulnq/x 3N3A== X-Gm-Message-State: ACrzQf3+DAepYzzGSjsvTR0D1b6T3v48R5g6HFBIy8Wx/efMuVZ3jK1p 83p/OkGD9MVMmlwE+EewxHwJLbKGQLR+3Q== X-Google-Smtp-Source: AMsMyM4YhIDE6ehGDvtY1QtZduQXDzBCEEXNCH/b/1F5FAw0pmn0EjfbBoQ6PAIz7/GJQwpWq40cWA== X-Received: by 2002:a05:600c:3d8e:b0:3c6:e58d:354f with SMTP id bi14-20020a05600c3d8e00b003c6e58d354fmr25257912wmb.176.1666345491442; Fri, 21 Oct 2022 02:44:51 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:50 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 7/9] cmake: support using GIT_TEST_OPTS from the environment Date: Fri, 21 Oct 2022 11:44:20 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Get "GIT_TEST_OPTS" from the environment, and use it to pass arguments to tests. This allows for passing arguments to tests with e.g.: GIT_TEST_OPTS="--verbose --debug" cmake .; ctest -R t0001 --verbose There's some overlap with this and what was suggested in [1], but as noted there we're not passing "--verbose" and friends unconditionally, so a plain "ctest" invocation without a "cmake" re-build won't pick up the options. 1. https://lore.kernel.org/git/356b2e9a1007bcd1382f26f333926ff0d5b9abe2.1666090745.git.gitgitgadget@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 91b7009f4fd..8e29e3f514b 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1083,9 +1083,11 @@ endif() file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") #test +set(GIT_TEST_OPTS "$ENV{GIT_TEST_OPTS}") +separate_arguments(GIT_TEST_OPTS) foreach(tsh ${test_scipts}) add_test(NAME ${tsh} - COMMAND env GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR} ${SH_EXE} ${tsh} + COMMAND env GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR} ${SH_EXE} ${tsh} ${GIT_TEST_OPTS} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t) endforeach() From patchwork Fri Oct 21 09:44:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D714FC4332F for ; Fri, 21 Oct 2022 09:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbiJUJpU (ORCPT ); Fri, 21 Oct 2022 05:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbiJUJo5 (ORCPT ); Fri, 21 Oct 2022 05:44:57 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D4875B715 for ; Fri, 21 Oct 2022 02:44:54 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id v130-20020a1cac88000000b003bcde03bd44so4597064wme.5 for ; Fri, 21 Oct 2022 02:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+AvNC3ufAy6nz1AhQKG6yQlu93HAj7/vPoazT5NjMqM=; b=Cv+8CuvFFMoJOu7C14bhH2H+F8/vAqAHf1aPaygGC7rWvq0LaHRtTTAhQfDr23b74R p6AJW3pZwz1Kwp9iQ7dgcrZxoe3VZsR07qysOAnvXwGpM45zPHU6b+CvDE46VR3+s5bs XS6ZJ/mnAYyvwZ6EB0Nxn4Wl9aki4lz2CIYfw43nRA7LB/JrrGPqoAVvMZJCN/0bodcS iRPIPo37zeUQGJLYzAHrOECI+WhhMBjvzMptPmyxlM7MBtdBCnrj3i5uafPfKfett5cW 25ZHd19jt03/99SZC1ZnBERpj8NFMXQgCVr+qH2PqFOslX7kL8PNCu4ZfeXUKYyxWQ01 5lvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+AvNC3ufAy6nz1AhQKG6yQlu93HAj7/vPoazT5NjMqM=; b=sIdUpHrWeAMEi6asYm8WST6JfDOl+hY//0esggs4Xx6t2lMWOJ6UM1X+CIhVXLjcWg B5bem0Ek+9iIFGIofz2Nk//6Aj3kLq5IOEyXfR4XTObenGn0vyVCCd31/whkZ2KR4vGm d62WU3g00MDll1Zj/sq/KdBCGAh+IRHf+nMcJiVVCNiBSfA1yymmPAjP9foGkM7cwqlX y4GB9RaY8+0MpnaV0v6aYg/5Fc3yPAIHNvwKaq9dhZ4rBR7//sK43A4GzhBC8tO1F5nl /1z7nbPvUaj1cCfARedude8v/2QIoGSuDz2ODyAQsC1eYhi44tPImUor4e8i8epcxD6R X13g== X-Gm-Message-State: ACrzQf0240mWjOEuahqycFSjLMn8cKiEXQ8wdSee9DN1fUsIwGLKy4cd hxbZVGsvpdq6I0TTCM2u/sV1uYKenQm5NA== X-Google-Smtp-Source: AMsMyM4F1v/hGFFx1Jr4tWbjrANTEnf3HhSosVq4IznBnb+BlaxtwyrVtE86Gs4mq+Hvth9S8GqgaQ== X-Received: by 2002:a05:600c:19cc:b0:3c6:fd74:cb2b with SMTP id u12-20020a05600c19cc00b003c6fd74cb2bmr12548065wmq.6.1666345492730; Fri, 21 Oct 2022 02:44:52 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:51 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 8/9] cmake: copy over git-p4.py for t983[56] perforce test Date: Fri, 21 Oct 2022 11:44:21 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since [1] two git-p4 tests have relied on there being a "git-p4.py" in the build directory, but the cmake recipe was not updated to account for this. Let's copy the "git-p4.py" over. We could also change the test to e.g. grab the built "git-p4" and alter its shebang, which would be friendly to GIT_TEST_INSTALLED, but let's just do the bare minimum here to get cmake+ctest working without altering the test itself. The reason this hasn't been caught by "vs-build" and "vs-test" is because those tests added in [2] invoke "cmake" with "-DPYTHON_TESTS=OFF", and therefore we'd skip this part of the git-p4 tests before getting past the "do we have python?" check. Even if we got past that the Windows CI wouldn't have a "p4" or "p4d" binary installed, so we'd skip the tests anyway. In a subsequent commit we'll run "cmake" and "ctest" in CI with "ubuntu-latest", so we'll need this "git-p4.py" file. 1. f7b5ff607fa (git-p4: improve encoding handling to support inconsistent encodings, 2022-04-30) 2. 4c2c38e800f (ci: modification of main.yml to use cmake for vs-build job, 2020-06-26) Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 8e29e3f514b..4f5e43e0aad 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -860,6 +860,7 @@ file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content}) execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/git-p4) +file(COPY ${CMAKE_SOURCE_DIR}/git-p4.py DESTINATION ${CMAKE_BINARY_DIR}/) #perl modules file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") From patchwork Fri Oct 21 09:44:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13014538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E26DBC4332F for ; Fri, 21 Oct 2022 09:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230398AbiJUJpW (ORCPT ); Fri, 21 Oct 2022 05:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbiJUJo6 (ORCPT ); Fri, 21 Oct 2022 05:44:58 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBAC13FF32 for ; Fri, 21 Oct 2022 02:44:55 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id n16-20020a05600c4f9000b003c17bf8ddecso3753675wmq.0 for ; Fri, 21 Oct 2022 02:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aQDigF109b8cAm4rjoF5g69waS8ol9dqqyjoTXbhZB0=; b=CqCG3mwd5RWOefO312iaQM1LHzxDo3Ta/PMpc70EwZyNv+FImfUQYQ15SYfLQsNORx onu19tc8vGoSdIH+cdoW8OylSg23QBtTbLOc3kT6C549pTnVFwS+D9dTq5uGvsffo9RE /wOBMFspM+oo1soJvhALrccgPyaw8ODWp3TCJhXALChrntJIISU+9zdejqqPNHTqmfD4 P6YD9TDCdFQxXjoR3pIeWp8yuM/Z3tcL2g/MFw/F28lR1YHWnbWR4MiA7EAeQJlZ64ph IWH2ew6B8do/8nCz0KidDfoVkwX55PvDwoyu5aYW8zSYxMgjyA31W3zpaXOsOTnlGz2V C8wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aQDigF109b8cAm4rjoF5g69waS8ol9dqqyjoTXbhZB0=; b=PoqB/NuTad/0ytgMja0TFIcACEZQLX6khFzKlbIPB+PnlP+ylxdc7fKON2xFXDW3VL +6NRt3APK7crarwLFpXdiolkQzgrm1rUoN8Iy9hMHIV78PM2K61NPUk/Jo6B5NIbuuFi gG57Q8s52UsyWB4ojzhEFyBAFymy/K6MMvd8SHNZOe98pBiObzdR4GQ46u8fupa5iLCI HFEK0+hmCFhG7Ed+PldXV02y0t+qzJBUI5LsyzsIKHYAwURRhXl6ikzzGs2vUnZ9mSEE 2UaLjR1fvCT4v8cf08n+XeVA8eAAX2DZafo7JRAeKWwKAnoiS7EYEIjEi3rGMY5RKGmR Wtww== X-Gm-Message-State: ACrzQf24tPqnYhc6FfMfEdwdBEzEUOECF9NtgrE6nL9UwShfEFpk6lyp tpet9DQZqbI3yXSKDEIMymOaZQXWMMPiRg== X-Google-Smtp-Source: AMsMyM5OsEMlD34Df4jkr8/uMFvEF72aPNJOorVUFnmBTeOtU3BXQJ9LKozQfkRwgKg9ZJ8bjMwDxg== X-Received: by 2002:a05:600c:6023:b0:3c6:bd83:752f with SMTP id az35-20020a05600c602300b003c6bd83752fmr33473946wmb.35.1666345493779; Fri, 21 Oct 2022 02:44:53 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id u6-20020adfeb46000000b002258235bda3sm18277768wrn.61.2022.10.21.02.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 02:44:53 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin , Phillip Wood , Victoria Dye , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 9/9] CI: add a "linux-cmake-test" to run cmake & ctest on linux Date: Fri, 21 Oct 2022 11:44:22 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1205.gcea0601d673 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since [1] the "cmake" build method should work properly on Linux, but as seen in preceding commits there were various bugs in it, which are hopefully now all fixed. To ensure that it doesn't break again let's add a "linux-cmake-ctest" target to build and test "cmake" on Linux, in addition to that we'll also run the tests with "ctest" instead of "make" or "prove", so we can assert that testing with that method works.. This also stress tests running "cmake" (and "ctest") out of a build directory that isn't the top-level. The "vs-build" job uses "cmake" since [2], but clobbers the top-level "Makefile" and builds in the top-level directory. That was the reason for why we didn't spot that various tests still required missing "mergetools/*" etc, which was fixed by using "$GIT_SOURCE_DIR" in a preceding commit. Since the "ci/lib.sh" already creates and exports a GIT_TEST_OPTS="..." we'll pick that up in our CI, see the preceding commit. Because we pass the "--verbose-log -x --github-workflow-markup" in the GitHub CI as a result the interaction with "handle_failed_tests" here works correctly. I.e. on failure we'll have saved "t/test-results/*.{exit,out,markup}" files relevant to the failing test(s). 1. f31b6244950 (Merge branch 'yw/cmake-updates', 2022-06-07) 2. 4c2c38e800f (ci: modification of main.yml to use cmake for vs-build job, 2020-06-26) Signed-off-by: Ævar Arnfjörð Bjarmason --- .github/workflows/main.yml | 3 +++ ci/run-build-and-tests.sh | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 831f4df56c5..f15c77c1ed1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -238,6 +238,9 @@ jobs: os: ubuntu cc_package: gcc-8 pool: ubuntu-latest + - jobname: linux-cmake-ctest + cc: gcc + pool: ubuntu-latest - jobname: osx-clang cc: clang pool: macos-latest diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh index 8ebff425967..a3ae5ff3972 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -45,10 +45,19 @@ pedantic) ;; esac -group Build make +mc= +if test "$jobname" = "linux-cmake-ctest" +then + cb=contrib/buildsystems + group CMake cmake -S "$cb" -B "$cb/out" + mc="-C $cb/out" +fi + +group Build make $mc + if test -n "$run_tests" then - group "Run tests" make test || + group "Run tests" make $mc test || handle_failed_tests fi check_unignored_build_artifacts