From patchwork Fri Dec 2 11:28:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 13062644 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 6AAF9C4321E for ; Fri, 2 Dec 2022 11:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233303AbiLBL2s (ORCPT ); Fri, 2 Dec 2022 06:28:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233247AbiLBL2p (ORCPT ); Fri, 2 Dec 2022 06:28:45 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61CACAA8F1 for ; Fri, 2 Dec 2022 03:28:42 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id n20so10953866ejh.0 for ; Fri, 02 Dec 2022 03:28:42 -0800 (PST) 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=+nor9ScFNpoOWp/qQCcSBYil7PEqQXebXeXj59WjtWc=; b=dzBxZH3us4pBhdO1o+kcR1/nb2tjs6rw96ywrtRS4U4HnlQ7atcEAz1VPAHOX6aRmW MrledyYa/CgLa27A5DNh+6vIUD6AuKScX8lr9pfdkD8Tl26vX7tV//oXZCdRKWRZUP6C EjJhPyM2MG906vNvpBOatS4aAn0en5Q0dslnUH+DL9HxFA1oSdD0VZelOptX6vhkDXlg 190iKlZ88GFvIKu0yDisJUls7GVXaymMgV/CUVLelonxAhZGsfLI6MdixMrtnTcv+qRn bryWmIXjB7MNzpIxy48xBlVDxx48PrKZrBwV1nMbBTuOiSOgsyMS9ZXyenkoc97M19hW 5Dyg== 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=+nor9ScFNpoOWp/qQCcSBYil7PEqQXebXeXj59WjtWc=; b=QURDXC+mQN7aSNVzurpy7jyJ6ZqlvtGE11XYW/1SqsaSHRcRaP/wpOHUQF+XZPk4rE p2uAC1xjGuF9xekXRkKlhFj2B2Al/AcfqzcY4w9RxfDPT+8p8S9te6eQ5JtlBnx86hTy 8pv0/9XnhZgvcIbY1hRNP5fpFgM5bOiye9XJ9kwmzVztKwtdJCTm164qSeZ/HHv8a3iZ YuYdqhwY5FEtmjdboF4M4ONj9z/XylCcL2TDWH0YG0c+Psw1LwGKOpffBx7gmo0stW9I pnr6JtS2FiDu4IyR578dYbrUQydacV65U4u4vB7oYtBT+mlpoqxdxWW+kl2y17DUdk1v ZUUQ== X-Gm-Message-State: ANoB5pnpJu1bIDUBWYdjrjF7EQwuzKjb736l/N83ZyUpoZ3Go31dhhpk nlOiha5X62UaVdQtC6rvJuyuaiI9l8CnHw== X-Google-Smtp-Source: AA0mqf57kk8nr43pvpzm1QWw5/hlL6KgdDDskkzR/xhjbjQFufV4YGegGEuGtbbsU/9juUwJQGTSqw== X-Received: by 2002:a17:907:a4c3:b0:7c0:7c22:d70d with SMTP id vq3-20020a170907a4c300b007c07c22d70dmr18831898ejc.707.1669980520633; Fri, 02 Dec 2022 03:28:40 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:40 -0800 (PST) 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 v5 01/15] cmake: don't invoke msgfmt with --statistics Date: Fri, 2 Dec 2022 12:28:22 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 2f12b31b746 (Makefile: don't invoke msgfmt with --statistics, 2021-12-17) I made the same change to our Makefile, let's follow-up and do the same here. For "cmake" this is particularly nice with "-G Ninja", as before we'd emit ~40 lines of overflowed progress bar output, but now it's only the one line of "ninja"'s progress bar. Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 2f6e0197ffa..8f8b6f375f7 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -897,7 +897,7 @@ if(MSGFMT_EXE) foreach(po ${po_files}) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/po/build/locale/${po}/LC_MESSAGES) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/po/build/locale/${po}/LC_MESSAGES/git.mo - COMMAND ${MSGFMT_EXE} --check --statistics -o ${CMAKE_BINARY_DIR}/po/build/locale/${po}/LC_MESSAGES/git.mo ${CMAKE_SOURCE_DIR}/po/${po}.po) + COMMAND ${MSGFMT_EXE} --check -o ${CMAKE_BINARY_DIR}/po/build/locale/${po}/LC_MESSAGES/git.mo ${CMAKE_SOURCE_DIR}/po/${po}.po) list(APPEND po_gen ${CMAKE_BINARY_DIR}/po/build/locale/${po}/LC_MESSAGES/git.mo) endforeach() add_custom_target(po-gen ALL DEPENDS ${po_gen}) From patchwork Fri Dec 2 11:28:23 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: 13062646 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 F2C7DC4321E for ; Fri, 2 Dec 2022 11:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232789AbiLBL2w (ORCPT ); Fri, 2 Dec 2022 06:28:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233276AbiLBL2q (ORCPT ); Fri, 2 Dec 2022 06:28:46 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF1DB0A21 for ; Fri, 2 Dec 2022 03:28:43 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id d14so1138692edj.11 for ; Fri, 02 Dec 2022 03:28:43 -0800 (PST) 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=la+mvrhNwgN0PwoiVVvWQ+1nEVZe4BTpmKXb9GL0EQs=; b=RUm7D/u5f+JfGDaRkbdsFnwFmmu9PC6jBDr6mVt7yDyVLebshLC8R+yRaUOo80Rp/Y 2mVGF/yXSak0Y08Yff7+qFcWLb0b/R5bEx4xRGJXEVCil08lblGF96mOaXG8An2/4QYl 04QqOOd8JqYwmxKjA5qu8BFxfCYRg6qA110NhweNSgpu+bjvO+JOX2j/ULRU1+HJzwvW zfP4qXFIsGqpyMR2hMnwwsaPqhYkstr/rKJiebsH7j3UahkscWOMumFsCWuew+g2K9iN 7T7VG5jQ8xLDKLD/ySYZWwOBji0Enx5E5wPuAVU+QzHU1ROTEDRziEwSN5iTkbnXZhL+ K5xw== 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=la+mvrhNwgN0PwoiVVvWQ+1nEVZe4BTpmKXb9GL0EQs=; b=ehDrbOqP4255dgddoXTGGajqNLg/78XA8O39c0SUCr+TzCx/u+cRBZoa4LmWoJ5Hua B/zNmZ/m+b0A8H98BQBu7MPF8UEV7VRr55vI27vQgQFdXkKcpQmunMDN3F8HIi+b0+wO GMOVtVVuZ/8mWlkoOk2n0TIW0ReczwuMYilb9cFGyZLBEBsdTha0SRYb0cqnKyytYyCt xnqFhGTphxyvaWnir0/+FAZW7F4CqztR0RU6msSNjDZuiipCXJzZIXBSFjT5/6gUBN2t R6Ah280YyaNQH6XMknBYGLNJjbamR6CuntUsnRPY1XCl4MGcFbCdNxkxLyDlZ+fW3Y/2 IguQ== X-Gm-Message-State: ANoB5pmRfj0VlT1uBAcHuyqjJRFHw0Hlt/xyCdtIdGN2t7Zne9bXotKb eDBlpqdd/z0b5kBpbPVZvjcLSG2wtrh5DQ== X-Google-Smtp-Source: AA0mqf42oCZsBc4HnOLMTUFccXk+NQ+h2+wWcaMuom7WUGKInEQ2Ie5b3GrgWKZ1YUbHejGleZ+K6Q== X-Received: by 2002:a05:6402:4147:b0:461:b2b1:9702 with SMTP id x7-20020a056402414700b00461b2b19702mr4125141eda.274.1669980521839; Fri, 02 Dec 2022 03:28:41 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:41 -0800 (PST) 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 v5 02/15] cmake: use "-S" and "-B" to specify source and build directories Date: Fri, 2 Dec 2022 12:28:23 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Rather than the multi-line "mkdir/cd/cmake" recipe provide an equivalent one-liner using the "-S" and "-B" options, and then suggest building with "make -C ". The rest of these instructions discuss e.g. running tests from our top-level "t/" directory, so it's more helpful to avoid changing the user's current directory. The "-S" and "-B" options were added in cmake v3.13.0, which is older than the version we have a hard dependency on[1]. As an aside The "-p" flag to "mkdir" in the pre-image wasn't needed, as "contrib/buildsystems" is tracked 1. 061c2240b1b (Introduce CMake support for configuring Git, 2020-06-12) 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 8f8b6f375f7..5b22a9b217f 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/out` 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 Fri Dec 2 11:28:24 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: 13062645 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 48D7FC47088 for ; Fri, 2 Dec 2022 11:28:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233321AbiLBL2t (ORCPT ); Fri, 2 Dec 2022 06:28:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbiLBL2q (ORCPT ); Fri, 2 Dec 2022 06:28:46 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8688C460B for ; Fri, 2 Dec 2022 03:28:44 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id bj12so10822020ejb.13 for ; Fri, 02 Dec 2022 03:28:44 -0800 (PST) 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=qqtn+7vSlnXoq6OOtiHulDwRYTaqRmC5mma9ZOEBYiM=; b=b+jWsRKBLKgnAbTw+vkmLeYKnIk/rs9lS3qksU0e0KvYS0tO/gtKZC+SqSXNQ2HxTw 2IGQHIXK278svRVREqjGBRMFgKX1KGcu5zPlwanNnePm2HiJJQwVuC9T5J+2TnQVgC+4 qDnfzYRf4ED/pfd54y7e1r3WN9zZK2DEsJJ4JnOjT3RqPq7OUmBXbK6SkM6VIVQ0cgcj dHQMh0hjUGVwfmKY/6ZFo5RW63GKQfiht3rXBgIuFJu5XLsstK9V66FqWrRlWRcRR3Wo 42Xp3tWFCPaadllk9xmFRVqUmVerYD3zS8sKkIx/ILU0GzdIS5DK3Cet6bbbyH7gji0g Shfw== 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=qqtn+7vSlnXoq6OOtiHulDwRYTaqRmC5mma9ZOEBYiM=; b=pNfEUPvebQw7m8NSjvmH4AEf/DVRInZjUGijuzc66H5g+PcmvybDZtz/QTdMKXp5VR IbLu/qeBCB7pWcX/D1a/sshEB1Bngmr3m0fPi/zfrKM/QWMxOzRSsEK7vQseY3bi2JR5 usFyVgMz7AOHC9SShnFpStVVuZqP6RW4vzVNyIYXRhQNOgoN2U7997U9djST8D66swcI juUl0UPIbbbsfMDbnRBa2mEssMaLqVnzD36GwMOUoaWjKY6tn89I6oLn0uIJdXgAk0Jw 94PpGJsG7aV1psIh9i8K87ATCwRapvkRa7v3KaVNz2HYqWDPDqvGZg5sjWqz7bwmnG01 pVCw== X-Gm-Message-State: ANoB5pkfxIAwqR40wIEwAR556vSwKu0asxz5WaHKyzCIS8ecUEReHJRn 8SSXMoxRQT0hgIm2PCLr3lHZLdhA9OQxjA== X-Google-Smtp-Source: AA0mqf566BVLvQ7IacSs6OQeVsf4mgUbFPDP3tfWr3iKx34VH0ShQUP/37hoz3EdWIMoNqiN8T/Y9Q== X-Received: by 2002:a17:906:4f0b:b0:78d:aaf9:7b8c with SMTP id t11-20020a1709064f0b00b0078daaf97b8cmr61117960eju.229.1669980523043; Fri, 02 Dec 2022 03:28:43 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:42 -0800 (PST) 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 v5 03/15] cmake: update instructions for portable CMakeLists.txt Date: Fri, 2 Dec 2022 12:28:24 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 | 68 +++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 5b22a9b217f..80290edd72a 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -4,7 +4,31 @@ #[[ -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. + +== Creating a build recipe == + +The "cmake" command creates a build file from this recipe: + + cmake -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release + +Running this will create files in the contrib/buildsystems/out +directory (our top-level .gitignore file knows to ignore contents of +this directory). + +See "cmake options" below for a discussion of +"-DCMAKE_BUILD_TYPE=Release" and other options to "cmake". + +== Building with Visual Visual Studio == + +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,13 +38,33 @@ 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: +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 -S contrib/buildsystems -B contrib/buildsystems/out -DCMAKE_BUILD_TYPE=Release +== Building on Windows without Visual Studio == -This will build the git binaries in contrib/buildsystems/out -directory (our top-level .gitignore file knows to ignore contents of -this directory). +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 + +== Building on *nix == + +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: + + ninja -C contrib/buildsystems/out + +== cmake options == + +=== -DCMAKE_BUILD_TYPE= === Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding compiler flags @@ -32,18 +76,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/out` 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 Fri Dec 2 11:28: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: 13062648 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 DC017C4167B for ; Fri, 2 Dec 2022 11:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233382AbiLBL3E (ORCPT ); Fri, 2 Dec 2022 06:29:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233304AbiLBL2s (ORCPT ); Fri, 2 Dec 2022 06:28:48 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0104E98551 for ; Fri, 2 Dec 2022 03:28:45 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id x2so6130581edd.2 for ; Fri, 02 Dec 2022 03:28:45 -0800 (PST) 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=g/ZIiMuOEHCvswo/Pz/Lnw5lrFWYz6AyLH1clr/FB7o=; b=iOkzXQSUaQU1pdjESachtHIkDPIJUDC4YQb0ttRrx2Zy1YRqawWxMd8iVCg04yChik 0wp6e0QmYMCQ8nJ+8YCRgSx2mgzmFnyakpQQ5FadiwAp7pu6BsWd1vF7uD3Zi549zi/g VMkNIcI3esdnnwpgQnz+OzCBdfPXIypsFPj6H7vdhxi+W5xzod9fMaaG7gG1RUyRkxEf uUQftulSkhALoAZpJed+tDRGvvLsr+PqUoe/gbzLWhycmWML08NXk76Y3o9EoyidNbwI WQ/jgaifs3WIo94F1tSC2b6BdjU1vNt7QhXOXCmw6ZCMl5Vxc53+9m4lQpE8I1NQLRXN 7XLw== 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=g/ZIiMuOEHCvswo/Pz/Lnw5lrFWYz6AyLH1clr/FB7o=; b=g5Nd+L1oD/tvmzThYdM4XGI0az7EN+ByEX7HukQ3GAWpRIEiG/tNuoQAC+sfFWh0C5 sTx+7mw3SlNRFdNGbuP2XOO9e9fZSZQwAozv03vzdY8XDEANcu5lSj8fB3gB3yT82JBg j+Y/Y8QTNNyA/3C99OJdl5nYrTx2jXmFo+M3tnq/ayLv8gXV6NnNrn8xMj2oUq/gccuV 1fmAv4T1SDC5Y4MPdJACUrc/sAOtvY4b266kXmbYpleziPl6EnumXNxMvkzVlpyGOI5H 3A35ywUU3r0BPFeepJ/ESU6m06njCh0i1WhXTrzd7jgTfaj01QqqJhMcbuw1NvthREOP AAGg== X-Gm-Message-State: ANoB5plqTki0JWe+ao7p9aSJDkQ6QshvzQNITfMNZtG2JWMwXoDDtiKC uMR6fL+wJF6wd4z0y4oBBvTprrhaExlz3Q== X-Google-Smtp-Source: AA0mqf4kJSeo40IL3/pFOlHlr7n6rNfbqSvH/IJ6ozIncIf4cRmsgcYdYIYElAyqOVdD4OnBqE+KfQ== X-Received: by 2002:a05:6402:5:b0:459:cdb:92ad with SMTP id d5-20020a056402000500b004590cdb92admr46942426edu.77.1669980524122; Fri, 02 Dec 2022 03:28:44 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:43 -0800 (PST) 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 v5 04/15] cmake: don't copy chainlint.pl to build directory Date: Fri, 2 Dec 2022 12:28:25 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 80290edd72a..c641e9349c9 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 Fri Dec 2 11:28: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: 13062649 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 E65A0C4321E for ; Fri, 2 Dec 2022 11:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232750AbiLBL3J (ORCPT ); Fri, 2 Dec 2022 06:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233308AbiLBL2t (ORCPT ); Fri, 2 Dec 2022 06:28:49 -0500 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 8B3F0B0DFE for ; Fri, 2 Dec 2022 03:28:47 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id td2so10870193ejc.5 for ; Fri, 02 Dec 2022 03:28:47 -0800 (PST) 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=eX0lw1Z8r4an8SNDEnxWdsU6pKhOB0yvbUtbL9Eol2g=; b=WFp0oCapaxmeOIUczwKMKVXQ4Y+1sMBhwgvOwSOebBKn/DAnTPMeZr3pPbzP5ChFWE DO0fsO1lKRjrouYX2yfyMBhb2Jv3bEDe/PxKMmlEE7PwulC3GvzKBLfe+vG3kHmLoo2S ypTR710GeAd3DzF3pnPa7/HYw3El5kJMPgN8L3NfyRvrxAUO1IerTk5AH79TdHQ7LAgg TSk6SXMuveYI4z6g5wRPUKj8MeMEDQykTprLpFPaH1oFlkDTaw39XFkAid3oPpXQeZYV ko+Fd2zKFBVb6FUwF1AacJC2CcP1nS+x1fXLAxcurekZYcFl1Xok/QFfwmuCSibwQ8Zu f94Q== 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=eX0lw1Z8r4an8SNDEnxWdsU6pKhOB0yvbUtbL9Eol2g=; b=mHKMYh6GTQHxgsKb4nyttTBkjYUiS1VBi7QMLaydGtjNIT6iJNL31xK+/4VgKbNh/d ysIodj2Qv1q1hi7qojC4ufnbcGBMaWuBWe8MjOLOoJK3ltmEKijZZrH9qOWMlbJICaED W0H+F9sygdyOJfPcBGD1R+xHsdvTR10uVonxp8ScdSTyBUm8hNTlnt+UGTpOgDQRWJZa 7bLwG5ysygrnAUSkx1AZuHN3Y488nd9tYzkfYG+/89zAGZjpAtg+nD1e3lafAUIpzGDZ f/YKLZAhcbgNPy7AIk46RIjHuX1Lyjzn2EkDnpLNKyaDKmFuNRMjv0xjdhIGfTuk2zh3 YcGg== X-Gm-Message-State: ANoB5pkoXkuB79ik7xtetTs1lTcC6dtloCMXDSouzEkTb6P6iJFFBJBs yGYd9B38y4cEilH7r118zWmjG5UlvbY83A== X-Google-Smtp-Source: AA0mqf58yki5VTlMsn9cmXvUaLkPk3rZqPEqqKCK5Rl/dqyg8nVawPzNUjpjZc1qdJki8Y3WoZnA6w== X-Received: by 2002:a17:906:6681:b0:7ae:732d:bc51 with SMTP id z1-20020a170906668100b007ae732dbc51mr47582730ejo.549.1669980525662; Fri, 02 Dec 2022 03:28:45 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:44 -0800 (PST) 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 v5 05/15] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4 Date: Fri, 2 Dec 2022 12:28:26 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 tests 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. Ideally we'd use the file(CHMOD ...) form everywhere, but that syntax was introduced in cmake 3.19[4], whereas we only require 3.14. Let's provide a fallback behind a version check, so that we'll eventually be able to delete the "else" part. Both forms result in the same file modes. 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. 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. https://cmake.org/cmake/help/latest/command/file.html#chmod Signed-off-by: Ævar Arnfjörð Bjarmason write script --- contrib/buildsystems/CMakeLists.txt | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index c641e9349c9..2248b755b3b 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -840,6 +840,19 @@ add_custom_command(OUTPUT ${git_links} ${git_http_links} DEPENDS git git-remote-http) add_custom_target(git-links ALL DEPENDS ${git_links} ${git_http_links}) +function(write_script path content) + file(WRITE ${path} ${content}) + + if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER_EQUAL "3.19") + file(CHMOD ${path} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + else() + execute_process(COMMAND chmod +x ${path} + RESULT_VARIABLE CHILD_ERROR) + if(CHILD_ERROR) + message(FATAL_ERROR "failed to chmod +x '${path}': '${CHILD_ERROR}'") + endif() + endif() +endfunction() #creating required scripts set(SHELL_PATH /bin/sh) @@ -865,7 +878,7 @@ foreach(script ${git_shell_scripts}) string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}") string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}") string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}") - file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) + write_script(${CMAKE_BINARY_DIR}/${script} "${content}") endforeach() #perl scripts @@ -880,13 +893,13 @@ foreach(script ${git_perl_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) 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}) + write_script(${CMAKE_BINARY_DIR}/${script} "${content}") 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}) +write_script(${CMAKE_BINARY_DIR}/git-p4 "${content}") #perl modules file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") @@ -1024,20 +1037,20 @@ foreach(script ${wrapper_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) 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}) + write_script(${CMAKE_BINARY_DIR}/bin-wrappers/${script} "${content}") endforeach() foreach(script ${wrapper_test_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) 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}) + write_script(${CMAKE_BINARY_DIR}/bin-wrappers/${script} "${content}") 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}) +write_script(${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver "${content}") #options for configuring test options option(PERL_TESTS "Perform tests that use perl" ON) From patchwork Fri Dec 2 11:28: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: 13062651 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 B8E71C4321E for ; Fri, 2 Dec 2022 11:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233318AbiLBL3N (ORCPT ); Fri, 2 Dec 2022 06:29:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233173AbiLBL27 (ORCPT ); Fri, 2 Dec 2022 06:28:59 -0500 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 01A76D3DF8 for ; Fri, 2 Dec 2022 03:28:48 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id r26so6051324edc.10 for ; Fri, 02 Dec 2022 03:28:48 -0800 (PST) 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=zS/eU6TtHqyJ/oDckphr0xZ89WMjaNfJ9wX/FBi1Hv8=; b=AQfSTN8xUeDF2/0EMfKPWxwzRgNQplRQX2CzfYKEfVQlTYs10ygWsr1KKzwph6DUWG uktWzORB4Lj86shgdNbaWSbEWw+3XC7lIQPPBkhktT5UrjUq2QEZKEwVI0OpBTmBMMFX we5xHvakuM/1Ns3bMCu/EgK8GWqPjWKqkG1tOLP45Q54stl0FCVNCrG5/zqjJLShiP6F izCoQW89RM8umwbL3byuGc/HRBJCBsBi814BkeYr0Ua/NBpjVPfda1AHUwAgHErT1boL aA1zyaLyEJ0VZXTeuV/Qi7AvCTqHb5rd2/BE2qEOVeY8H9WTSYt/iah5b/T78vVNMx0b AGgQ== 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=zS/eU6TtHqyJ/oDckphr0xZ89WMjaNfJ9wX/FBi1Hv8=; b=G4MAAMwjmVpV5eoI/L0wuD3tmcGruncdfVKdt1gn0Oyqt75wSLVbxPL6c6s0EGZwPX Gf+jwKYdzvfDrBi6AAjVPU09LLFTghZcRtPd5Ks+P1i1EBiSVMUdMpcyGjlyFmxzcPVC 8UTZsC4bySb6Z2T9irqN25CIv2RKsjirf6SUwszPrI2O/obQWsF8Nv//gcC6zbzPZKAL mrT8eOiY/6oSLUkvDep2DEqbod51iYOiLW3B+vlR6CC4m1GQWoHhcKVxnowJQz/Lmzmt BwRHloVcD9v0WndTRvIRw2yueXDLv1k8tUjjvqchMKYx0G1jsyIa+Fq+yWRW/fZwGp5m nsVg== X-Gm-Message-State: ANoB5pmoa5ZV8Kll4nO49DKoC8q6XMCGmv39BvSF3i4Vq4g2YjK05PNP oFVQ+LK6qruhLBtWzvk8+7UPSGDF8jR7aw== X-Google-Smtp-Source: AA0mqf4QfDR/C+ZGwWomeBA6BO8m4ERpKKGu7022THPuTwXH9JlIpFri1Lhxe+hRpN9zjdSv9OM6qg== X-Received: by 2002:aa7:c2d6:0:b0:46c:38a4:a54c with SMTP id m22-20020aa7c2d6000000b0046c38a4a54cmr1537763edp.393.1669980527043; Fri, 02 Dec 2022 03:28:47 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:46 -0800 (PST) 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 v5 06/15] cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable Date: Fri, 2 Dec 2022 12:28:27 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 2248b755b3b..73b060a0385 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1118,12 +1118,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 Fri Dec 2 11:28: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: 13062650 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 6704BC47088 for ; Fri, 2 Dec 2022 11:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233276AbiLBL3K (ORCPT ); Fri, 2 Dec 2022 06:29:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233320AbiLBL2t (ORCPT ); Fri, 2 Dec 2022 06:28:49 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 018E1D3DF5 for ; Fri, 2 Dec 2022 03:28:48 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id n20so10954536ejh.0 for ; Fri, 02 Dec 2022 03:28:48 -0800 (PST) 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=KM99oAo0Mtr8NLyiiEiHiNzbagr/2Yxzh5P55+RLrDE=; b=BGxBXfcaKSjwB90pVT0+8xtgZ7BCFnfc3PUsJ+USMBWwyvmvwYAzyVj5BRa6JFZCa8 O5g9cjmZScHbmRgF4l8AQqkcyGYvYGY3pXKaOtIBef+Ma9ttXo3EIVaAYJkbufup7iJr 6NTzcCZ0xnZlYrLzsDxOyLQzdvQ8OEp6uLtbCGh6Vn4aralimDG25yk5eUBU9BxOzh0O 7nXKKJrebR+3UFusqNjfqZ6qRioYL/c2ueEhSScgjHGN4qFh7CT9a/jOWee8LaC/shUg cqJ2C8ZYUJVkWgokIE75SQ8zCuscBMjtuY1brUPzY9LdVLk75m5H/kCGKoksFufWpCnJ V+MA== 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=KM99oAo0Mtr8NLyiiEiHiNzbagr/2Yxzh5P55+RLrDE=; b=nPcFPshMqVsco5lJE5BqQxQiAFVCNd6P132GWzVFgOc3Q4uD5e+2dkUJ4Iov0xDMkm VYAR0TZvOBQlCBnS2e2NuHU6tH4H7w/PfEEcgCXl6DcRnd8Ofdx5WC3gIVmmowXPDdZy KxBFfQdL1eFKJ8DfuKH88XJbjzqV+8IFvT5qa5OazgpMQIe9GbGpV2jL3pKXhUOSTO7s aDDRz/YJPwKW0Ql6QoUwldWFsqQn7Q+kJfg313buA2BfgjGXMkKVqbJ3qLlpO2GvzM66 WqsHgg4QM59K1ceaziFOuYd9nuSH4yISCxqGhK/pkHxUhPxwSY8Y8bn/Bz1FVpL74d4E FXJw== X-Gm-Message-State: ANoB5pmj0f7ce4FXqo0lL5tgWjihAwTf/CQSpaiS5JBrzm/a5YdBhuTZ ThMfL3jmjjfdR6K6eh3Y4mgdbA77BvU9Cg== X-Google-Smtp-Source: AA0mqf4auLRh9V7c8sfQFWIk8qc40ur0Wp6FhmQViaRTtkY+s7qRazq5SeGJIuDzbjvYB0mHEGDQxw== X-Received: by 2002:a17:906:aec1:b0:7c0:a04b:6795 with SMTP id me1-20020a170906aec100b007c0a04b6795mr10006652ejb.16.1669980528160; Fri, 02 Dec 2022 03:28:48 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:47 -0800 (PST) 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 v5 07/15] cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh Date: Fri, 2 Dec 2022 12:28:28 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 73b060a0385..5b3fb93120d 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1099,6 +1099,9 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n") +if(PCRE2_FOUND) + file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "USE_LIBPCRE2='YesPlease'\n") +endif() file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n") From patchwork Fri Dec 2 11:28: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: 13062652 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 B0E14C4321E for ; Fri, 2 Dec 2022 11:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbiLBL31 (ORCPT ); Fri, 2 Dec 2022 06:29:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233344AbiLBL3B (ORCPT ); Fri, 2 Dec 2022 06:29:01 -0500 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 42661D3A11 for ; Fri, 2 Dec 2022 03:28:51 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id a16so6052752edb.9 for ; Fri, 02 Dec 2022 03:28:51 -0800 (PST) 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=eRpMaTgX+0WS90R1rSOR0tedgz2fOezT5GMnc+2qBOQ=; b=p1uJSrWAk+L6SwW+07ybkEYLLKXrjYxGYKtX9g6fzkF9mpbp8kYljzZzolf3W6gA1D aZlNJMnU+mHKwrHomEsuRHhKCeGUGvC6r831TyQhP+joWeoTyQtf7RpjkBbBzbBsHzYI Sy53VP507cD+uE1nd3G/FPGA3N89bbf5//wPbAJx2pEai1Ch54xR7PNSWBGQdIBHviWl 4I18ZJayM5v8Ta05pSEfpr7kMdDJy3zBdyYYjczJ+FAfzoL8C+AC9kxtWAMAkpxdmK8k bHIo16UKIBn2/xyrAdeOC4E9vx78ZFlltXvk7afjc92UghsRHZ6DW3oeoDxJRuta0noC /LHg== 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=eRpMaTgX+0WS90R1rSOR0tedgz2fOezT5GMnc+2qBOQ=; b=0dKoNrqE/TIUeV6XpHvzCG5R6tkMhv7DSBkPV0r/6UZyTIkFYyr8daCM2pIpNJPsbo YT7VT/i+16r/M8TqOtZ1Xb2Lj0dOXXUPv4LUQbqe4xtvDMNlNigj4Pac9neHK+mWmoQ5 cYbnkxl7gDa1blF6p7577WfmTYZDhOMH0ZlmPHv3Cu/A3+FswBkIcQKJNQFAkGv6DEyV NVMMQmaWiPmoSq0Rsq2z6/5KQERbIyz6SUzFhghmq6d6Zm1GhbujlTMTSB/DqgEcBwPj n9RRMkIoT3MrINY1zFJRZFLsMPip9HQjSvkVyiuqEK+Xpp1r8YCgGHmdIY+g6b6kizex vUFg== X-Gm-Message-State: ANoB5pn+n0WLy0oJteY5b75npQdSfp598iQtvSm98neaEZprNl5nTPWI 8pVEdmjD9gGRhtP9EK7ikhMoD2MoUzjq+Q== X-Google-Smtp-Source: AA0mqf4bZCYRSbXjVXpWgXadd4JUQ4bj06lBQeiFZ4sBVKwnIH51O7eLEN3EroGMP4vhAXafOa5x7w== X-Received: by 2002:aa7:c754:0:b0:46b:6096:a884 with SMTP id c20-20020aa7c754000000b0046b6096a884mr17436311eds.152.1669980529228; Fri, 02 Dec 2022 03:28:49 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:48 -0800 (PST) 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 v5 08/15] Makefile + test-lib.sh: don't prefer cmake-built to make-built git Date: Fri, 2 Dec 2022 12:28:29 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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, and only if it doesn't look for the one built by cmake. This ensures that we'll pick it up as required when the user is using CMake, without being subject to the odd interaction of flip-flopping between the two environments. It also means that we can remove the rule to remove the "GIT-BUILD-DIR", if we get to creating "GIT-BUILD-OPTIONS" in the top-level git. That's because now when building with both "make" and "cmake" we will always prefer the former for running the tests, so there's no need to remove the "GIT-BUILD-DIR" file to resolve the conflicts between the two. In practice users are building with either "make" or "cmake", and not mixing the two, but in a subsequent change we'll provide an out for that "make"-preferring selection behavior, by having "ctest" runs always prefer the "cmake" built one. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 1 - t/test-lib.sh | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b258fdbed86..c602ce57e64 100644 --- a/Makefile +++ b/Makefile @@ -3150,7 +3150,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/t/test-lib.sh b/t/test-lib.sh index 36358811a0f..c7d55ff0796 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -51,7 +51,8 @@ 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 ! -x "$GIT_BUILD_DIR/git" && + 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 Fri Dec 2 11:28: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: 13062653 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 75C24C4321E for ; Fri, 2 Dec 2022 11:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233428AbiLBL3b (ORCPT ); Fri, 2 Dec 2022 06:29:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233285AbiLBL3B (ORCPT ); Fri, 2 Dec 2022 06:29:01 -0500 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 450B7D3DFF for ; Fri, 2 Dec 2022 03:28:52 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id vp12so10860088ejc.8 for ; Fri, 02 Dec 2022 03:28:52 -0800 (PST) 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=J6ZoeMtA9Vr+KsujbPW/xOSGEcbTwCzza+dgVf4X0Os=; b=BnG5ZCtn/HcUy7JPIsh6TxCAkc3h/fxMVh8/UYDBhN/EzDFd2zIQ/XxUloDGgoCqs9 jdur5unsg56VDz2eYb80CKLdmqUuBOE4hHYe65/kfILvT7cb2cZlVXqjCO6QP8jPvjhP 0BhsIM4Ha+mSYLphp1HsHVCDWVgZwXQmapnVR1eBtjPtQXPU2qXDpFS5u6UDCIeDUcOO JdImdRza+RQkbWSfk5kGnI0e1bgUEHcIygdHXgyxHNvBJ32n8CkbO9Ee3Bwr+Cnx+/J7 YLDPURwQi7/9MVdmCF2w0flonV9jlliQa2a5amzKd79XLzbm7PF0F7O6cgWK3KBYlBDI l7Pg== 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=J6ZoeMtA9Vr+KsujbPW/xOSGEcbTwCzza+dgVf4X0Os=; b=tuvix2kyMh6HaEF0fs4zUrTj+Z3YaB23GoBfor4oF8ZodpCZJyYh1du8jyUbhOMG0G t6MfFHP3oS3mWzuE1eP42jFNUxt6sPQVNHNGOTFwuynDrLdyKnqsdUfgwCDrpXAtZSJb p60l58U3z6h65f/ypmC/CftBRITZ8UihWP1TtOwfSPlqAsYsGXZFBZP4pErDolNfjoki +zByUvY7j0BcPEpTi4dRQVXhB+gKl8PpUL9EUDZcRyaQOydBjCjkg0WC0qXRZk2G9/2u bdVm4V/q6KvqwWor+bXJoqTHY+6LiM3VO43Qb9CNog8UhVj1nNcfI6TjnVJUWpUV6Ywp bTjg== X-Gm-Message-State: ANoB5pm+PKnW1VxsYcFMmYioNL4hduSHdfdViYEK6xF0NwUaITe9OKE2 PR0AerbaT425Xlmq8P8sT/q32ODioNj1VQ== X-Google-Smtp-Source: AA0mqf4zVlvojiRb7Q9O6VYDmXKR8XstDArJ9QDwtflS1W+wvh5sojSG5PFIgOJFwEqmKQAoqDrcsg== X-Received: by 2002:a17:906:f189:b0:7ae:3fa3:d7c6 with SMTP id gs9-20020a170906f18900b007ae3fa3d7c6mr56971721ejb.494.1669980530337; Fri, 02 Dec 2022 03:28:50 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:49 -0800 (PST) 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 v5 09/15] test-lib.sh: support a "GIT_TEST_BUILD_DIR" Date: Fri, 2 Dec 2022 12:28:30 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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. In a subsequent commit we'll make CMake and CTest optionally prefer this method. 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 | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/t/README b/t/README index 979b2d4833d..fc0daef2e41 100644 --- a/t/README +++ b/t/README @@ -231,6 +231,9 @@ override the location of the dashed-form subcommands (what GIT_EXEC_PATH would be used for during normal operation). GIT_TEST_EXEC_PATH defaults to `$GIT_TEST_INSTALLED/git --exec-path`. +Similar to GIT_TEST_INSTALLED, GIT_TEST_BUILD_DIR can be pointed to +another git.git checkout's build directory, to test its built binaries +against the tests in this checkout. Skipping Tests -------------- diff --git a/t/test-lib.sh b/t/test-lib.sh index c7d55ff0796..a1b5c7c6ce1 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -55,6 +55,13 @@ if test ! -x "$GIT_BUILD_DIR/git" && test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" then GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 +elif test -n "$GIT_TEST_BUILD_DIR" +then + GIT_BUILD_DIR="$GIT_TEST_BUILD_DIR" +fi + +if test "$GIT_SOURCE_DIR" != "$GIT_BUILD_DIR" +then # On Windows, we must convert Windows paths lest they contain a colon case "$(uname -s)" in *MINGW*) From patchwork Fri Dec 2 11:28: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: 13062654 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 15451C4167B for ; Fri, 2 Dec 2022 11:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233381AbiLBL3q (ORCPT ); Fri, 2 Dec 2022 06:29:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233376AbiLBL3D (ORCPT ); Fri, 2 Dec 2022 06:29:03 -0500 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 9939DD427D for ; Fri, 2 Dec 2022 03:28:53 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id b2so10862024eja.7 for ; Fri, 02 Dec 2022 03:28:53 -0800 (PST) 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=klqt4pFTvtsab84HkdF3r4z1w00T//BupVriqNyqGb4=; b=hDRUAdDEfTQwxX1nHGc1AawvlqwzsuiHiNuc6+97TCDEQJh01CdMR1pwl920DfzoYG T9IFowOy+TyVIeHhDFJljMSHA3WaKri6aerb9hxfl2u1TnAzYv180G5Bgbyl+fKCtuKD 2fw74NenyjVb0z2m0Sjur4Qq8dpI64hm4X4J7Icyf5Zwn4SHJeiTziXy0ddlICUAEOBQ tVbbcAN7YnEbWYHPXy8S+j+QQr3MeChtRJ4Ho5QIp2y/v5XnQ8DC762KiA3L4689dgpn SylIQ1Ia2zU2cXtSI9cfF75xc3DT/5y/nBd/oq8Tr3Mb4YC4s64W+UWxpwsLdtLA3fb7 msKg== 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=klqt4pFTvtsab84HkdF3r4z1w00T//BupVriqNyqGb4=; b=pnkf6wgYHIZ6vg4EXz8agz2YGq5LjR8QubnwOWMrGvYzdoEq3dBzuqvCUeUrYlGfWM /OgKydCHWQZuegBzzdx31ffEVUIr/wKDERIbrg3FL/iwVk8eidqrI9SFdLT2pm3TKP3p 9yIm1nTOBs600N0zKtGm9Go7fXE8VfFrblDLEYKKxBQ+16NXDaVcgUTWR3BP/Xs9rTMT kJVxTQTElF7MD2jWOoY/loZ4PM3ztx6yFAmxaw49nmqXIg8nqr+gPIknzn8TWO2bk6jL MCY+CaH09/LAhBMJuK6swqAWV8aVAhQDADBbuVnn4Mqo7p/vRnM0rv0InTHtgiD0eyfa ppOA== X-Gm-Message-State: ANoB5pn7FLUVHzNZ9vEQ08gyblHF4m1DotGwaEMW/fchsehFz38hU4MG D/JERJbQ/AB/huAxfoSs34lZJljJ4xUaMw== X-Google-Smtp-Source: AA0mqf7U5/7uSbRkxxHpEqAVMrqENTQnbHZpvGigzsN8IT+uW9KYH23+bh41tKnzaT/PQ7m4zxYFbA== X-Received: by 2002:a17:906:d295:b0:7c0:aff1:f1b6 with SMTP id ay21-20020a170906d29500b007c0aff1f1b6mr5942069ejb.418.1669980531634; Fri, 02 Dec 2022 03:28:51 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:50 -0800 (PST) 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 v5 10/15] cmake: optionally be able to run tests before "ctest" Date: Fri, 2 Dec 2022 12:28:31 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since [1] the "cmake" build has had support for running the tests manually from the "t/" directory once we've built with "cmake", but only after a one-off run of "ctest". I.e. we create the build recipe via "cmake" and build with e.g. "make", but after doing so would get: $ (cd t && ./t0071-sort.sh) error: GIT-BUILD-OPTIONS missing (has Git been built?). The recently added amendment to this of using a "GIT-BUILD-DIR"[2] didn't change these semantics. After we did a one-off run of "ctest" we'd be able to run the tests without "ctest": $ ctest --test-dir contrib/buildsystems/out -R t0071 [...] 100% tests passed, 0 tests failed out of 1 [...] $ (cd t && ./t0071-sort.sh) ok 1 - DEFINE_LIST_SORT_DEBUG # passed all 1 test(s) 1..1 This change optionally closes that gap, and allows for more sensible behavior. Due to concerns about existing MS Visual Studio users relying on some of these edge cases this is being made optional, with the default of the new "GIT_CTEST_SETS_BUILD_DIR" being "ON" on Windows (i.e. the old behavior), and "OFF" elsewhere. The resulting behavior differences are the following: |---+----+-----| | | ON | OFF | |---+----+-----| | A | N | Y | | B | N | Y | | C | Y | Y | | D | Y | N | | E | N | Y | |---+----+-----| A. Can manually run tests before ctest? B. Manually run tests point to latest cmake build?... C. Manually run tests point to latest "ctest"'d build? D. "git" picked at ctest start time? E. "git" picked at test start time? On "D" and "E": Because GIT_CTEST_SETS_BUILD_DIR=ON relies on the global "GIT-BUILD-DIR" when using "ctest" it cannot be used to run concurrent tests for two different builds from the same source directory. But as noted in [3] existing users using Visual Studio may be relying on some of these edge cases, so let's make this optional on Windows, but switch the default to this new discover method on other platforms. 1. 7f5397a07c6 (cmake: support for testing git when building out of the source tree, 2020-06-26) 2. ee9e66e4e76 (cmake: avoid editing t/test-lib.sh, 2022-10-18) 3. https://lore.kernel.org/git/663b93ef-0c89-a5f6-1069-b4be97915d20@dunelm.org.uk/ Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 38 ++++++++++++++++++++++++----- t/test-lib.sh | 3 ++- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 5b3fb93120d..866bdc1914a 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1115,12 +1115,33 @@ 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}\")") +set(GIT_CTEST_SETS_BUILD_DIR_DOC "find cmake build dir via ctest-set GIT-BUILD-DIR?") +if(DEFINED ENV{GIT_CTEST_SETS_BUILD_DIR}) + set(GIT_CTEST_SETS_BUILD_DIR "$ENV{GIT_CTEST_SETS_BUILD_DIR}" + CACHE BOOL GIT_CTEST_SETS_BUILD_DIR_DOC) +elseif(WIN32) + set(GIT_CTEST_SETS_BUILD_DIR "ON" CACHE BOOL GIT_CTEST_SETS_BUILD_DIR_DOC) +else() + set(GIT_CTEST_SETS_BUILD_DIR "OFF" CACHE BOOL GIT_CTEST_SETS_BUILD_DIR_DOC) +endif() +if(GIT_CTEST_SETS_BUILD_DIR) + message(STATUS "Enabling manual runs of t/* tests once ctest writes CMAKE-BUILD-DIR") +else() + message(STATUS "Enabling manual runs of t/* tests via cmake build dir discovery") +endif() + +# When using GIT_CTEST_SETS_BUILD_DIR, running the tests from the "t/" +# directory will only work once "ctest" has been run, as we write to +# "GIT-BUILD-DIR" from the optional "ctest" invocation following the +# "cmake" +if(GIT_CTEST_SETS_BUILD_DIR) + get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE) + 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}\")") + endif() +else() + file(WRITE "${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR" "${CMAKE_BINARY_DIR}") endif() file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") @@ -1130,6 +1151,11 @@ 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) +if(NOT GIT_CTEST_SETS_BUILD_DIR) + set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT + GIT_TEST_PREFER_BUILD_DIR_ENV="Yes, ignore GIT-BUILD-DIR" + GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR}) +endif() 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 a1b5c7c6ce1..36a9a32db05 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -51,7 +51,8 @@ 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 ! -x "$GIT_BUILD_DIR/git" && +if test -z "$GIT_TEST_PREFER_BUILD_DIR_ENV" && + test ! -x "$GIT_BUILD_DIR/git" && test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" then GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 From patchwork Fri Dec 2 11:28: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: 13062655 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 5A1A1C47089 for ; Fri, 2 Dec 2022 11:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233389AbiLBL3s (ORCPT ); Fri, 2 Dec 2022 06:29:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233247AbiLBL3D (ORCPT ); Fri, 2 Dec 2022 06:29:03 -0500 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 BAA02D49D9 for ; Fri, 2 Dec 2022 03:28:54 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id v8so6118042edi.3 for ; Fri, 02 Dec 2022 03:28:54 -0800 (PST) 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=HMBGrNRj7kW8I0j42xhQIkKTkV6ZJGn+jqdPmyqD/n4=; b=XkBx2REPBNEYvtY6sWDU2MgcNhrTmTJGwghVSLutfIWi9rbfohjUJ7CmxLfLa4Kl3K eYe5xJArC3ETrrpBviemEQrpfK1JMC/K1Jl329rbQfx/GQUYoxISGjJHoLU/gEX6LV/E gdlWsjqws8gmQfBTBLw9lBnou5tVgnT9MFsyJpd5VQpvwvjD4bJ6PY/jCOzptDGvEC2A 9Dw3wlL1DFWCvsc+yDPRE6JYM3DmHb2vq4qCLus5exWTsLQjbboX6ZiBl6T+347UtNFJ utpg9bPwdoBlQu4cP1sr3XPB4EDMEm1mGajl+5AmjHc/PUH336wGt7vlO2+HBwr2qH1V lnPQ== 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=HMBGrNRj7kW8I0j42xhQIkKTkV6ZJGn+jqdPmyqD/n4=; b=PPniuokWq/K7+kP0eyUmnBnmCWwpDyes5MpLBN4WsmWdoz43pc67ZWKakV90TsuRH3 uYl+c1dnH43eBgRZpYzWQ0HsBjhRnjDNdJS4c5NfMmQeCF3VzQDjFUiuPG+Wjj45gkIt RaEQgjgUhK7g8yr1qCmKkzcdluAyXYExx7WUTMhLLMvymvIQbVuoTRRcZz3zYhBhWXkT sb+y2aOHNq0n1zk1LadObE49hSWshE+mQIC/DsRkIgrSrwWs9V6Mkmk7cwogMF2T+8E9 xfl8vzMUMW5HeIDENc9wL4eDh58I0i6qxrmv8v4Hd844rw7TCNHhUe+iYW3xwL0/I5nG g9mg== X-Gm-Message-State: ANoB5pkOjkhcb8FKcx098dFR61f84vt1wK5+MuC3Vt8VeCQLfjOkv3nM +SH0z3bTvYBHSKtivJf+X/SLcdbrR56kRA== X-Google-Smtp-Source: AA0mqf6ZuCM7KMVLuNAobZNzyJ/zV10ud1dTnCcnOda5Obbby3LbnbteTuL3bgft7xFVTWN5YzY+Kg== X-Received: by 2002:a50:f61d:0:b0:46b:d84f:81d5 with SMTP id c29-20020a50f61d000000b0046bd84f81d5mr8260551edn.427.1669980532909; Fri, 02 Dec 2022 03:28:52 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:52 -0800 (PST) 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 v5 11/15] cmake: support GIT_TEST_OPTS, abstract away WIN32 defaults Date: Fri, 2 Dec 2022 12:28:32 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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(... CACHE ) 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 The "separate_arguments()" here will do the right thing for arguments that don't contain whitespace, so e.g. the path to --root="" can't have a space in it. There's supposedly a way to work around that with separate_arguments(), but it requires features newer than our required cmake version, so let's live with that edge case for now. 1. https://cmake.org/cmake/help/latest/command/set.html#set-cache-entry Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 50 +++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 866bdc1914a..cfe8126d939 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -32,7 +32,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, @@ -76,6 +76,37 @@ 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.: + + # "--test-dir" is new in cmake v3.20, so "(cd + # contrib/buildsystems/out && ctest ...)" on older versions. + 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=/dev/shm/$(id -u)/ctest" cmake -S contrib/buildsystems -B contrib/buildsystems/out + [...] + -- Using user-selected test options: --root=/dev/shm//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) @@ -1146,10 +1177,25 @@ endif() file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") +if(DEFINED ENV{GIT_TEST_OPTS}) + set(GIT_TEST_OPTS "$ENV{GIT_TEST_OPTS}" + CACHE STRING "test options, see t/README") + message(STATUS "Using user-selected test options: ${GIT_TEST_OPTS}") +elseif(WIN32) + set(GIT_TEST_OPTS "--no-bin-wrappers --no-chain-lint -vx" + CACHE STRING "test options, see t/README") + message(STATUS "Using Windowns-specific default test options: ${GIT_TEST_OPTS}") +else() + set(GIT_TEST_OPTS "" + CACHE STRING "test options, see t/README") + 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) if(NOT GIT_CTEST_SETS_BUILD_DIR) set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT From patchwork Fri Dec 2 11:28: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: 13062656 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 E0567C4321E for ; Fri, 2 Dec 2022 11:29:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233278AbiLBL3t (ORCPT ); Fri, 2 Dec 2022 06:29:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233320AbiLBL3Y (ORCPT ); Fri, 2 Dec 2022 06:29:24 -0500 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 0C4FDD49E7 for ; Fri, 2 Dec 2022 03:28:55 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id o13so10901450ejm.1 for ; Fri, 02 Dec 2022 03:28:55 -0800 (PST) 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=x3AL3TONhIIaL9Tkhp/AMidqKGTuXHjzWM8iEgbe56Y=; b=M6WyqD0MP22obmEaC/vE7t969pJplrAwVQMcniL2COhTeVwk63B7cha8JsJcVCs10z T+/ma3xl0CTkH5is17Iz5HBxyEEIKk3TkIKWe5/8KrOFUIXZyQEKao94giBnO/3zdoYw +75h+on95uL/j85i7l7TlmSFY9Akco4htgaMYFa828L7WaXMYCtcLTaIV6aFfVtX4i30 S2STW/SdO/6VDGU+f0kc4oXqKRHbxAggCz9p4dUM/mYUqUxRQBlKHJcUEFr0+cx6EuPM kFMYnbm2mh8B6N4S7UodSg0U5ZDz7b3/LUW+piA3P229sQJKSH7jQZhgS/ZBZpDKsJw9 4CJA== 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=x3AL3TONhIIaL9Tkhp/AMidqKGTuXHjzWM8iEgbe56Y=; b=tZc/nr1cUViPVviq+uid/ez7ZbB5d4l6nTswokR+E4tCRGmsASLysL3qw/RyyZpLH5 sfUtui7Q0Huj1tlSHwn6dFJKmuCZOfU4A/JRbijAPlbSyen3oPM4PK7sMg5rrSZuk7hT TRIp610iReWMbnzO9GzFKKZNu8q+12bAfbqTDVk3CP59/ExNXleMbDsy/MRDpz0Haqbw cxD/A9T2GBatmoBcpznEryPYMRp+Mbz/UuIrjCOpyhdgE5Up/ZXvj8PB7kmbR1abpy0p xa9VKoj+J6rhgJUiWNqkpejmHg40xi2kK7KPqbL7x8coEQTC1OTVskAmGlW4bHwpu9H+ oZhg== X-Gm-Message-State: ANoB5plQhV3jyaBYv8Jdn0qI/pM4rD32XK/oF0KYSuT1t0VsA7djgnZN KsM1IEV6j2wvvGoQ0s1jXQA/e+DYEuZ1ZA== X-Google-Smtp-Source: AA0mqf45Lq8huAj+pWRW4TTP+td51CETRHAXiWjSex8aNrNKn/nMld33kccPfeMxwZ+oXk3JptyJEw== X-Received: by 2002:a17:906:99d6:b0:7c0:c91c:5d38 with SMTP id s22-20020a17090699d600b007c0c91c5d38mr1274317ejn.50.1669980533920; Fri, 02 Dec 2022 03:28:53 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:53 -0800 (PST) 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 v5 12/15] cmake: increase test timeout on Windows only Date: Fri, 2 Dec 2022 12:28:33 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 cfe8126d939..712caffe8f1 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1204,8 +1204,10 @@ if(NOT GIT_CTEST_SETS_BUILD_DIR) endif() 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 Fri Dec 2 11:28: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: 13062657 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 D4D64C4321E for ; Fri, 2 Dec 2022 11:29:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233394AbiLBL3y (ORCPT ); Fri, 2 Dec 2022 06:29:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233384AbiLBL3Y (ORCPT ); Fri, 2 Dec 2022 06:29:24 -0500 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 6B173D4ADF for ; Fri, 2 Dec 2022 03:28:57 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id z20so6029185edc.13 for ; Fri, 02 Dec 2022 03:28:57 -0800 (PST) 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=5SaaH49a18XvqwROcN7BX6dn5yt2Y9QtpQm6OfN6SV4=; b=jIT77XCr2LPXCCGfqZK5OJ+6bmnRZhconJ5ltCO+blAZkPcdWZHnkZApRY5NtE9Klt ommglG5FoLKXJroR2qoqqpUZd4zcFvmch9liqul/GEOpRX+c7yo+eA/jjFJ53Cxy++Ki R/P6X0PmqiJwPB3q6l426i7oFligAJsGm97yWFqCC06k7cBzzDy83an+J1Eh7pxRjZxa KnOer5jUCNHc0iJypg1jG6pQz5iyIXzA4AIy858oj6Roj4t1K5l2eXNwtqy0EcRJE0Jh Y3vEl2ilmb7A5wRgYUKWtV6mCoNQwW7RJKAiIWoZkLleVwMpg0LK4PCTvBo9FdSHIoXa 5Gmg== 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=5SaaH49a18XvqwROcN7BX6dn5yt2Y9QtpQm6OfN6SV4=; b=zrATZeiwNUimF1ji77CFNTejByuHS3GzPsM7ufEfnvDpnUUyjF84YbbpK63gqr1n1Y iDi5nnuf2E4xC/5HMPn8zPJ9QFu0xhSlmLZbD9JnaMPIvNuAUnjFQ9+7nQE30HZnFm2i my3i2JdxnuJUKoiZ2roWeMbsevEMHnJwHNbIfBTeCywGF26xKyf6+Y6EOFboL+1cayXl xKiM2G6hYYHk6tpgV1S7ts8X0vAA9Kn5/2CqG5AfNiLs0x9RmLHFZ0SjcGvMMJQYtW6h lCkrK9/a+53IBuQqo6OISpa6Y/zZxp2rBoe4E5aYNnjii233o5T9IRqh9/M1CNWy/XHk jypg== X-Gm-Message-State: ANoB5pl2SY02+CJvHe4ws2cC/9/4NnJKz2ji8+YT3MNLIocJYjzI5S1g q2v/Wcx/U9ZaXHVkYb3NV9CGDZG+wAWwtg== X-Google-Smtp-Source: AA0mqf5FfTbS5+Cn9CB2rV8Ijzgy4Jb7h7Nwvj3OOIydqRsNaCiHNEcQReWxkLMW9NEUiMbUclG87g== X-Received: by 2002:a05:6402:10c4:b0:467:7827:232 with SMTP id p4-20020a05640210c400b0046778270232mr65994111edu.268.1669980535487; Fri, 02 Dec 2022 03:28:55 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:54 -0800 (PST) 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 v5 13/15] cmake: only look for "sh" in "C:/Program Files" on Windows Date: Fri, 2 Dec 2022 12:28:34 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Guard the finding of "SH_EXE" in "C:\Program Files" with a check for whether we're on Windows. This Windows-specific code was first added in [1], and later expanded on [2], but since some of that was added this build recipe has been made portable outside of Windows. 1. 72b6eeb81b1 (cmake: do find Git for Windows' shell interpreter, 2020-09-28) 2. 476e54b1c60 (cmake: support local installations of git, 2022-07-27). Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/buildsystems/CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 712caffe8f1..da47d9c8397 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -138,10 +138,17 @@ if(USE_VCPKG) set(CMAKE_TOOLCHAIN_FILE ${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file") endif() -find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin" "$ENV{LOCALAPPDATA}/Programs/Git/bin") -if(NOT SH_EXE) - message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one." - "On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/") +if(WIN32) + find_program(SH_EXE sh PATHS "C:/Program Files/Git/bin" "$ENV{LOCALAPPDATA}/Programs/Git/bin") + if(NOT SH_EXE) + message(FATAL_ERROR "sh: shell interpreter was not found in your path, please install one." + "You can get it as part of 'Git for Windows' install at https://gitforwindows.org/") + endif() +else() + find_program(SH_EXE sh) + if(NOT SH_EXE) + message(FATAL_ERROR "cannot find 'sh' in '$PATH'") + endif() endif() #Create GIT-VERSION-FILE using GIT-VERSION-GEN From patchwork Fri Dec 2 11:28: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: 13062658 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 5C526C4321E for ; Fri, 2 Dec 2022 11:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233339AbiLBL34 (ORCPT ); Fri, 2 Dec 2022 06:29:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233336AbiLBL30 (ORCPT ); Fri, 2 Dec 2022 06:29:26 -0500 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 1B28AD4AF9 for ; Fri, 2 Dec 2022 03:28:58 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id ml11so10876856ejb.6 for ; Fri, 02 Dec 2022 03:28:58 -0800 (PST) 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=ScjFFWjE+a8ItBHXs676fLzK2xDPST38J5Ah1h+P+Og=; b=prQL3vCYjnn+fM0h0dZmI0H+YSk1Tifay6V5iParFZW+zDmF6lUkPlYHNCGw+0zVHA qmy17tQ4HcAn7il8iSdqohvs4iFwSCo4fO4HGgIQI2pKdMXwZVzeAHn2pk1mOtS6YWi7 d7nTjZiw/v9Gwp3sGN8Tq6qyDpjOuNtq6tkKIekYjZfeKiU+iF9spyOLbjeWcE/Wj9rR 70G5bg/sp0T4/9LpplWjGZfXjVEkdmX4+3KkVlcuXx/TRXAnt12QTynX6OZ/sDbB3OiL +BCFHSnhwXpOLJ9ko//rxTH/o2rLR702uGUyLQf8dmb76GXOzNABdmlW5MONdOA41nrV GedQ== 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=ScjFFWjE+a8ItBHXs676fLzK2xDPST38J5Ah1h+P+Og=; b=hGWFVpU8F7MNUCWDSMrZkNXQ1JaLyPZv/TrMmaLlSTXOyf0EjnMZ8b+3p0hwWWcqvb L6GnFdo+eeNiXR8zmYcfki4JYa+bErzsDZpLHnM/Lb15OKoO0i5EuQMvJejmiZdIFTkz Hg1/+w6oWMPFFZk/d22Gk5/1gNBUPPKFDZWnn2svtsL1mu48PLP3ud9OS800ojtCYgst MLJ3CNmwqv6QJp8O2Rnd+lYYsKq0Qc+U6AX+jIkNSaZICLVSL6KM2hNOfB5QjeB7UsSE AYj43iDYHe7HyBR+kN49LI+i/EA+YSoOvUwlaQeQFwS3ocYfpNYYouBOkR85KmP3sQzA jOKg== X-Gm-Message-State: ANoB5plaban1a1dKmt3wtY74uLeGXAfg3CWHtDjcSnnsyKd804I1ry0u DgO2IRLGNOe1S/cwZUcZ0dtac5ZMtKZplA== X-Google-Smtp-Source: AA0mqf7/UKjsA58qYCj9G+KkcmsXoeqIAGoU1oPTp+cn7+IVCHIFc3GQUUDE40lRdMmsK/vDb4GvxA== X-Received: by 2002:a17:907:124d:b0:7c0:9ecb:a4f1 with SMTP id wc13-20020a170907124d00b007c09ecba4f1mr9755728ejb.692.1669980536754; Fri, 02 Dec 2022 03:28:56 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:56 -0800 (PST) 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 v5 14/15] cmake: copy over git-p4.py for t983[56] perforce test Date: Fri, 2 Dec 2022 12:28:35 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 da47d9c8397..d989e534377 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -938,6 +938,7 @@ endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}") write_script(${CMAKE_BINARY_DIR}/git-p4 "${content}") +file(COPY ${CMAKE_SOURCE_DIR}/git-p4.py DESTINATION ${CMAKE_BINARY_DIR}/) #perl modules file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") From patchwork Fri Dec 2 11:28: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: 13062659 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 CCC45C47088 for ; Fri, 2 Dec 2022 11:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233132AbiLBLaA (ORCPT ); Fri, 2 Dec 2022 06:30:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233403AbiLBL30 (ORCPT ); Fri, 2 Dec 2022 06:29:26 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C29D4ADB for ; Fri, 2 Dec 2022 03:28:59 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id o13so10901781ejm.1 for ; Fri, 02 Dec 2022 03:28:59 -0800 (PST) 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=N1Psm3lDoog0dN99rejp3AlgVW2FEZFKeDr3zfKv4+Y=; b=TjmFGhF4ynmcub2H1kyU2JKAEzCj45Zducac+/s83tuCWYvsF++eFI2NeF2/9rBFsR FVPYQztjy1LIDkB0s+pbpdSjt2bA6vLeum/Or07r+kU2R1PG2kOHd3aNS7CwWSE4FGr/ RMxjaWdLEym6KNNpVJPhIlSfn+aDKM7GunvcFqqxvg4b/b3RLxIwXRTDZ58vUV2khTWO adCyXdSNxuiNflr+ogmQu3SGoJH1jCF/zHQEczPs+WocfZt++gKoI+YdB04hPN/q9TVS tadVqu1laiqtoU0Z8Buhx+TRbvhIXdDy7nXLbwbFYX0GA6sviR6Yuek+seBXuNowSUIr qdBg== 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=N1Psm3lDoog0dN99rejp3AlgVW2FEZFKeDr3zfKv4+Y=; b=SXEP6EaOYbGhNhCHQbsxVRh25HNr0hECS8G1da0r7hvCaeAQn+sa4Hb2eStfIja2nh u12NAn9flgAnUtllwvXT3x0OVyDty4IhFvPrr57BxIyNbAYwXVY7NrtMFJxWUi5PyoYh HBAjDGkd/ipoB5KAjci3R+/mDRWIy8v6IkwVSErqw3kwaq0oT2h26KXWsldNeXTTbLRQ uhbMQkUjUkaXYmosfr7pv++DPwR/Azegv9zcxRKlAkwFw5nEt3h0K8YS8CYG/cJUOhS1 qeoT/Eh/2m/3AmXguqRtaLMWuloFkKVJuiJFk15BWlRZFz6dEgnxDIuKSpimgFXYurG0 GxtQ== X-Gm-Message-State: ANoB5pnH9/1pOjNyhbrHRJnLuV6mRbC6MFqXHpNX+oDmuhxrahySLJFP QrVbnFeHrD2aEJozx5RJRZseu9rzWX/SUw== X-Google-Smtp-Source: AA0mqf7o4OgjBmTk3aOP7TYl8CFkcAn09RoIVxpJujIu6I92SUVvQjv9ruAlom0vaI6z/XqkvMxQvQ== X-Received: by 2002:a17:906:b28f:b0:7ad:a942:4d6b with SMTP id q15-20020a170906b28f00b007ada9424d6bmr58787896ejz.379.1669980537791; Fri, 02 Dec 2022 03:28:57 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id b23-20020aa7df97000000b004611c230bd0sm2850780edy.37.2022.12.02.03.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 03:28:57 -0800 (PST) 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 v5 15/15] CI: add a "linux-cmake-test" to run cmake & ctest on linux Date: Fri, 2 Dec 2022 12:28:36 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.981.gf846af54b4b 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 9afacfa0b33..3657ba66c5e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -236,6 +236,9 @@ jobs: cc: gcc cc_package: gcc-8 pool: ubuntu-20.04 + - 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