From patchwork Thu Oct 27 03:26:42 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: 13021537 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 80CF4C433FE for ; Thu, 27 Oct 2022 03:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234078AbiJ0D1K (ORCPT ); Wed, 26 Oct 2022 23:27:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233810AbiJ0D1C (ORCPT ); Wed, 26 Oct 2022 23:27:02 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF60F70AF for ; Wed, 26 Oct 2022 20:27:00 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id j15so88576wrq.3 for ; Wed, 26 Oct 2022 20:27: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=AwoTPCJ8FVYjbbQ2mQca8EGfR+fXP1CH3i1PkwD7NmY=; b=hzjlc6conDawDgqCqXh6L2cWpjy4b6Dy9Y5zr6aKBcSi2yQDIZfawpZO9d9NLpJBaA UAoqXi4OOUTztkGTD0TzsRYOmN/+AoH2ELWEGS1KbQJd/QBPv908cZYjZZsKOVXYKNUn ysMknstReJsVZj+kFBUU4yG4d8LihL2Xwf7mBEnpt6jIfv+Xejq/b9oImLaRNkN/nkGR 48qYE5hs7JeOiYozMR65sPHoT1+jVh2d+aIldOaZL865bzTTiyo8NSpyy2Mw2JB+I/HT At9I2gWPT8ku1a4WhwyW7TRB2LeC7nY9ffTTvdOG7zqjy5k+tQZJI1TES3rd1wuDrlzK o+Hg== 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=AwoTPCJ8FVYjbbQ2mQca8EGfR+fXP1CH3i1PkwD7NmY=; b=C1VhmcCHDkw8A8LeLKwN3TgRwfNVNQ+qpSQ+uRQWVJy1JDgXrAZFtWnl88F3zb7LIK Dy8ubxmTGB54sbqs3GU4gEA60dl2VqPPpOLrVCYcfnkydFsGrAiW9Slk5zvyD+Npvx/b hzlwR/8iQKZrc07w0Rti5oWM7dCTn55OsVfaxHIKDBkVOtZBoYk+12bICc9c61X9T+Fu 1yiyo0wpr3eREMzgFLWbWy85Yv2TckqET4uZ4ReMhi9a2nvatjpa9fKC5uaHNbaaaNGI axOllIGXV8Yyno3xK90TciywVoqdaslPICp3C3nldCWA/JGv8EolCXLhkTVfpvouGNWO EajQ== X-Gm-Message-State: ACrzQf3lHe/WGYs3mbgY6rWJQ6hP7NrkYSC3wCms0UOyzUBmfDQ/Ax8a 33usJA392q54/RnZ8/AqcIEGLtOXOEmFww== X-Google-Smtp-Source: AMsMyM5/KwfWmoz7ZeTWswh/V29Hv8piXD5IOI6u7ne5DlHBGzpy3qXb7ImW0fQ2fDAIBrh6q49zkQ== X-Received: by 2002:a05:6000:1887:b0:236:7b1a:b14c with SMTP id a7-20020a056000188700b002367b1ab14cmr9289420wri.173.1666841218442; Wed, 26 Oct 2022 20:26:58 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:26: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 v2 01/11] cmake: don't "mkdir -p" and "cd" in build instructions Date: Thu, 27 Oct 2022 05:26:42 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 Thu Oct 27 03:26:43 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: 13021538 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 D9ECAC38A2D for ; Thu, 27 Oct 2022 03:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233884AbiJ0D1N (ORCPT ); Wed, 26 Oct 2022 23:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233817AbiJ0D1D (ORCPT ); Wed, 26 Oct 2022 23:27:03 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807EAF88D4 for ; Wed, 26 Oct 2022 20:27:01 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id a14so77833wru.5 for ; Wed, 26 Oct 2022 20:27:01 -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=ojycgPXUwdE8I42vBJDKHZf9ozYioO388esYPJ+UEZQ=; b=WyyGciQ2s/pHoOJ84wVmNn20hyeZlpyr0h6V8vXfGjPFZLDXPsFEq9ngtMpkk9VzRz 7y2cBpMv+0Y8CG7jPIPpjUy6yyvGSWdbIIhXcrmHb/F3stRvgN8uGM30Dh3eTRkFtueh mcyDqCrTsema7kaMxR2H7Y+Mo5PhFvvH7gJs6nqTlgdV3fx49yB7y3qk3W4XEnv3hVfU m3LCgasLP+LKRgHNJhLHm2S+2rncZErE/V20y6pkW5ICS9wSH0Ue8VfZvlOPlMbUj9hE jbgxTwqPET6Z4kVU5HJO/o12fuhD4mtjd8Hc0GyXMcrKIPLX9jRKHH2uYa4HIoHimxGw roYg== 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=ojycgPXUwdE8I42vBJDKHZf9ozYioO388esYPJ+UEZQ=; b=KuDAW8FrcnN+EltFxXany6qfu0sMve657rZt3uo8jHjyDZzKbsTb56T4coNAcl56B/ Vpn3Ju2wZPHEPpL7H2bf/dg5J9DjFx8pZMQKyokwT64usLhDtk0mvO5YMfeSnWTomEN7 eAykIobvO/mgEMUst4+fdXdukUq3YPJYG4D2ANyDZdt/rO2ILLBNhMN/coolv6L9iTe6 jW/0ZI36hr4JnLvauLHOoeZ28tQGSz2Er9yS7gQt4zahym8cZUdiGTlhl6/wiSR7sfvv 5/Aa8X5EuqeWuf7MfatVute0YFGUTcUsSu1ST7hgkziFJuNYIeYRSit/74DPSe0AnbSh VqjA== X-Gm-Message-State: ACrzQf3u8cDut6Adcw0itx8WGcVtJgba/329oAD4ReQq4fHHoH5Mqf/P niKgGW24fXlLjtIN5j4+mjLiY0m5gjGTqA== X-Google-Smtp-Source: AMsMyM6NYBDk0w2iFonGco/0j5H9si3jfzpfJ4pVU9AVoA+gU7dvHYFU1RQYGWoAlp13oykU4Pryyg== X-Received: by 2002:a5d:42c4:0:b0:236:637c:6c71 with SMTP id t4-20020a5d42c4000000b00236637c6c71mr16217800wrr.499.1666841219760; Wed, 26 Oct 2022 20:26:59 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:26: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 v2 02/11] cmake: update instructions for portable CMakeLists.txt Date: Thu, 27 Oct 2022 05:26:43 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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..a76a3c46767 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 == + +One the recipe is created a build recipe will be created. For Windows +Open contrib/buildsystems/git.sln on Windows 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 Thu Oct 27 03:26:44 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: 13021539 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 F021AC433FE for ; Thu, 27 Oct 2022 03:27:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234141AbiJ0D1R (ORCPT ); Wed, 26 Oct 2022 23:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233901AbiJ0D1D (ORCPT ); Wed, 26 Oct 2022 23:27:03 -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 D61D2F973B for ; Wed, 26 Oct 2022 20:27:02 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id jb18so38909wmb.4 for ; Wed, 26 Oct 2022 20:27: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=Q+b/XP+agw/0T7AFp70dh1VWIQcmAsgkeXobWJllMAI=; b=LMcPsgIbBgurIOCrFJJsXAnZKneZhr3fvDnKCchZh1p81UynUK8cNXccMZ+MNM3hQX D0A1tPx8gKNEOZwmrBfB+pWTrYIONBHS8+6xR2VWrTjHnwwrj6iwrzIukVBshLVeVhqh wp6sI/1LgKh1M7mzyQi+dIpFIaexY0wjAF2weQ9aku2kKJFXr0/xKGTipOtCV89t2WSa 0zQulyLk6IT07KfZhGjFhw4rEudEVJsDDowIXNmVeZlM1/3weU/txF2qLkZ3VL4FMwL0 Cez8KYUkjV29sZd2lThTEyQAJOw/2YsAn6nqZ/s2/lZQMhJJw+9W5Mts6HqlGWt7zPRf y7aA== 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=Q+b/XP+agw/0T7AFp70dh1VWIQcmAsgkeXobWJllMAI=; b=Tg2Y7JhJDIRgttKB2pY0x9G3rF/CvLvHcHHWlVOdZoAjimhUiDNC/7n42m1Q5ig9ko dieFqbUWZ+rUlyhlkiq77zgsHHhm/Uoze66V6aEPb2MPLzLCeZMoCOrjfqZa6tsj8T56 gEpbMLifP2koY4qCubXNWKb8qQXcg1sZ+gULhhSOeos0jtk4xPbsbt9rIRoeghvIopd5 jrv/bshTdiggSvMB+kadEnFU65k0suhuanPSOgXyOUjfINHVRxQ7XH+I4Z5eGbVX5I08 vXEDhyE+L0Ed7YKKfxItZKmweqcoXwK9Yr51euKPEAmWqqxZ9thz8OEqfU8c1WFlEhQ+ h8sA== X-Gm-Message-State: ACrzQf1qeNBCIoS3kOltymvFrcUYD/oEdg/tG4AcXKfcT8CYhDXeXard YTwZpO5iT45WaPTeEexcG1HDM2C+q4cvfg== X-Google-Smtp-Source: AMsMyM5Vj+Z3V42Ko6w3h8k0QnCKGFMxpsRAtBT1zbqei7SWNLVVvys/LU7U6yqdIzlvctNMw/WlkQ== X-Received: by 2002:a05:600c:a04:b0:3b4:f20e:63f4 with SMTP id z4-20020a05600c0a0400b003b4f20e63f4mr4303461wmp.201.1666841221133; Wed, 26 Oct 2022 20:27:01 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:00 -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 v2 03/11] cmake: don't copy chainlint.pl to build directory Date: Thu, 27 Oct 2022 05:26:44 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 a76a3c46767..4db4997ff0c 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 Thu Oct 27 03:26:45 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: 13021541 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 B1A8CC38A2D for ; Thu, 27 Oct 2022 03:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234182AbiJ0D1X (ORCPT ); Wed, 26 Oct 2022 23:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233628AbiJ0D1H (ORCPT ); Wed, 26 Oct 2022 23:27:07 -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 83DD4580AA for ; Wed, 26 Oct 2022 20:27:04 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id bg9-20020a05600c3c8900b003bf249616b0so159619wmb.3 for ; Wed, 26 Oct 2022 20:27:04 -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=xDFboPXq0JTgGZSH0IWOs+AdU7FvFYPiEYp+H3dN428=; b=J6AySMm5L7UZBGM3i6R/gLVcxyHvastbVBymoGuLNNLrkUuLzafSNpZsV2o5pZOaPr LucZ4BxHHe2e8WRR8zHoxk0vPXyUBrUHOeRNf8YS1+clB5D80lM1U1ysy+Jo9njMjnFl i7PPzEDjRo+SWJx/A3zeoW66bZvX8c/sEfLMcEdTwBeImZlMWjURUw07+5AOewHv3BsT 3xB0oJcMC/wjlARiVKYboSdwaNHpp8gPZUriYVaDFAJVJRMokzgTT/pwbxGTgkWEaNzq zwPuDakROCybWE3X6fB8pwcw4+ayWis4uq+Lg65Wv1fUgQzA1yHPvYzz1xc7UeAuKo/8 n4xw== 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=xDFboPXq0JTgGZSH0IWOs+AdU7FvFYPiEYp+H3dN428=; b=2XTZTlZ98fL0R4Rzu5g8yaxqV99yvAlyjCNRJrVP+3dgtDozxG7UFcChFDKAx4mPDg GXknHdMI212kqa/hIvVoG2+qcUr0oA8+JP9yBguU1h1Pe1shIdsZJfNkXLS2NBwx6g1V 3isotg14Jb66z3sYQ2N36Fzl5L0ONQWJaqnTNHyvFcirp6ytQ1G2E1lgcTL/uGqydu1S 9lRP4SURDNlD28OsDClPh2BjLsKCg5R8guU1DyF75rgt8wxIsA+89sAS8EljnY8yJWNy xY0CqQR71af9MBT/UZ7rxZvgVpgulyyssF89HJ3fcPMNG9m8eEOgmmtmtw4bclS//A6M CCOw== X-Gm-Message-State: ACrzQf200IsuLfmAYi4B4Wnb1+RCOaPldmiCxwBOV5hVSo6kaaluLe8b 34EE+gteZrWRsv//bHvR1gYJR/23c06tqA== X-Google-Smtp-Source: AMsMyM5mC+8c8Vbj25bdiUJU28OHOz2tsesu50iee2JZQkG1ByNWFRBaLn1dXrIeq+CmK5MCJwgUOw== X-Received: by 2002:a05:600c:4448:b0:3c6:fb65:2462 with SMTP id v8-20020a05600c444800b003c6fb652462mr4339128wmn.39.1666841222772; Wed, 26 Oct 2022 20:27:02 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:02 -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 v2 04/11] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4 Date: Thu, 27 Oct 2022 05:26:45 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 4db4997ff0c..1ae6832dc26 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 Thu Oct 27 03:26:46 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: 13021540 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 DEB26C433FE for ; Thu, 27 Oct 2022 03:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233801AbiJ0D1U (ORCPT ); Wed, 26 Oct 2022 23:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233968AbiJ0D1H (ORCPT ); Wed, 26 Oct 2022 23:27:07 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91D03F88E1 for ; Wed, 26 Oct 2022 20:27:04 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id a14so78007wru.5 for ; Wed, 26 Oct 2022 20:27:04 -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=BrKZtYvHvsAHexElUGurbPsbqmlbhEFU47LgmDsCb5I=; b=DYlwXN1tthMi73j3HDSctyMUBR5/0ge81a76b63PfBqavy/nmM+oH3l2uuGaDWC2h9 3P2Nv7mIvhQQddQomoo3o0YWMRBQg4LQ94rdYBQ9Q9ylLcmNj5Z24RqgfcXOEoPxgH0z OMPhZzm9m8rbzwCX0WZJXZ6ZdhGJb/hjyF7HojPvPj+U9w6BSM+YOGeM09F589l8t3v3 jI75w6IVRYJskkM36Y4hFBzVCwbj/hBzQFxRIAZVRIlZDa2w288jzET5W3vY3KVPj1y5 UBC5Zc1JK+NLaV/7kb4ThQejkc+0Gsvd/YstvSKodv/izf2hv8FpUpikiEaHibLwPzVp oGhA== 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=BrKZtYvHvsAHexElUGurbPsbqmlbhEFU47LgmDsCb5I=; b=AzLVDzJ/TdLekNzVDmAHWQ5fZw8xvLDCJkXOEBFwEGlFwId5liJVqVRe6G+rqGOdX4 EQ77t188lbK6kAozbSVyWKhMwZzT7GTI7MTxEsusiC/Fc5uWSsbVV73hpgCDUfQ6DnvU 4HeFr5K4DVXH9AN6RB1IRdcFYXo3lOqbwWZ9ZqQo/pfQDGSSmxN2aii81Dll4URIiUUi xCXkqzYO3o7W8rlQHnzfuM624sFZPcORNQ2nMZihH/6jFVILs0A3D518Bp33L5Ffua6b WOZzZtJFQfRsEEqJfF217ZYFM1vhxT00lZEUNBHWR2/6yLK2Vie6DwM4O/SchJcC9AqW Bl6Q== X-Gm-Message-State: ACrzQf3B4232T0gdmuFwyx5OfduGHQ12N48k79GlucLnfKIZo/QyCXFV g3RVlPHUqkrrT1OgQuxXzrOduGjSKf5uOQ== X-Google-Smtp-Source: AMsMyM7LXd3i+sArYUU4z6ypXzweWNgcOECK1JgYSWfcZdYaphRCQDIxxVE7aUa9nuiWY8VtCgFbnw== X-Received: by 2002:a5d:4302:0:b0:232:ce6b:40c0 with SMTP id h2-20020a5d4302000000b00232ce6b40c0mr30164304wrq.415.1666841223789; Wed, 26 Oct 2022 20:27:03 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:03 -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 v2 05/11] cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable Date: Thu, 27 Oct 2022 05:26:46 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 1ae6832dc26..1c271395ed0 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 Thu Oct 27 03:26:47 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: 13021542 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 8B9C3C433FE for ; Thu, 27 Oct 2022 03:27:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234268AbiJ0D1l (ORCPT ); Wed, 26 Oct 2022 23:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234015AbiJ0D1I (ORCPT ); Wed, 26 Oct 2022 23:27:08 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C1BFA00E for ; Wed, 26 Oct 2022 20:27:05 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id n14so40492wmq.3 for ; Wed, 26 Oct 2022 20:27:05 -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=jT1uAv+ZzsACAirCy388QuCYpGC0avA/0jDSVjGvWU8=; b=GYt2T5UvSjJ4gp23BMGui0eXrjUyZECFeZVx13KIknxv8aysfQip2e8/i53PoovlFi 6m7UGW5F4YfIetGwrMuyULM1ewFrPA3Uwr1tY69734kP8czvw6EY/k2Id5Tl3cRaj0Dk N/0UYutHnCQHCc1IAVOvd7ZMgNJz06vBZfOgtsrJRwp3mEYuI7iDbeM0vOtaReMAyYwU Itx4DiirJWvLMtLlfNFiWo2xP9hoeTVt9r9JXSCZGB29KtXGzZjin+ILyT50dcGsieeR HC+18HWYxlG+jupJFH7QhNDd2Lss2R64CBG7qX/CEqH72wuHSIwRrlDGCibLR4RJOsPC 7Ohw== 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=jT1uAv+ZzsACAirCy388QuCYpGC0avA/0jDSVjGvWU8=; b=xVSKysLgLM2KC8cruShn78pq5gdZ+8H7Rf2DzD5aYnXeKWuEhp6TOPOz0eb9tG1SbO V5RZOsjNWIztbg5QKISDsIxskyL44whZzRLIOFOYit8f51iP7fqhNJaqnH5SRoM3glHq piBTJ7jGJYSpcWz1V8HJ56T6QwtlAaielOJRxC/v/daRvBoj0rZEcgP4n0sO6XiYmMLq Mj2xKqE30m9XQ9CQk+5dLbns1mG67r3wVrSbsHAVyk7vH+G1QSe60swuGiZA5D4h8mkN f8KPGe0iQiJcBc5rQmqsTVpzHUXWQoYoJliRQISFT8+HuSmicOE5bVEYyT9DkrJDx11J YEAw== X-Gm-Message-State: ACrzQf3/QV1dJ+i8x1pS3I7DyrSce9UqtrI9UO7IpxZ9FJcSyRanEzGq m8cNf7tIuCVLlsNYUsG/Fh8pTqhPo5qIPg== X-Google-Smtp-Source: AMsMyM4i552X7WNzT61GP3wHvdYgg7HCYQMN6t701ANtkjg0aa3hvHaAUQPK25erf8ERurDp+IYoBw== X-Received: by 2002:a05:600c:4fd2:b0:3c6:db8a:4d2a with SMTP id o18-20020a05600c4fd200b003c6db8a4d2amr4222533wmq.178.1666841224894; Wed, 26 Oct 2022 20:27:04 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:04 -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 v2 06/11] cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh Date: Thu, 27 Oct 2022 05:26:47 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 1c271395ed0..e9f979c4e5c 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 Thu Oct 27 03:26:48 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: 13021544 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 E76ACC433FE for ; Thu, 27 Oct 2022 03:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234000AbiJ0D1z (ORCPT ); Wed, 26 Oct 2022 23:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234041AbiJ0D1J (ORCPT ); Wed, 26 Oct 2022 23:27:09 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6B1DFAA5C for ; Wed, 26 Oct 2022 20:27:07 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id g12so55794wrs.10 for ; Wed, 26 Oct 2022 20:27:07 -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=wkX5lyjU3HruwZsTYTP65qMriFFUGITh5yMD+ykmeVw=; b=NOiLDwM31DZPL31vCTRdLZ7jKRpPZD0CxyFmdk2X9oRf9eqcGDGo5oz7anSNwGqUTZ RUKC46BnlTUAMTqkRjuCKM0pteeU08+Twp8aJThQychDA75dynt1uk8CdICvQHiEHPYC 9Y4rmCu2pZ79aKd4CtneXDgdKVnVU/Wp8Tc0TceqIZsRM1cvzJuR2HP6mHxv/idm15pY H6OsQT5UGgXuHx2UObhh+R9KclJW1DTfnTDiCqWbkadHzKu9dov191qKiIlztDDLCd12 7qTAIRh4/nuOmK7cBkEw+ucxRk5iIjjQbvJs1JsnxLHG1qGpElLSLcRhv34lBzWjA7ZT UGvw== 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=wkX5lyjU3HruwZsTYTP65qMriFFUGITh5yMD+ykmeVw=; b=Z/CGvkIyTlEA9A13LvaOSs5ajQyaBEhlcZVeEKouGMEmwwrt+tl2+sAG854pXzLwuo dqgxjrWYHbBu7PcPAQDjUghsRBxEwIBpFH42V4rfyhKgDaNz4MeuXaP7hoBDWyFXLlx9 RvVtAz5+Zij53baj9SPVMf9Pepevtds6DMkYFKWCKrR3mKqE8EFva/V4LDKZdpv7PAnq dfQMYkYMVoabVaYrH80QGJOjPd2OdRBOB1kcyRGcH1HIZgNIDaktB2AMhwWU5DiK8qJc ERcQIY8If3AaHBNY2waV0NSHjCTQhCMCKz2bAPn5JXmhbPBwvWF7n8Yo9xSR7GqW4FCn c89g== X-Gm-Message-State: ACrzQf0ZWgdoPtC+LrrxOLSN40tbcCKhtHUMihVx/HokDXk6QYkcR0Gk 28FL/4apmgGET3dpUpeIKdWdChqmQO+lzA== X-Google-Smtp-Source: AMsMyM5pujoEP6qlP7PmpwkrYJ/Xqpf/Uvhr5DOSshGyetayt+VLLRZG09Iq12WQWWqm0s49YIKSvA== X-Received: by 2002:adf:f7d2:0:b0:236:87bc:a8f7 with SMTP id a18-20020adff7d2000000b0023687bca8f7mr5864169wrq.579.1666841225804; Wed, 26 Oct 2022 20:27:05 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:05 -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 v2 07/11] test-lib.sh: support a "GIT_TEST_BUILD_DIR" Date: Thu, 27 Oct 2022 05:26:48 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 Thu Oct 27 03:26:49 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: 13021543 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 EA18AFA3740 for ; Thu, 27 Oct 2022 03:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234329AbiJ0D1x (ORCPT ); Wed, 26 Oct 2022 23:27:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbiJ0D1J (ORCPT ); Wed, 26 Oct 2022 23:27:09 -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 ECADDFAE52 for ; Wed, 26 Oct 2022 20:27:07 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id bg9-20020a05600c3c8900b003bf249616b0so159692wmb.3 for ; Wed, 26 Oct 2022 20:27:07 -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=QYIVn942dgHh1/ZxN6JWnghY4CLFe4AMuDWDPlWc474=; b=blpEoPpv11LL18RkzBS1DNVdeMBLsM2W1+Z4nV2yr9OFUHvLTjzF/HArd2OfAm6tDL CZy66BMyP624ZrECqUEz98U0C1aTYsseK0Q8ZuE0JWXx7j09dxb9YQANgXppWwWrHnNt hDjy232VbktwuhPDeE1IqoXHqp3ndnS3ODumI1MK/S9rdqRSkUD0yV+/wQdE+QMBUP4O 8ytEAAaWvWyzseoFj+jnQaVeMRkQpL+24sRpN9WSb2plYtfU/rNo3wi4TweUqp4+wkrY GwR8amD6Mw35Eq1krEtWAwTwauYLbt9DR6dEUkO8RyWlLvl2JDfuJuAofnd1YcozK1nO d6Pg== 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=QYIVn942dgHh1/ZxN6JWnghY4CLFe4AMuDWDPlWc474=; b=Hn08O5PmJ4Lbwr0Fywz/8HSneltW08ddua+jpYOGQUkfdMtZqEel1dMUedjcNzsu/1 mNe+hGFkIQYuoSWdTLrWgR6xdUzmJ+TG58stWKZF7eIU3o5m0zXAKOVxNeq6fzMHiaZ9 QXnM26g6H+HRtZKk8Rwraqpy1JIHVCROrv0ktXF3eeS7gLQ4Jys/8kC8WdkDsEhaOTQJ MpWhUtkk6U4wjWgrTQcbokDBp19jNcuZN6VTx96MWmCwoj8idSi/IjK8E7K9POiYBMBM 2CPvZ7vjDRTwgo1+uQSdmIWyHMFT0RVtvrqHbCdeB+Gov05uqtU4SWoThGdR/MO2igHD zSfw== X-Gm-Message-State: ACrzQf1yw+ksUsAtMbfRrxyLES0cgUbrGTTklW3Sfv+K6dsd3/Aie40U 6JJDcH3+YWyNYJWEpbH1oZuZ1aWNHz0EHA== X-Google-Smtp-Source: AMsMyM59hoiMD+Muc6FfUYI/EVK/T6RuB9+1m5YD3UcmsSCIERabOFZYnSOWyV45JVm9VP87VzlBkg== X-Received: by 2002:a05:600c:4586:b0:3c6:fbb0:bf2d with SMTP id r6-20020a05600c458600b003c6fbb0bf2dmr4273669wmo.13.1666841227212; Wed, 26 Oct 2022 20:27:07 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:06 -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 v2 08/11] Makefile + cmake: use environment, not GIT-BUILD-DIR Date: Thu, 27 Oct 2022 05:26:49 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 4659d89275c..85f03c6aed1 100644 --- a/Makefile +++ b/Makefile @@ -3042,7 +3042,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 e9f979c4e5c..0bd4a36b2bf 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 Thu Oct 27 03:26:50 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: 13021545 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 D9197FA3741 for ; Thu, 27 Oct 2022 03:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234093AbiJ0D2H (ORCPT ); Wed, 26 Oct 2022 23:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234014AbiJ0D1c (ORCPT ); Wed, 26 Oct 2022 23:27:32 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 180D5FBCD0 for ; Wed, 26 Oct 2022 20:27:10 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id bs21so83829wrb.4 for ; Wed, 26 Oct 2022 20:27:10 -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=D2iR4yz3ZdzMd5FYaqFH3QIi+apMWjRG1HiZsMwgQ68=; b=b+3GkP7eEbrBK+OuFuh+FfcqUybO98+2NVm0u1Ci1xNrDsjgdLKMJTjVdqh8acVIPn 779kajH3RcFEoapL7WrFi9Qug7yDx7rJqyqtLeCsli/Sh1Uu5GZHrmdsvnIvVgAPtnpA NP9bMuQ4HKqkqyp+En2AHUcjfJJSMC2JYliaBI9vd8pjW/ucejuT/3bPZz46xI8FoKD0 gNOFpHDUTR17FN4Cz20KZa6W11znoZN9fxxcEFxPSne6kLSTHLm6kBQSThn7QCDK+/iL 4nlTtxV43bWnqSS51qN2ondq/tNgykvTt5qkAEqyVXoV8g1tlSEH/TD8qeuDlxD47s8q CjfQ== 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=D2iR4yz3ZdzMd5FYaqFH3QIi+apMWjRG1HiZsMwgQ68=; b=62EGgilbr85P4v9dSaA0GWhiZvOYQMwfr0w8I6yQNN4jCXwUlrctb0sYsiDo528hFr 3WoFTNEZ8rZln6YqoBEasfrLGiujGmSG3RSJyWfUmdY3LPkJQfXS8mbg1dZRlJdBq4mY mlS/V7XIwWHBnv39WZ8nlFhkY+SwT/ktShRP52639XiY3IwaqEDFsgNcZHSOqcOeMnK+ O+EHXH1LQanEEsaRpYVyPsXpCFl+SUYlJeX9ozkGI9E4y/Ni9gzr+1xOoad5MkV29xgX N0GrW4IRzuT7d8UcJFG2H27LtXm0WG7de/Yz7FFkAHo6piIVjmuWX3brrDiDxbK6WNNO /jSQ== X-Gm-Message-State: ACrzQf0zOSbzBiS6e5bNy2adiPOV8w+vnWK1kcq0me4K5q0vlRHk8zXp K26UraEQGyWDoFc4WT5gYkSUwd6sOXZd8A== X-Google-Smtp-Source: AMsMyM4Alise7s4e4HkQI7ubLBCWlk4peN1Z0l3mSDwGnYWGZWgJO2/9fTsYfm/js8TFRqRkdEhBKQ== X-Received: by 2002:a5d:4910:0:b0:235:ab9b:33a2 with SMTP id x16-20020a5d4910000000b00235ab9b33a2mr24897260wrq.58.1666841228540; Wed, 26 Oct 2022 20:27:08 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:07 -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 v2 09/11] cmake: support GIT_TEST_OPTS, abstract away WIN32 defaults Date: Thu, 27 Oct 2022 05:26:50 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 0bd4a36b2bf..35b12493cbc 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 Thu Oct 27 03:26:51 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: 13021546 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 83F2CC38A2D for ; Thu, 27 Oct 2022 03:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233725AbiJ0D2N (ORCPT ); Wed, 26 Oct 2022 23:28:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233540AbiJ0D1i (ORCPT ); Wed, 26 Oct 2022 23:27:38 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 181FBFC1D6 for ; Wed, 26 Oct 2022 20:27:10 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id j15so89039wrq.3 for ; Wed, 26 Oct 2022 20:27:10 -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=NzA6JOxmbDWzmJV1+api+NdDHjBKmJKLw2WsxpcTinQ=; b=bt40hdI8VhBvJFbjNcnRPzoUODgxPZmuG01++dvO9cLnWPNWF9qPUCUL6TEQPEmJky v3Wy2rvnHX4QCAB7RegkNt9NwOj2ys1ZR6y77v2m4RbGk8t4Z0hCE0VQ9adP2sSOAw0L 0LerL3GxnLRpsAhCU8GiZFLeJSm8xJ3Cu8rCbS+Ijri3ByTe87GPdIhjYZ70B8R3trec F+BEdxfJIWZBAqzksKtnSpQ2zY9JTdac3BpjFG4ESpORgRtMh78Q5HweMY5UIlsbBRRx z5mt2EccJ+EA5j6Sn+aL74xUAgf+rQNOolZa5zuVrp+UQuJoweEetHm9Nn2HlGEMiiuc HhhA== 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=NzA6JOxmbDWzmJV1+api+NdDHjBKmJKLw2WsxpcTinQ=; b=uHux3YRQcmBX16BLcyu9jLcSIl8l9F+fsDhyhCtfcZSaLU0Bb+yjy4l/XQFVyW6vLS Xv2EQaQx0RIYT/cggHeTn7DWljOVibpqF8PzaWXGOuAPHKJfoC2LCU0EU6UXSkLNL84v KRFZHYAT6Sa3pMNnyBDW8Qi0ehNSYhb1zN7TJTooDJgYnjzhs5vqwSemD9lOwQkcdgRF FycpvuKuD2evqL3wfMHi02LJcDaLSDAWFjOsgFZN1X9Wy/3hrMslJ6zqgqRD4oaX1ER6 pnu+HHgT9Lw+F6rwLmTZ8iEhE0FP3SQGOr/m3WC6GCNHfgrki+ZC0lcCd8RJlw4apFzo KI6Q== X-Gm-Message-State: ACrzQf0MN/HjveeZxgbRlNHTn8m+bVfnHrBYpS5LMvQTkCRFMAhr+DxS svgZ3Ymjd129oCpl/3mW5JY3MnquEML7lg== X-Google-Smtp-Source: AMsMyM7Pvy0BUn6B25nCvmvNUdRcwNv71lX+mnNzgino0skI3Pxle9EllWk+qMogakf56QUCefWV8w== X-Received: by 2002:a5d:5a96:0:b0:232:2e1:48f7 with SMTP id bp22-20020a5d5a96000000b0023202e148f7mr31364855wrb.694.1666841229573; Wed, 26 Oct 2022 20:27:09 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:08 -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 v2 10/11] cmake: copy over git-p4.py for t983[56] perforce test Date: Thu, 27 Oct 2022 05:26:51 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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 35b12493cbc..6c5954aca25 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 Thu Oct 27 03:26:52 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: 13021547 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 E5102C433FE for ; Thu, 27 Oct 2022 03:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234395AbiJ0D24 (ORCPT ); Wed, 26 Oct 2022 23:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234288AbiJ0D1v (ORCPT ); Wed, 26 Oct 2022 23:27:51 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56BA14DF0B for ; Wed, 26 Oct 2022 20:27:12 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id v130-20020a1cac88000000b003bcde03bd44so3134684wme.5 for ; Wed, 26 Oct 2022 20:27:12 -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=X63LWQc5c1PVG18jZVFHMRPSEwMB3FxiDwMCYw/WQ9o=; b=KVcgQKF6Ga2ZOZv1Tgv4VngZiFwgfhh71wjVhpMtdtbT+1XQWf6jNZ9+H0OtLB2dNC UiI7bw8AE9kdpn5bl8HaiohkCnhQCr3aRzrgiBaNPrTNKirbkKHfz8JQmfLhKwxZ4cGK KNSvgKxMTlKib+vo6JmRrXOFu4YTNRkV4slPu3yp0+vBC7AHwfcBgdZ6qNEPRWrm0cZq yEk+DfjK11kZXI5siRkOvBD7mYZ0/8409KWI+cX7HxIkcoKEUA8VOH5pVN/mDMR17a+5 jhtezHx2geTW2iNjPShhou+6sM49mGh+JgRrYuWQkGUVDpmfOYs54GFbn5N2R8OyzoTv WhEQ== 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=X63LWQc5c1PVG18jZVFHMRPSEwMB3FxiDwMCYw/WQ9o=; b=MRnriGQisU2CxLjCvWMtBH9f1FE+ED6/THpilZKj7ySavaIBB8Acow88pt/cJ+3kwP aQuGiKrFJRlopUCkubs4hAnHvLdZfPDtiiAzsBUagZrP+aQuMS4P0+UBZGI0Qq9WiQsg 8PN2SiNzJNcnMyBYqxv+ktaXdIhEs6cSVFO4yneRN5fxUmPaza/DZru9TfKRWKT2CSGv 1Vdo3xIy9ulTDJadQjgbe8ALCpfokqpSB+o097yynWbMSvAfIJLQ5XGTuP2Onr8h2nuO nKlqa1YOnuvlPFdFa/6OXzZbJIxg3nipxzSAl+QcB/76cNPGh/kwQ67Nxyr0VaB+Egqf WPBg== X-Gm-Message-State: ACrzQf0hnUp10muTmMY0xMfMfD3Hz6w4EQA/p7i21GEuv3X7aTHkpJMA ArhXfQXQAku51b3CAWm59TxGsH0x/bvHPQ== X-Google-Smtp-Source: AMsMyM4Qfs9cPyx1iCwVtvMZjPFRwlewzZWs+ByCBG66iVfxvIwQUuwSEOHmHkk9nNOY7YgcxVFBwA== X-Received: by 2002:a05:600c:3542:b0:3c6:e509:b051 with SMTP id i2-20020a05600c354200b003c6e509b051mr4130439wmq.142.1666841230891; Wed, 26 Oct 2022 20:27:10 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id hn2-20020a05600ca38200b003c6d0f8c377sm236828wmb.7.2022.10.26.20.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:27:09 -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 v2 11/11] CI: add a "linux-cmake-test" to run cmake & ctest on linux Date: Thu, 27 Oct 2022 05:26:52 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.1250.ge066ede4da3 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