From patchwork Tue Nov 1 22:51:25 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: 13027586 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 082C0C433FE for ; Tue, 1 Nov 2022 22:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231129AbiKAWvy (ORCPT ); Tue, 1 Nov 2022 18:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiKAWvw (ORCPT ); Tue, 1 Nov 2022 18:51:52 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 377CF1A20A for ; Tue, 1 Nov 2022 15:51:51 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id bj12so40754739ejb.13 for ; Tue, 01 Nov 2022 15:51:51 -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=2M+53OJgQ5NI2pDkE4sAYnMOh49d/aNJ2k94wOnKpLg=; b=E+hWiZiu7f3kres6xa6d1/wXErMT5yTKWfWkuRlvLBOdwWQ81QfzOohfvWOeTqOp9f mkJsZKDAeoLHoBKaM+Si363krodN9OICqaQu7l7r9eTh1AJG7aAB26ZZNHOkt5yC8VKt roRmX7xDlo7iPV5W7OLnSMGAIPoahGUIQOm8UQcCx5KIZ+LdY9Yxea10NdkixWuaA2FA cvtbXXQg3FD7IA7/3J0M9o79NL/O70qJPwN+hHMaJ56p8gJmhjJesW9/N7SPa61KkTf9 /MdXUWVVbi4Zzm5vrj1L1wt3TIGmWQhHHe1T+pU6eL7BLrzppqYzQ+T7/y/VqcMr86Q5 LEzQ== 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=2M+53OJgQ5NI2pDkE4sAYnMOh49d/aNJ2k94wOnKpLg=; b=UtS9q5XNe6HccoNW1/5ZFQrSh5BSDcQYfhBhpXEXJun57d9zjrzCd7M7nAxazi3Ju+ J2AdKQ4dEzZwJKUBBTcCsWMr8gKutxsgoLfBilnHmz6i0fnW2XmDCbVsiBOjVNVNMC9v QymZZdRgtauQJ0G1uNIJ2DoN5F27NDYa4247eDOkJMXJumhR63/g59muOUrEDMLfvIBf ed/yhQD6VziKlk+xNot35JCGnLxedYK6iLOBISNt+vdIkVSznx4JuNiO6ClbrBWOFSJx jZ4I0N+D1tmit/e7g3PHcwjrYLYReKfXBEv6Ql2fx+Qpzm5PJZjm4qXNRZ5bR8FPDSMX PbXg== X-Gm-Message-State: ACrzQf2wGIdZjA2igSkY8JFy7MnfC+29445UFwR+U50v6sOyB8w4xMfr i9WmpNZmrmR10Bfr93lbyFmVw83fRQblCA== X-Google-Smtp-Source: AMsMyM42f6yJ+e3W52k/zP7yKN8BKANQDj3N644dlP5DfYq9kLw4qyCuH+tzw57E2uo1qAn4SUW3+g== X-Received: by 2002:a17:906:7212:b0:7ad:bd4b:c41f with SMTP id m18-20020a170906721200b007adbd4bc41fmr16905306ejk.659.1667343109553; Tue, 01 Nov 2022 15:51:49 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51: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=?= Subject: [PATCH v3 01/12] cmake: don't "mkdir -p" and "cd" in build instructions Date: Tue, 1 Nov 2022 23:51:25 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use the "-S" and -B" flags instead of "mkdir -p" and "cd". The "-p" flag to "mkdir" wasn't needed as "contrib/buildsystems" is tracked, and the rest of this is now easier to copy/paste into a shell without having one's directory changed. Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 3957e4cf8cd..494da807c53 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -16,9 +16,7 @@ though, therefore the `File>Open>Folder...` option is preferred. Instructions to run CMake manually: - mkdir -p contrib/buildsystems/out - cd contrib/buildsystems/out - cmake ../ -DCMAKE_BUILD_TYPE=Release + cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release This will build the git binaries in contrib/buildsystems/out directory (our top-level .gitignore file knows to ignore contents of @@ -36,8 +34,8 @@ NOTE: -DCMAKE_BUILD_TYPE is optional. For multi-config generators like Visual St this option is ignored This process generates a Makefile(Linux/*BSD/MacOS) , Visual Studio solution(Windows) by default. -Run `make` to build Git on Linux/*BSD/MacOS. -Open git.sln on Windows and build Git. +Run `make -C contrib/buildsystems` to build Git on Linux/*BSD/MacOS. +Open contrib/buildsystems/git.sln on Windows and build Git. NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studio in Windows, to use another tool say `ninja` add this to the command line when configuring. From patchwork Tue Nov 1 22:51:26 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: 13027588 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 2A8FBC43217 for ; Tue, 1 Nov 2022 22:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbiKAWv5 (ORCPT ); Tue, 1 Nov 2022 18:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiKAWvx (ORCPT ); Tue, 1 Nov 2022 18:51:53 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB8F1EAE5 for ; Tue, 1 Nov 2022 15:51:52 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id a5so23859512edb.11 for ; Tue, 01 Nov 2022 15:51: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=KUU2s5J99nCD8UDvMI0GEYtE+eWp0bVgvz1Tk9lagbg=; b=hs2sZnWHIyKj8ryN+8SKXkIAkw/EQDrLJ1RNbtyLu1GEdyu28tz5yJsZuHabbxPsTV DAG50CaGolMuEAfj9kgODGNTo4JzgQ246pygov1oqOC2dTPhJXHeaMPjKx3nyGMAmZZx 4UBR0JOW9+1BxRi7biRH0IAOiyW1wqwYiGof0T5B1K+Xe8oBLcPb8vvhvlaRCH4t78j2 Ld7An+l5s6tQeezYnsfSOYsAo0E1sYh0aFDvgX8RFgJ8LRJ5+Zkncqk4WbGDmvGNIhSi Sl9Ecwg9ReiyoCjCFe9sgEmBM3I02mLECJ0G40G57IkNyavWNCAB2XVDJcD4e8Zfp5rw a7vg== 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=KUU2s5J99nCD8UDvMI0GEYtE+eWp0bVgvz1Tk9lagbg=; b=Lax1ph9ZlPnCiBQocf77Fh3lqRkKSAUuQV/qQf1GJ+z5tsk/hg3tX5+LifT2maGnBa 5wu701oPSVrfuH5CTxv7TFSZBTeahPZ7nS3vmPsUw4ulYXl0nna7K31P2vGuuFnikurq j7KiuOiBTtfdc8kk9DrYXBvpS5tvWPDacSGNVvoeu1po/YydOCFS3mxXwDo4222EwkiS GH6tc35vD2uPP28RONF/vW2v50cHoqahF9Zbw2PG05zXj6gOFmh6zephQdko+Adg/lpD 7YxpgfCmvQj+s5+LY2NORwMgwmltSFJVqc4c02OfTALoB1Tsk+vfPE6DLlaN4AWaWai4 lOJg== X-Gm-Message-State: ACrzQf0NqFK/xfbOV33FxNjxuFf27o/L6o/cTNwvi79maAZ2WzkvmHeH qyvpDDPmB9kCrjIjn2zsC92otD9dHSZJVQ== X-Google-Smtp-Source: AMsMyM765nBGkHjap5VywaZFbKwTAgHiV0rnAlVmelO7Hcifi+ctjSn9yVhuKapD6ciOqd2jpvbdOA== X-Received: by 2002:a05:6402:1348:b0:461:c056:bf65 with SMTP id y8-20020a056402134800b00461c056bf65mr21858486edw.414.1667343110429; Tue, 01 Nov 2022 15:51:50 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51: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=?= Subject: [PATCH v3 02/12] cmake: update instructions for portable CMakeLists.txt Date: Tue, 1 Nov 2022 23:51:26 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The instructions for running CMake went back & forth between *nix, Windows and Visual Studio instructions Let's create headings and split the existing instructions up into those new sections. Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 66 +++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 494da807c53..7bc123da315 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -4,7 +4,48 @@ #[[ -Instructions how to use this in Visual Studio: +== Overview == + +The top-level Makefile is Git's primary build environment, and a lot +of things are missing (and probably always will be) from this CMake +alternative. + +The primary use-case for maintaining this CMake build recipe is to +have nicer IDE integration on Windows. To get Visual Studio-specific +instructions see "== Visual Studio & Windows ==" below. + +== Creating a build recipe == + +To create the build recipe run: + + cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release + +For alternative "-DCMAKE_BUILD_TYPE=" flags see instructions +under the "== -DCMAKE_BUILD_TYPE= ==" heading below. + +== Building == + +The "cmake" command creates a build file from this recipe. For Windows +Open contrib/buildsystems/git.sln and build Git. Or use the +"msbuild" command-line tool (see our own ".github/workflows/main.yml" +for a real example): + + msbuild git.sln + +On all other platforms running "cmake" will generate a Makefile; to +build with it run: + + make -C contrib/buildsystems/out + +It's also possible to use other generators, e.g. Ninja has arguably +slightly better output. Add "-G Ninja" to the cmake command above, +then e.g.: + + ninja -C contrib/buildsystems/out + +== Visual Studio & Windows == + +To use this in Visual Studio: Open the worktree as a folder. Visual Studio 2019 and later will detect the CMake configuration automatically and set everything up for you, @@ -14,14 +55,15 @@ Note: Visual Studio also has the option of opening `CMakeLists.txt` directly; Using this option, Visual Studio will not find the source code, though, therefore the `File>Open>Folder...` option is preferred. -Instructions to run CMake manually: - - cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release - -This will build the git binaries in contrib/buildsystems/out +Following the instructions above will build the git binaries in the contrib/buildsystems/out directory (our top-level .gitignore file knows to ignore contents of this directory). +By default CMake will install vcpkg locally to your source tree on configuration, +to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring. + +== -DCMAKE_BUILD_TYPE= == + Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding compiler flags Debug : -g @@ -32,18 +74,6 @@ empty(default) : NOTE: -DCMAKE_BUILD_TYPE is optional. For multi-config generators like Visual Studio this option is ignored - -This process generates a Makefile(Linux/*BSD/MacOS) , Visual Studio solution(Windows) by default. -Run `make -C contrib/buildsystems` to build Git on Linux/*BSD/MacOS. -Open contrib/buildsystems/git.sln on Windows and build Git. - -NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studio in Windows, -to use another tool say `ninja` add this to the command line when configuring. -`-G Ninja` - -NOTE: By default CMake will install vcpkg locally to your source tree on configuration, -to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring. - ]] cmake_minimum_required(VERSION 3.14) From patchwork Tue Nov 1 22:51:27 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: 13027589 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 1136BC4332F for ; Tue, 1 Nov 2022 22:52:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231258AbiKAWv7 (ORCPT ); Tue, 1 Nov 2022 18:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbiKAWvx (ORCPT ); Tue, 1 Nov 2022 18:51:53 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 029121A20A for ; Tue, 1 Nov 2022 15:51:53 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id d26so40797315eje.10 for ; Tue, 01 Nov 2022 15:51: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=sQSrY8WaDHJcl/mMaYriCNAqT3frrtPcfpu4U1DidN0=; b=AjsseNnjqTB/K9ChreV4uo7PO4lFhxDu8KxwvOBsjSoK3AlBVhtAnW1ACVu06rIkjL KIxjzaJ8A3M7+X9wmXF6kL7k1SI1kXLwODp9p8QMNsEN/pQy68q21vo85KeUG5GEd1ej vSnePxKvDPoHTTVJb4zEu1vV0Ez9yOsYb9pgoGWVGwugGzqc6vKw0vNKMSjXHz2uI0ia J4XEQTe99dQluFivn0spF/vmZrv9reftppW0EquG3c2JFQcGMktQ3IThM+dgtmg6Cel1 wbsDAw2GySqEg2D06f51JZCO9ZxLPFnMjIsO7QHAkeTlBBfTth1F4+5wpqFNlSOrcaay YTyQ== 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=sQSrY8WaDHJcl/mMaYriCNAqT3frrtPcfpu4U1DidN0=; b=6/IPXDuZIJy0w03RGuTLjiaccN3GDdTHC0LxieE8ivi+06ote6eBekgKOiutC+5eXl OAXlVQtV0hXrnEl0J1YOUNll+O7/3Em0vRVLOxAEmBcqQDgYjwe1idP5ymttxYbtxcua aabHL9VnooTpc5S3uZINdUHrmHu3xQ3QhoJB++WTwHj5jqSCmG6EfHOEh0x2S3p+jFLf edZXoMia3v9qHCsn7Q3wbbKBMoMJzvU6JD9la9I6HaYtmzzbi9tIEoMxrQ9pKG19hVvw mXMNjMvan75m4HyhvahdiSXb7SXl1h+2rPvdDvPz28JNfcLpCxWfFRsfIpSoEQnsdB0F HOPA== X-Gm-Message-State: ACrzQf0aCKdH/xJ3ti5W/aNYAiz6heFHGZfI7Io6EGLVsE0/6SMg2yI5 9RC9KtItfm7cmRRuMdE02UDwA2TC6xzicw== X-Google-Smtp-Source: AMsMyM4XyQf+umOPqXuNMNMVNS7bpVjHBbO/q665Mt9Hac4tOLgRUxZoC4FdkZ2G/TnijLQ0wxAyog== X-Received: by 2002:a17:906:6b90:b0:7ad:b6d3:3394 with SMTP id l16-20020a1709066b9000b007adb6d33394mr17641086ejr.497.1667343111302; Tue, 01 Nov 2022 15:51:51 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51: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 v3 03/12] cmake: don't copy chainlint.pl to build directory Date: Tue, 1 Nov 2022 23:51:27 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 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 7bc123da315..dd46ad25fb7 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1106,7 +1106,6 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake "file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")") #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(GLOB mergetools "${CMAKE_SOURCE_DIR}/mergetools/*") file(COPY ${mergetools} DESTINATION ${CMAKE_BINARY_DIR}/mergetools/) From patchwork Tue Nov 1 22:51:28 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: 13027590 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 388A5C4332F for ; Tue, 1 Nov 2022 22:52:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbiKAWwK (ORCPT ); Tue, 1 Nov 2022 18:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbiKAWvz (ORCPT ); Tue, 1 Nov 2022 18:51:55 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ACC81EC42 for ; Tue, 1 Nov 2022 15:51:53 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id b2so40874516eja.6 for ; Tue, 01 Nov 2022 15:51: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=lFw70LFk72BUWBINjXeHrI+Dxj4so793FpLuWPX6eFo=; b=OwTtITnQGKe/3xhi8yUcMh/iuoQRt7SZsgTOiBnUnXF3op93gzlJ/2ioh4JsTR/kfl ZE6ylUdiCDIG/NgoLD14qpw+3WdvxtN6NvDYRot+svrsI9MzvGKyXYquhZdEFqYwh519 U42f/e8AjtM61q1qChJGSdnhllh5uKh3tiCnxYbmwDCDg3YkoL6HfWm/fBr1Din5Z5Yf ugoBoxdfUcYnZWddljrGyu1Tw080byttcAn84GDIOz18LlX2g0VgCPnDdk85XP5jXX6p OdF2mPtJV2c5kSWbnuIRcKWNIGKcCN3sHGCKsokUDAmnxprDOU4bcWXapgj6y2uPus7F cNZA== 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=lFw70LFk72BUWBINjXeHrI+Dxj4so793FpLuWPX6eFo=; b=JuR0MibKhPJQpgH/B6yDfDXNN4EZNk8uZOFj4CrvqRaTgo5zb7I79IABmUi/FEXEc6 g79ixEY61eYwD9LEcAmDlV9ipvnoH50KNZHXgl7+x48JTi0PFyART+pIA7LFHFOgpxwI l7yZ3diPQ89FdSvRBV+KMBdvJLLIkN+uGEobzoF0CcomLKjhpcLWhu0MopJw5PntiaQx 2YQSMLhMrTJh5MQGdGUip/rPhRgtqlk/xzhBPKonyYZWe/OCBZMJ/XvEd/xntzXhcYLY D39Ic0R/mbUq0ce2wCSYDkOyyb3qrlhvZVTms6Ui7784dljkFtJMrmrHbj/l70BppYTS Mzyw== X-Gm-Message-State: ACrzQf1HB/dOnDc+luZLMri4LPgDjjRQ0IASKDnb3MKZbcgVyel5vQIa u2cOZaX93H05vichedRNeDsIX+WEQlVEgg== X-Google-Smtp-Source: AMsMyM66ekHXKkWnm8nCNcQ+NxHoFcU8QRN6VFbEWtKic5Oj1kK/6Ykc7/7WJeSEfkLSNdUIBnUSKQ== X-Received: by 2002:a17:907:70b:b0:740:ef93:2ffb with SMTP id xb11-20020a170907070b00b00740ef932ffbmr19691584ejb.93.1667343112199; Tue, 01 Nov 2022 15:51:52 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51: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 v3 04/12] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4 Date: Tue, 1 Nov 2022 23:51:28 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since the cmake file was made to run on *nix in [1] running the tests with "ctest" broken, because we'd attempt to invoke our bin-wrappers/, but they didn't have the executable bit. In the best case, 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 This was recently somewhat swept under the rug in [3], as ctest would run them with "--no-bin-wrappers". But still with [3], running e.g.: cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Debug && make -C contrib/buildsystems/out && ctest --test-dir contrib/buildsystems/out --jobs="$(nproc)" --output-on-failure Fails around 20% of our testts on *nix. So even with [3] 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". 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. There's also a few other outstanding issues, which will be fixed in subsequent commits. This change should ideally use file(CHMOD ...), but the "file(CHMOD" feature is much newer than our required cmake version[5]. Before this change: 80% tests passed, 196 tests failed out of 977 After: 99% tests passed, 5 tests failed out of 977 The remaining failures will be addressed in subsequent commits. There was a suggestion of using a function to abstract this away[6], which sounds good. But after spending too long trying to get all combinations of "${content}" and ${content} (unqoted) in the function and its callers working I wasn't able to fix the quoting issues it introduced. A lot of this is duplicated already, we can follow-up at some other time with refactoring, and address any tricky quoting issues in calling function with these parameters then. 1. f31b6244950 (Merge branch 'yw/cmake-updates', 2022-06-07) 2. e4597aae659 (run test suite without dashed git-commands in PATH, 2009-12-02) 3. 2ea1d8b5563 (cmake: make it easier to diagnose regressions in CTest runs, 2022-10-18) 4. a30e4c531d9 (Merge branch 'ss/cmake-build', 2020-08-11) 5. https://cmake.org/cmake/help/latest/command/file.html#chmod 6. https://lore.kernel.org/git/0fda0e54-0432-7690-74a7-3d1a59923e0c@dunelm.org.uk/ 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 dd46ad25fb7..127a4a17853 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -864,6 +864,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 @@ -879,12 +880,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") @@ -1023,6 +1026,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}) @@ -1030,12 +1034,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 Tue Nov 1 22:51:29 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: 13027591 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 40B40C433FE for ; Tue, 1 Nov 2022 22:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231351AbiKAWwL (ORCPT ); Tue, 1 Nov 2022 18:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231168AbiKAWv4 (ORCPT ); Tue, 1 Nov 2022 18:51:56 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 197651F9EC for ; Tue, 1 Nov 2022 15:51:55 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id ud5so40892979ejc.4 for ; Tue, 01 Nov 2022 15:51: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=zqBLpuT/iwa1EB83/zPuBSu7/slUm98k5yl2gN6bsHY=; b=oySD6ueLldLOdEVJtG3qzaxDRipiRJ4FAvviQCQB9tBaEWThwNtXwPcb1pG7Pk81l4 sSbv2wgSmAXWs/ml8ANyM0bFew0LCz8q3Aj6z44NdBW3h7cG00Q8Lf2stQBzMLK8Lq+c 9R9aiUXcECJ/OqX6SUg2WDfkwXpacKtQ8WTI4II1RxGeJma+mDrJzDT4aGfnjeu9g/jB Y47IpJt7NjKiQGqUI/t041UCQkYg+aMH3CS6lgw0r/Vs2VZXgH5xqNZsrvj62GPdD/k7 2mlprDrEeO2Db2RGpBSK5/N3KSfuY5kNb1QfnevyhQ/5bHoPfCh2s8R1fQjnfqNKHqHo 66Sg== 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=zqBLpuT/iwa1EB83/zPuBSu7/slUm98k5yl2gN6bsHY=; b=UbsJFcf/fAGMS/mJEM3CarrJk+OoIStjSFIIDLZNGILmpfH3iKc/rirXWq5kic0oPq uXaFVg5UFsPY+3dwwvZnqSDljit+9SOgjgdRQCnA/AT1++XJQv6dopSMYpf+QDz+fNcn agxkEqLYwgAfv7zJlQ/kGYgVzFLtuSOLGTxuQSVx/g3va1Qu228GfhiJanZwrYt9bFFY 6TXADe0DmRu+cs43KG2joalM65QuQIVxcrkM5j6JqhXPNp90ZGBDhhJZkMkMzcm7Zm8d 2KOe2LUKwk0ilOcFZ0w/epK+g6I8BPzlPHP/0KvcYY9h9jiZo1TZJRRlxD7JE+A5V5gH I4jQ== X-Gm-Message-State: ACrzQf0TJ3aVYyw0bIo+fDrS3vR34rqWv1zaazelhIsQQQqghGb3AGin a5nsHRGTpgBlOleHbNEsVzuaGblXkA635A== X-Google-Smtp-Source: AMsMyM4ftaib++erRbkHILz6U4w0m+/HJ5RMG+KX/N1W75w6gAngCZ0XS3ItP14ki2YhvI/V8MyUWA== X-Received: by 2002:a17:907:3181:b0:787:d81c:a6ad with SMTP id xe1-20020a170907318100b00787d81ca6admr20017322ejb.769.1667343113209; Tue, 01 Nov 2022 15:51:53 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:52 -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 v3 05/12] cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable Date: Tue, 1 Nov 2022 23:51:29 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 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. But we've only been doing this for the subsets of tests that run on Windows, and which have otherwise been covered by that CI target. The CI target builds (among other things) with "-DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON", see [1]. Furthermore, the CI isn't testing from the "contrib/buildsystems/out" directory, instead it clobbers the top-level MAkefile. There was a recent commit to fix a subset of these issues, see 6a83b5f0810 (cmake: copy the merge tools for testing, 2022-10-18). Let's stop going for that approach, and 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. With this change we now pass 3/5 of the tests that we still had failing with the fixes in the preceding commit. 1. 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 | 6 ------ 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 | 8 +++++++- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 127a4a17853..26a93b7b2cf 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1111,12 +1111,6 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) #Setting the build directory in test-lib.sh before running tests file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake "file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")") - #misc copies - file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/) - file(GLOB mergetools "${CMAKE_SOURCE_DIR}/mergetools/*") - file(COPY ${mergetools} 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 6db377f68b8..36358811a0f 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -47,6 +47,10 @@ then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2 exit 1 fi + +# For CMake the top-level source directory is different from our build +# directory. With the top-level Makefile they're the same. +GIT_SOURCE_DIR="$GIT_BUILD_DIR" if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" then GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 @@ -1447,7 +1451,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 @@ -1500,6 +1504,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 Tue Nov 1 22:51:30 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: 13027592 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 A9F9BC4332F for ; Tue, 1 Nov 2022 22:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbiKAWwO (ORCPT ); Tue, 1 Nov 2022 18:52:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbiKAWv5 (ORCPT ); Tue, 1 Nov 2022 18:51:57 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E991A20A for ; Tue, 1 Nov 2022 15:51:56 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id x2so23912554edd.2 for ; Tue, 01 Nov 2022 15:51: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=YiLnAmzVH2NQH/OlOe2WFY8+6IlcVCBZzzKpVOQRU28=; b=Ft4e+lkCA15sVd0y7cWNZEc+nKKMceKhe6rYx9BouqpecAnapBUJvtuTA8bSwXTjgy +9Imq8G62sxoS35z/frEMZFzJUDyXLVvvdee6OHQ0PBiQpTjK2WG+tos8hbDvmbVEX9I MfjknVewjHiPbMLEPMSkagXAOrDLCPM2lw4a8OaTKHZAwpzYMdwD4EUwK8+4X5Q7GtMF ELNTpEVbAl+ZIt+LvFIDQihv4eKZdcwxSKdvPEt418/mcOKi9nbOtnrJOQ6vOmFIYCDO yFCklMP2wwWByoQChekktXgo60z3pVYYdQWHHCDzQpfBeLs0P13CcvOkTN2JRbkIScwd 5ouA== 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=YiLnAmzVH2NQH/OlOe2WFY8+6IlcVCBZzzKpVOQRU28=; b=vfdSvkxlk6nrPXt3eoZUuZCT/78PRdz+ywL0JgwPntA+hNy4fFRc9Ui6ORgVl2BCRO HJe72g64tJKTWZO5da3g6/8bzULBicyjNVNj4iuhm4ALmVPxBisj0V2c7TBOkxnlfArE /tS5cSH4UtJXh/UigsTjv2+wjIt2S9+bTqiIgarn0SNrIrNELKKZ66SQ4uXwARgDVeTE nlsY+6x93+iwG9L4be9Qp3gtvp9VjPfqyWfdffI+lOWyhzOlNGC1DkoWaZZcJVrmF0mz uURhXxAlrf/zjw68bwrj6wlqAhlckjackOLYFr+sUjcs6c4LFZP8elEcXmzU3CdtNluv 047Q== X-Gm-Message-State: ACrzQf0MbanQTamidVT8HjIqeS3Ww/IWuajA0154Gk88uN9zSFg40dwZ 71fX1Xk85C9iDxqj62c7H5iWF3j2xTNXBg== X-Google-Smtp-Source: AMsMyM6817kwAsiw5ERsfmlJfMG75qPkgZSvzBrZE41dZKr/FBTmOuz0oyyNgfr8AgGDMSptpwUJYA== X-Received: by 2002:a05:6402:43cb:b0:461:912d:90f with SMTP id p11-20020a05640243cb00b00461912d090fmr21635013edc.375.1667343114270; Tue, 01 Nov 2022 15:51:54 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51: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 v3 06/12] cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh Date: Tue, 1 Nov 2022 23:51:30 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 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. With this the remaining two failures we had left after the preceding step are resolved, but note that that test run didn't include the git-p4 tests, which a subsequent commit will address). 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 26a93b7b2cf..fc45004226a 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1091,6 +1091,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 Tue Nov 1 22:51:31 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: 13027593 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 1AC77C433FE for ; Tue, 1 Nov 2022 22:52:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbiKAWwR (ORCPT ); Tue, 1 Nov 2022 18:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbiKAWwI (ORCPT ); Tue, 1 Nov 2022 18:52:08 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 406841F9D0 for ; Tue, 1 Nov 2022 15:51:57 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id v17so231564edc.8 for ; Tue, 01 Nov 2022 15:51:57 -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=a8kQBj19i/O8q4hstbYt+RcFu15hgiYTgq8jHk4CZiI=; b=oUkBY3gWCYhWIKzq4KlcSoLz9XvFIvdDChreNXnfwg2Wz92O26mEyttnjmjuuwDcOD WnBUXkoa2L751RJ41M0KOqWOZfyyokErDVGLW/A5UZ4ATCwlN1Eyt0icDB/d8wEFSczG OpJMJ5uHzayR+1fBOMKKfwrDKwNaYgvoScZsvy7WkHxsrp3lMqFxzcX320N7p7Y0W1Cn CH6r3+2P0ciFZYSAzmRa8YQ57mmj+YgZJGgLZLRFPwG20/CbeT1DyLp2SjjaNiuOGY9W Y0Mm/xbQrA0CacXDqfTQr6ynOBsO5gPwgWku1dQ32a4lu8/hAjyYX1Mey7Ke1sb3OsTa QIqQ== 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=a8kQBj19i/O8q4hstbYt+RcFu15hgiYTgq8jHk4CZiI=; b=6GfjKEav+TzmjAsB3FIiEEs4RGozIK3/wVvdLl2qd2fDs1SGmY5GsMcgL+69FIwZMX CBreMFYl8rlJs9cbVYQ0ObBaFqcMCMg65ywjQCG4HNuNPvR4B+BGpzRIeqjp4z447ZxB YX9jF5W7MwQ7GTt0/jD4nRH600lIfoyKa4ee1+RO50rQU4ESY2OFnsDYmphKhOvdOS1k V3gP/wReoICRqb7gfdfTUdc/cY4eOyZMn/FXbSQlyw0ELBZHIchOJTMtXgQ+iLjYMnRn +eShrng6lAGYmx+X2h3+HrkaRpzw+vpNyVmBZOq18dtg2PGV2DYBg/DzPkKsA94Hecen pgmg== X-Gm-Message-State: ACrzQf00BPrO/+kjcw4vm3cmgCjUQz9AAuuSVsCdUwTZfyxHRZ1Dn8mS CGUuQW34tdHNuKbfeHc9pFZZt7jC7vR4jg== X-Google-Smtp-Source: AMsMyM4wTjakas7M7gm9vgmQDjlYhKyiXRapMkOWwjza7HKGy/Li6cRFp49LjDpxpJvAepoIGHWntQ== X-Received: by 2002:aa7:cdcf:0:b0:463:56ff:4cf8 with SMTP id h15-20020aa7cdcf000000b0046356ff4cf8mr13711548edw.215.1667343115483; Tue, 01 Nov 2022 15:51:55 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:54 -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 v3 07/12] test-lib.sh: support a "GIT_TEST_BUILD_DIR" Date: Tue, 1 Nov 2022 23:51:31 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 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) This facility and file-based instructions to have the test suite use another build directory[2] are mutually exclusive, but in a subsequent commit we'll make CMake use this instead. 1. 6720721e152 (test-lib.sh: Allow running the test suite against installed git, 2009-03-16) 2. 350a005e366 (cmake: avoid editing t/test-lib.sh, 2022-10-18) Signed-off-by: Ævar Arnfjörð Bjarmason --- t/README | 3 +++ t/test-lib.sh | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 36358811a0f..388774a0aa0 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -51,7 +51,10 @@ fi # For CMake the top-level source directory is different from our build # directory. With the top-level Makefile they're the same. GIT_SOURCE_DIR="$GIT_BUILD_DIR" -if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" +if test -n "$GIT_TEST_BUILD_DIR" +then + GIT_BUILD_DIR="$GIT_TEST_BUILD_DIR" +elif test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" then GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 # On Windows, we must convert Windows paths lest they contain a colon From patchwork Tue Nov 1 22:51:32 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: 13027594 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 4427BC4332F for ; Tue, 1 Nov 2022 22:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbiKAWwS (ORCPT ); Tue, 1 Nov 2022 18:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231259AbiKAWwI (ORCPT ); Tue, 1 Nov 2022 18:52:08 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EEDC1FF8C for ; Tue, 1 Nov 2022 15:51:58 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id t25so40869566ejb.8 for ; Tue, 01 Nov 2022 15:51:58 -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=BkPiyEG6ny7nsK7AInISoscjS5LHdwr9X0lzqJUXN5g=; b=CoIHk2eCNhTuncLKEmeIFVXAvkN6kZILX+dpykwxzyRc6MvknT7uiw8fWwGtRm5mqg C8AOQTXYf0SmYiLdUCGhptg5TS9+SNgRm+bwcwWUgR0qIgNSTBl4BDyoL5I7vDAr7zQj 3mDySiYk9lFChT8C2r8oThqvve+bTn2ZD1q/v4TuBPTBSyidklZQvhMZ5/Pa3XXsJuI8 2zUzkO+812Tb7JMjhz35ustTB0SVzv5weq+w+exEXyVJYPkWBJqTHWqoL5KNFLeCMob/ nzEKfRqUz+hDTDuVbNErlv/zv0KSLwH8FrMjkhD6ZOXJkL7AyuCaUPk8eNVPdNcN+FCF bC5g== 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=BkPiyEG6ny7nsK7AInISoscjS5LHdwr9X0lzqJUXN5g=; b=MDGAR2i5J9OlDEMuGtRLpeY6WavUam6EZkZBS9AVnI4jNzFJbeXPODBJJRjgHnkroS kUINPnwgsErPZ/UB+Ng4pL+pv9UCM5MNG2wTyUj33mXX20ZuzAHGadagRA4sdSFOcRWf +JezctNH/sAVDJYYpJhPFDa1YFCb33bxA/B0bQJqOEeZjnPUT/XLpvs+zixGyLULC4j8 U6xAe6JgoR3xhsImbg5LD2U/uTq8LXMa/2a4rs1b3myHK2lTWp60Qqe3pwLBbNaBe2di ifl9gYweCf6zcU2mv0byzJ22bpQ8UBxXRwhZKM51T3Ja3Uder8zEc2pqnZJ4UbWZbrGV 3rFw== X-Gm-Message-State: ACrzQf2aup22lPK+a0zdMIythrbgbqwvBtTdvDw/BlCi6HxXpdqTqVXt y0c/pThyR3IsFeHzwvDrXL2k8MIXwy+tBA== X-Google-Smtp-Source: AMsMyM5oXDqxC5c0Xv+RPCJeOOmHzI3OQEMXDTQ/UhjogsqGO8NXr1nBb6qsFA/CKDamSY2XWHWwlQ== X-Received: by 2002:a17:906:db05:b0:741:5730:270e with SMTP id xj5-20020a170906db0500b007415730270emr20519811ejb.609.1667343116421; Tue, 01 Nov 2022 15:51:56 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:55 -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 v3 08/12] Makefile + cmake: use environment, not GIT-BUILD-DIR Date: Tue, 1 Nov 2022 23:51:32 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the method used to have building with "cmake" followed by running the tests manually work without creating inter-dependency issues with the Makefile. Per ee9e66e4e76 (cmake: avoid editing t/test-lib.sh, 2022-10-18) and the surrounding discussion the goal of that change was to have building with cmake and: (cd t && ./t0001-init.sh) Work, to do so we need some way to make the test-lib.sh aware that we have a build in contrib/buildsystems/out. The downside of doing it via the GIT-BUILD-DIR facility in ee9e66e4e76 is: - A "remove this file while at it" only fits into the Makefile dependency graph if we "FORCE" a shell command to be run, so doing it this way precludes speeding up the Makefile by e.g. making use of the "$(file)" function (for which I've got follow-up patches). - If you build with make, then with cmake, and then e.g.: make -C t prove We'll run the tests against the cmake version of the tests, not the "make" built ones. It's important to get any subtle interaction between two conflicting build systems right. Now we'll instead: - Check if the top-level "git" exists, if not we'll look in "contrib/buildsystems/out/git", and when running interactively inform the user about the fallback being picked. $ ./t0001-init.sh setup: had no ../git, but found & used cmake built git in ../contrib/buildsystems/out/git ok 1 - plain [...] - This also makes things more obvious on the cmake side, because we'll now use an environment variable to select the test environment, which ctest it notes in its verbose output, e.g.: [...] 2: Test command: /bin/sh "/home/avar/g/git/contrib/buildsystems/../../t/t0001-init.sh" "--no-bin-wrappers" "--no-chain-lint" "-vx" 2: Working Directory: /home/avar/g/git/contrib/buildsystems/../../t 2: Environment variables: 2: GIT_TEST_BUILD_DIR=/home/avar/g/git/contrib/buildsystems/out [...] See [1] for the relevant cmake language references. - We don't support an arbitrary build directory outside of "contrib/buildsystems/out". This is OK because the reason for doing this part is to support the workflow documented in [2]. 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. 1. https://cmake.org/cmake/help/latest/command/set_property.html https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#test-properties https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#cmake-language-lists 1. f2f1250c47f (cmake (Windows): recommend using Visual Studio's built-in CMake support, 2020-09-30) 2. 3eccc7b99d4 (cmake: ignore files generated by CMake as run in Visual Studio, 2020-09-25) Signed-off-by: Ævar Arnfjörð Bjarmason --- .gitignore | 1 - Makefile | 1 - contrib/buildsystems/CMakeLists.txt | 10 ++-------- t/test-lib.sh | 16 ++++++++++++++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index cb0231fb401..62720c6135d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /fuzz_corpora -/GIT-BUILD-DIR /GIT-BUILD-OPTIONS /GIT-CFLAGS /GIT-LDFLAGS diff --git a/Makefile b/Makefile index 4927379184c..36802fe45eb 100644 --- a/Makefile +++ b/Makefile @@ -3045,7 +3045,6 @@ else @echo RUNTIME_PREFIX=\'false\' >>$@+ endif @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi - @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi ### Detect Python interpreter path changes ifndef NO_PYTHON diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index fc45004226a..f0de37b35a1 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1108,14 +1108,6 @@ 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}) - #Setting the build directory in test-lib.sh before running tests - file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake - "file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")") -endif() - file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") #test @@ -1123,6 +1115,8 @@ foreach(tsh ${test_scipts}) add_test(NAME ${tsh} COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t) + set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT + GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR}) endforeach() # This test script takes an extremely long time and is known to time out even diff --git a/t/test-lib.sh b/t/test-lib.sh index 388774a0aa0..ce319c9963e 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -51,12 +51,17 @@ fi # For CMake the top-level source directory is different from our build # directory. With the top-level Makefile they're the same. GIT_SOURCE_DIR="$GIT_BUILD_DIR" + +GIT_AUTO_CONTRIB_BUILDSYSTEMS_OUT= if test -n "$GIT_TEST_BUILD_DIR" then GIT_BUILD_DIR="$GIT_TEST_BUILD_DIR" -elif test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" +elif ! test -x "$GIT_BUILD_DIR/git" && + test -x "$GIT_BUILD_DIR/contrib/buildsystems/out/git" then - GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 + 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*) @@ -1637,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 Tue Nov 1 22:51:33 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: 13027595 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 7EE22C433FE for ; Tue, 1 Nov 2022 22:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbiKAWwX (ORCPT ); Tue, 1 Nov 2022 18:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231301AbiKAWwJ (ORCPT ); Tue, 1 Nov 2022 18:52:09 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDD91FFAE for ; Tue, 1 Nov 2022 15:51:59 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 21so23915495edv.3 for ; Tue, 01 Nov 2022 15:51:59 -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=TVK5DBBDv1ozhx7OkD25A3x9cF2zX4fxWr48jUP/8dM=; b=JYvFlK5VKjBYM5ohF1+JpzLIlYP/kCgCFNzlbQi+UdEPNSaKGQ8QkfB50wVaaBbSWI iLDQbHnoHH0nxNQS8iMqRP6ocTAcvWNFWa3g5tuBG3aD0u4e8aKAaL3upWeJi0wHsKPs kaYWuF9pZOYfJyOe/iWV4iDpCFZR/kmtP8zbj8wa/Wpz3reI66s9hOo7cY87rWCXdr8y gnT2gjs6+6x3iVcaNxlWvk4kJ3Uo/jTUPVGPm27qK6hqSRhoZJzFCiLPpMZrqBKUo1/b i4l9E2XMJxd790/olE/oRSzcbICh5o2FsF9YheT4eXjt4UWDCaQLww+nWvp8UlSt5S65 9jDw== 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=TVK5DBBDv1ozhx7OkD25A3x9cF2zX4fxWr48jUP/8dM=; b=G0zAcgYZGibZKc8mwVFh4vBDojLT6f3T+KWKOwRgroeCRh3Psupce5VhcuQFzxp4GX oIs/L63mg8tyGkQm5WF+pACA6vm5hnDzP3zxUDUj11ZwS0rU9E58sOHwTPloU1wm3e4t yARW7gVXLBA575yR9Xmrro1Ze8XImqe7+G1WqWILr/wn95Rj8hf1vFVFFgfhbTjlD882 i2C41aw0uETMyIr/4cis4QrTkWjjUYDCp1cMDzoF0MN7NK5mzLC2+U8EnGCVPALpdzaC samljOEyVzlBZU3ak47YAxQUAUzjLMOSVtf/nh3WizFDGptk7yT0RpRojo1HSuuDVzvd Oxzw== X-Gm-Message-State: ACrzQf0hpk4lgAxKbs/SSdTqjXCsNocxCGB3AqArzxyVR4FmlFs6IjQ3 BgNhNveIUgr0vipiiLpmyQMHQTjyj2podA== X-Google-Smtp-Source: AMsMyM4GKZgWvCzjDbFtEPaytjVolHYEjk/4SmdhLUaxaC4rYGsTqt4yjyXFswWkXp4oAOVFBQni8w== X-Received: by 2002:aa7:c859:0:b0:463:4b54:16a8 with SMTP id g25-20020aa7c859000000b004634b5416a8mr14413586edt.136.1667343117517; Tue, 01 Nov 2022 15:51:57 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:56 -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 v3 09/12] cmake: support GIT_TEST_OPTS, abstract away WIN32 defaults Date: Tue, 1 Nov 2022 23:51:33 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The rationale for adding "--no-bin-wrappers" and "--no-chain-lint" in 2ea1d8b5563 (cmake: make it easier to diagnose regressions in CTest runs, 2022-10-18) was those options slowed down the tests considerably on Windows. But since f31b6244950 (Merge branch 'yw/cmake-updates', 2022-06-07) and with the preceding commits cmake and ctest are not Windows-specific anymore. So let's set those same options by default on Windows, but do so with the set() facility. As noted in cmake's documentation[1] this integrates nicely with e.g. cmake-gui. On *nix we don't set any custom options. The change in 2ea1d8b5563 didn't discuss why Windows should have divergent defaults with "cmake" and "make", but such reasons presumably don't apply on *nix. I for one am happy with the same defaults as the tests have when running via the Makefile. With the "message()" addition we'll emit this when running cmake: Generating hook-list.h -- Using user-selected test options: -vixd -- Configuring done -- Generating done -- Build files have been written to: /home/avar/g/git/contrib/buildsystems/out Unfortunately cmake doesn't support a non-hacky way to pass variables to ctest without re-running cmake itself, so when re-running tests via cmake and wanting to change the test defaults we'll need: GIT_TEST_OPTS=-i cmake -S contrib/buildsystems -B contrib/buildsystems/out && ctest --jobs=$(nproc) --test-dir contrib/buildsystems/out -R t0071 --verbose 1. https://cmake.org/cmake/help/latest/command/set.html#set-cache-entry Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 46 +++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index f0de37b35a1..6a3240d4ffa 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -49,7 +49,7 @@ To use this in Visual Studio: Open the worktree as a folder. Visual Studio 2019 and later will detect the CMake configuration automatically and set everything up for you, -ready to build. You can then run the tests in `t/` via a regular Git Bash. +ready to build. See "== Running the tests ==" below for running the tests. Note: Visual Studio also has the option of opening `CMakeLists.txt` directly; Using this option, Visual Studio will not find the source code, @@ -74,6 +74,35 @@ empty(default) : NOTE: -DCMAKE_BUILD_TYPE is optional. For multi-config generators like Visual Studio this option is ignored + +== Running the tests == + +Once we've built in "contrib/buildsystems/out" the tests can be run at +the top-level (note: not the generated "contrib/buildsystems/out/t/" +drectory). If no top-level build is found (as created with the +Makefile) the t/test-lib.sh will discover the git in +"contrib/buildsystems/out" on e.g.: + + (cd t && ./t0001-init.sh) + setup: had no ../git, but found & used cmake built git in ../contrib/buildsystems/out/git + [...] + +The tests can also be run with ctest, e.g. after building with "cmake" +and "make" or "msbuild" run, from the top-level e.g.: + + ctest --test-dir contrib/buildsystems/out --jobs="$(nproc)"--output-on-failure + +Options can be passed by setting GIT_TEST_OPTIONS before invoking +cmake. E.g. on a Linux system with systemd the tests can be sped up by +using a ramdisk for the scratch files: + + GIT_TEST_OPTS="--root=/run/user/$(id -u)/ctest" cmake -S contrib/buildsystems -B contrib/buildsystems/out + [...] + -- Using user-selected test options: --root=/run/user/1001/ctest + +Then running the tests with "ctest" (here with --jobs="$(nproc)"): + + ctest --jobs=$(nproc) --test-dir contrib/buildsystems/out ]] cmake_minimum_required(VERSION 3.14) @@ -1110,10 +1139,23 @@ endif() file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") +string(COMPARE NOTEQUAL "$ENV{GIT_TEST_OPTS}" "" HAVE_USER_GIT_TEST_OPTS) +if(HAVE_USER_GIT_TEST_OPTS) + set(GIT_TEST_OPTS "$ENV{GIT_TEST_OPTS}") + message(STATUS "Using user-selected test options: ${GIT_TEST_OPTS}") +elseif(WIN32) + set(GIT_TEST_OPTS "--no-bin-wrappers --no-chain-lint -vx") + message(STATUS "Using Windowns-specific default test options: ${GIT_TEST_OPTS}") +else() + set(GIT_TEST_OPTS "") + message(STATUS "No custom test options selected, set e.g. GIT_TEST_OPTS=\"-vixd\"") +endif() +separate_arguments(GIT_TEST_OPTS) + #test foreach(tsh ${test_scipts}) add_test(NAME ${tsh} - COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx + COMMAND ${SH_EXE} ${tsh} ${GIT_TEST_OPTS} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t) set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR}) From patchwork Tue Nov 1 22:51:34 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: 13027597 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 F2861C4332F for ; Tue, 1 Nov 2022 22:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231381AbiKAWw1 (ORCPT ); Tue, 1 Nov 2022 18:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbiKAWwK (ORCPT ); Tue, 1 Nov 2022 18:52:10 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB2E1FFB4 for ; Tue, 1 Nov 2022 15:52:00 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id n12so40748583eja.11 for ; Tue, 01 Nov 2022 15:52:00 -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=SeQtozax5I/z+VgVUZXDbYJfoXJBUFT9fI2/59BB0NQ=; b=IEZk7Fyi2Sti8E2LVgQ9Th9u3JCXQLH2uUIweErWggvKi4Wokz0GapP/yd2Kl7MqF5 kcO4MBtv/efThSvsnBLnadJF3UAgtcjjUPmvdpGbVGocQVy9Q+D5M9EMoRTP15QQ+gHC bxQ+yzyk4nhqFOXH6pfkpUHuqX2e+lDBAAInQE1QtSyuJ+ZBpYxZViW8Q+KJeLhYsL06 k4qxTHHvV0bgGPfAnvF7nXV2TZDlm3++vB3rtNM70u8xjbzZDsfDwbmAj9WtTSPx1d7v qV+tSy37MsN8D1BARl1nKuaUDjyNeu6S/9lbZCg3H3bqaJhzSWiOkVTG80gHTqCisHuo M8OQ== 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=SeQtozax5I/z+VgVUZXDbYJfoXJBUFT9fI2/59BB0NQ=; b=iiunJ6YXjP19LRpK4+4FIT8Ns3wJt3J4CZKjQoH5QxHs9CZ5MoRGo4KDTg407NGjXO RClIMCu/Ds485TqBbJe63SyP+IRLLyChxb1OHrexQygIMH+SdBMlAOrD1ap0axl2X7L0 2ayLeuWV59/NbQo/2TIgoO4YVbCXDy7nL5qGmIe2gvo7gfoqfDW9NVb2yELdXsKUWwJD DmGQtRveq7Tm0T17cl8qbkxn7RbwZ+aafSlnL5/ao6HdOLVL001Oee8YB/MBSRdBPAOK j9ZZPLIfs2y/CD8sodcfN9vQNRWcKNyoL+WQZqUhA3W1b6U2Letd/7REGo4J6HZyK+vP Pyzg== X-Gm-Message-State: ACrzQf38St834Z7AeGhpTv+0lCliF3Ltop6T9SPuqjV96uC0yxXYPtsA +2W2K7BMbmG94+RTrtAwjdLce5d0No1VrA== X-Google-Smtp-Source: AMsMyM5+cMug3geI6Qoc0mfQwYftPCcQ2Ets8mC/dsEv/CaEBI2oj1ewYP870JzPWn65fFYqH/gx7A== X-Received: by 2002:a17:907:7faa:b0:7ad:e8e4:6ac7 with SMTP id qk42-20020a1709077faa00b007ade8e46ac7mr7244795ejc.21.1667343118490; Tue, 01 Nov 2022 15:51:58 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:57 -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 v3 10/12] cmake: increase test timeout on Windows only Date: Tue, 1 Nov 2022 23:51:34 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Per c858750b41c (cmake: increase time-out for a long-running test, 2022-10-18) the reason to set a custom timeout for t7112-reset-submodule.sh is Windows-specific. Let's only do that on Windows then. Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 6a3240d4ffa..be5dce8ec69 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1161,8 +1161,10 @@ foreach(tsh ${test_scipts}) GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR}) endforeach() -# This test script takes an extremely long time and is known to time out even -# on fast machines because it requires in excess of one hour to run -set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000) +if(WIN32) + # This test script takes an extremely long time and is known to time out even + # on fast machines because it requires in excess of one hour to run + set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000) +endif() endif()#BUILD_TESTING From patchwork Tue Nov 1 22:51:35 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: 13027596 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 E2DD1C433FE for ; Tue, 1 Nov 2022 22:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231326AbiKAWwZ (ORCPT ); Tue, 1 Nov 2022 18:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiKAWwK (ORCPT ); Tue, 1 Nov 2022 18:52:10 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 295DC1FFA4 for ; Tue, 1 Nov 2022 15:52:00 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id bj12so40755482ejb.13 for ; Tue, 01 Nov 2022 15:52:00 -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=rE4udwG8KmPB/LbfQEK6H2sgJg2hW+Z0nCZ4rMk1tMU=; b=Ss8aFuJv1rsypueOl+j2khczfGnSeAWplfBTrRFhjDs2Susw/6qt0sP8UHne3ChgyH Wy2hl6Itg37GBinFxg7xYc4KhcCNMt0BgBM36RkiWvPKAWLTfsUjTGoqCmuo/08aIco6 DbHsEeHln4cMXuru58Xvzis0kPBixXoAlwKrihUY0jBjdlJrFNWEMpdCZWPj7g/LWADf NNkQ3fbDYaQzoesdMGtYfqYdwon4gSiE06OUrsIXo3DEQgooagI27eUatH/DS7A68hbS d9VRN/s3EmxrRh4esKWbiz5bM/RlsvZKTlkVwCD+jRZtmIAXucveI9vvoePvQnTq3b8s +c2w== 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=rE4udwG8KmPB/LbfQEK6H2sgJg2hW+Z0nCZ4rMk1tMU=; b=F/OP40d9XT0OUkgTozSyO4tXinOEKg7Egx8GWhn/HTs23D9vJPZCeL7tDPNRjobg7g FTF+MYm/3FVH2CHERfyQ+74n4iPD8ReW+CtSa7rpH5NiwafldSsTMxWjfFfFK12vRrTG Qt3pOaDThBW1k+3rSx8KF17LA//l6uQfGfI67vbVXRoZyb8dChMnJbA5qNolsFDPd1Ww smwgB/VTOcTasL7qQSKYrgSshcq7ZqmSG4FkCj6hQEz4EivhX5glfNPTX8bxyYyzfyoP CACK00DN01rmrt/MhnawJIJtx1Z+jtU8FJgxfOQCh883dTzHQwGzcHH5wkcTD6Kii00/ tAzA== X-Gm-Message-State: ACrzQf0DVYkqyPvmC37cetjBbylpiruJtw0u/s4O2RTPcU3mOOPO71GF IiqN9EnZ8ziogrM2YOxtnSOtooxq+YYBjg== X-Google-Smtp-Source: AMsMyM4GUQczJyubfobRzT+nvI2bWLy3wdDRhttiteIF0uUgNsLnVO4ObzQ/hkm+/qS9Tb3YLj8H5w== X-Received: by 2002:a17:906:db07:b0:77b:82cf:54af with SMTP id xj7-20020a170906db0700b0077b82cf54afmr21105447ejb.666.1667343119443; Tue, 01 Nov 2022 15:51:59 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:58 -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 v3 11/12] cmake: copy over git-p4.py for t983[56] perforce test Date: Tue, 1 Nov 2022 23:51:35 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 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 be5dce8ec69..2e299e933a6 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -917,6 +917,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 Tue Nov 1 22:51:36 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: 13027598 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 EDEBBC433FE for ; Tue, 1 Nov 2022 22:52:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbiKAWwv (ORCPT ); Tue, 1 Nov 2022 18:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbiKAWwQ (ORCPT ); Tue, 1 Nov 2022 18:52:16 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CA11FFBA for ; Tue, 1 Nov 2022 15:52:02 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id r14so23896632edc.7 for ; Tue, 01 Nov 2022 15:52:02 -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=A5xW6N7/nMUpG1e7BVOv1btDovF1oSv1iu9OhV4y0N4=; b=hNA+wIq5fJM7NCYMvSU6fCH0NgQ7AiC99Ng4pESqkmarwfJdcm3QsajWtWfxTpph4V S5cjca5qfaPsn9N/4papikqmhpHPayoXN+M58YKnQ1aakD5qDMJb7291dtM0G8qBfhmH MBuwZi+y2oY846R2uwKxedHq6Xv67+Nc9mOlyuftGe54rvdQht7fF3up/1MpneOnPeKr rtTK4rSH7jnRjYxQp72vOrHOeDF4fK5Be8NRkqRUvOATz2Gn1eiDmHQ9r23ZYhezD5tQ Y9S8f1N+Mx+BmO58qc3Z/a3Zmg9CoRo7qw3hFu9sxTRvlxzDdcDXdS7Lmbwix6wIDfTZ 2ojw== 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=A5xW6N7/nMUpG1e7BVOv1btDovF1oSv1iu9OhV4y0N4=; b=0/q6KUG24L03JRxkou48o6qejO7By3cfNUMthdUOaq8LlVbtSFjhg0yOm6FTJxMeM7 wcgVxte7E0V8EzePnlPDvEGtSxyQOIwd29YbgroH1dnYt7rDrKIb9L2wBbqIEfSV/fzv wBJ2bMVY8zndBabu1dV54Y15kWykhRPJtJLFguGORrin5fpakuyE0oV4omO3K2XAX5T/ gV9N04AOBIpMfPCJba7iF0U/PTebtqf+USDklFrEiv7GXaiKSZnvZ2Oyb5uOHaO9IpqK +EkUm2dJjwvYVYiLg5E3L4w36sjblNBzpuoV1lxhM8bIyOC1LLRxBLy/urtI51Zs5mVs 57Uw== X-Gm-Message-State: ACrzQf266aKWybjf7013RnR1ODfVup5KhdBhlYm0Y6obKXcbu/iuAzwW BBegBxeVYu2KEF/CL9A990xpqvx2PFO/4Q== X-Google-Smtp-Source: AMsMyM4LGJo36Tf4v/0yQYZ8FRZE/jvuBPPEzHga/zHfuL1bngHGJNIT8wrnoxjiNNXBmsv4ch0VLw== X-Received: by 2002:aa7:d40e:0:b0:463:3844:f160 with SMTP id z14-20020aa7d40e000000b004633844f160mr15910463edq.296.1667343120394; Tue, 01 Nov 2022 15:52:00 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id x20-20020aa7d6d4000000b004580862ffdbsm5012689edr.59.2022.11.01.15.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 15:51:59 -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 v3 12/12] CI: add a "linux-cmake-test" to run cmake & ctest on linux Date: Tue, 1 Nov 2022 23:51:36 +0100 Message-Id: X-Mailer: git-send-email 2.38.0.1280.g8136eb6fab2 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 bd6f75b8e0f..68c2e134646 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