From patchwork Tue Dec 6 02:08:59 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: 13065313 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 1EB90C4708E for ; Tue, 6 Dec 2022 02:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233750AbiLFCJe (ORCPT ); Mon, 5 Dec 2022 21:09:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbiLFCJb (ORCPT ); Mon, 5 Dec 2022 21:09:31 -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 AB3A7240AB for ; Mon, 5 Dec 2022 18:09:30 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id z92so18410878ede.1 for ; Mon, 05 Dec 2022 18:09:30 -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=RSyrJZ6fjKnxWWuh6XDBUkPT0qMKoS9MYDMXW2LVJSw=; b=neRTT6sG79CAjZCRuKRVzT2LbdoM/66C72yZxIs5wh79l597IGXDv1Pf8NF6HFapu1 FFaDYlZQHhJPQj1Y6at3r54qNq6ES10kGvX3sazJrzsxa2hIlNRt8NrhYObc3YXBcrbA YEohRwnF09TL0llf/Ec6ayKvOf7WhJFnJJQLFdP9NxTJIoXKlsYoyChqOeRmaYM87aAA to1Nap/kU+oU/tI+qCSX6rKHQo5qydpwQpihocHnmYBctpS6EoxUN4BvZlk4ZAcneHlb b63YuM+62n+4SXfimFx0MPchXv7THZbd+G2EHgYUugXSpYyjIVes9wLG0rn+OVpP28sd inkg== 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=RSyrJZ6fjKnxWWuh6XDBUkPT0qMKoS9MYDMXW2LVJSw=; b=L0vTbtlYL55mLasjjsOCN0LjFQ/XQShJ7UzsFuNoYJMrlnKiyCXHI2eN8W+TL746LF InFvuXNyfJT3/KBFOY1ZghF2/b3OFa380KndLwMK8gaww25Qg1I2tcPtI6yR26zV2Xzw RFZFyBXNAQZiudNz37bU7zS5BQdoomHpZXWXH+U25g3y3i2osBVj7vRcMthmtVJt6L5Q gBUERF/oXvcKQtWY7yfPU96c0g+c0yNF3APpLz4LGRgecaRY3pCOgv2AEzGcNDKwuLjx WKGC0e0EObcWex8p+MRUWIMF8h7IsORB3yRxDKmH+IQlP2xnmTyxpIlymr6yGpQF5A6p r0Mw== X-Gm-Message-State: ANoB5pnXj3My/jnpyO6Q3umPGHV6k2dc8/FaoKnU5T51CSs3ahGdyY8Z ekBlXsq73L1crzpSqYnniKrUP614xAC4yA== X-Google-Smtp-Source: AA0mqf4xWlQKl+AOySSzi2e+sPK0/YUs6pmAUU7isrpYJ5Dux0cMguShkOVsLJykQ10t3ulhMzpz3A== X-Received: by 2002:aa7:c690:0:b0:46a:e2b8:1be9 with SMTP id n16-20020aa7c690000000b0046ae2b81be9mr40632697edq.182.1670292568677; Mon, 05 Dec 2022 18:09:28 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:27 -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 v6 01/15] cmake: don't invoke msgfmt with --statistics Date: Tue, 6 Dec 2022 03:08:59 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In [1] 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. 1. 2f12b31b746 (Makefile: don't invoke msgfmt with --statistics, 2021-12-17) 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 Tue Dec 6 02:09:00 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: 13065315 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 962E0C4708C for ; Tue, 6 Dec 2022 02:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233768AbiLFCJh (ORCPT ); Mon, 5 Dec 2022 21:09:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbiLFCJc (ORCPT ); Mon, 5 Dec 2022 21:09:32 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C04B240AF for ; Mon, 5 Dec 2022 18:09:31 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id i15so10168000edf.2 for ; Mon, 05 Dec 2022 18:09:31 -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=vk70038QGUKRvLLL96iHcoMx8OQgkP6oieI2vM16bcQ=; b=qubI2IkTkNsJgtiahXUZuQpp+7dLWo/X9mSEVw7ZZfDmBpqvvS4ygBlyufMcuWvwXA +FhUc6dQaHFDF1Aj1Ya4+YAnxakLMmYayI1t76bKY6gCrs40ndpuMiOvI5mvZsgQrMQ1 CBnmVaqYko6w4+hifiernN13G4RWudSrjjx/c5Qc2L9wGAm4pP2hYmmd9YT4Z0aErnSE LaSmpRs16o/QElhpe9yPV14zptuXogRZ+omI5in7svr4Dw1b0l9DPujzN6MNsMf8wXhm 8Io95oZic4AZox5QFTtRACVu7WWBX53o98YRRWt/dSs5bsJVNEVGRN7BNTSLFKYKfrva EUFQ== 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=vk70038QGUKRvLLL96iHcoMx8OQgkP6oieI2vM16bcQ=; b=tuTvyBZRvN8e3k1GA0r9T6gGj6ue6WgyvSZ5IhZbJrrzU5Yv5Ifo5Lk1fnduoYMn83 9TBQsl6ux52MfMitjvLLnMS4ycr5VmzJCttAm6jmwtVJwCbynaXbD5YS+9pBRcKDuZwi j0qC1XxSY6SmdiqdwapO4pJaDrta+J/hkfhPpTZ382LjuYsZ/3k7t+Fq1UBRaYi2k0Yz 6+zPvOMtnMePZoWpZrytaGVwjnKFvxwWhoNK11FGy3vPd/9ZMVkFsGF+IASAcxwewcZ4 iFAzemAeglIEBpTSMTcyotMTt9hrDn3XfLbrT9Z/sWZZzwCAqSxXc6Yrf/mJ3nd5x7ia hl/A== X-Gm-Message-State: ANoB5pkn28pE2fUf9XDA461PM3WbX3E4MV4kkh7hhCMtDEpuvXeAmBlh HiUklI/9kYBhOJEGKj3yJX1VJj+DEhC4eA== X-Google-Smtp-Source: AA0mqf585oW4pv7GdwWg8v/c8KdP8OqO3ftVDzNAGiLZsnvZuKZUEhOCHlNTAxYLt7IHnCYUl61S0Q== X-Received: by 2002:a05:6402:5406:b0:467:4b3d:f2ed with SMTP id ev6-20020a056402540600b004674b3df2edmr59232271edb.101.1670292569632; Mon, 05 Dec 2022 18:09:29 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:28 -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 v6 02/15] cmake: use "-S" and "-B" to specify source and build directories Date: Tue, 6 Dec 2022 03:09:00 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 Tue Dec 6 02:09:01 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: 13065317 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 BD9EDC4708C for ; Tue, 6 Dec 2022 02:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233062AbiLFCJl (ORCPT ); Mon, 5 Dec 2022 21:09:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbiLFCJd (ORCPT ); Mon, 5 Dec 2022 21:09:33 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4848C2408E for ; Mon, 5 Dec 2022 18:09:32 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id b2so2811942eja.7 for ; Mon, 05 Dec 2022 18:09:32 -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=N8O3VBldRJck7bjge4k+rX0d31r1Px6xgEfOzGUYTsA=; b=hZcRNtagtjN43djS/haAenZpjqUdNowFvizyvobg1KqspSE3ZEB5wKx7/bXwRHFLNZ l//fDFMm39aiyZ7KgmppT2qR0syb6BBQR32xk0c+sJDoGmnG5CGmVloh/ChNpxgT8IET QKTtkToBulotNQOg130YAEWKGu25FVU4TD/oyjztfBavkLlmXB0VEtZRdNhzDo3yHaHt vyUdEhwFdU1RK8S5V23u7x4w+J/WjZASPkhdrcxfpZjgkDm4AMDe3PpAoT7ZIDCNZ7f2 BudXwjX/UQ0+GPpWqAsEAAs+k/8YvwT5AekqSvfxf9oLYYD6CMupxGbdBzEj1US/F9Ph 23qg== 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=N8O3VBldRJck7bjge4k+rX0d31r1Px6xgEfOzGUYTsA=; b=Gwjf53oSGgBylQR3lD5UNpstbnADevL1AikoMOlVFD1IrJxPd11I5aHeIGspxk43l1 Wtk0tCZ6oxinF/aUWOfpBQZTBs0SO7UBFHBtdoRUKAkQUUhv+yY6b2xyrJnd0j3svLoG IIEVo6gy70sdQEgcYr/1EUieEqeuRPQrFeGMhLtjZjq5W1s0m0lw1G7hlce6h0Y3G7KM Ter41t/hYo4iZm6gHBDUCwgg5F7zU3rVgLGYP1XBynTfHqGV49df9G/r29P6B266Nigx K5QYHTa5l2Pvno1spo2Nh7XWmWqWSxNSwiRKC5HnbsSZva1tqM2rdTFKg/UFgLg5nj72 3hPg== X-Gm-Message-State: ANoB5pnTeDKP6aUlIHMfdMga20pAhgs5RrrNPCCQFt+NtFrCfx4UwpRb rkvJSYE6/vQSdlOAjTfVvWlmrzi9yjF5qg== X-Google-Smtp-Source: AA0mqf4PgOu0zjAH4wL1b3oY9OLj+Daz5fY/+V5argRv1B19Z/Yq9aB+FoKyOx79aArJpFMo7T8cRg== X-Received: by 2002:a17:906:4804:b0:7a8:3ecb:bd62 with SMTP id w4-20020a170906480400b007a83ecbbd62mr72315381ejq.721.1670292570543; Mon, 05 Dec 2022 18:09:30 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:29 -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 v6 03/15] cmake: update instructions for portable CMakeLists.txt Date: Tue, 6 Dec 2022 03:09:01 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 Tue Dec 6 02:09:02 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: 13065316 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 9A4D4C47089 for ; Tue, 6 Dec 2022 02:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232078AbiLFCJj (ORCPT ); Mon, 5 Dec 2022 21:09:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233466AbiLFCJd (ORCPT ); Mon, 5 Dec 2022 21:09:33 -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 5C0DE2409E for ; Mon, 5 Dec 2022 18:09:32 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id z92so18411015ede.1 for ; Mon, 05 Dec 2022 18:09:32 -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=TBNq0+RjJrOOIuKDQS0E58sMfJXH2MZVTOPteojgxi0=; b=T1nUlrGUmU8qgXcPLItdmhTI3xwJICTtx0x5sJAMlP045FkVCSt4H2gt7Fh3U8GQri ZnKIbic09eiFpo6JD4SMnkB4+Rgt4pIv/igAiSITRe0SH8TT/D+tFMxtJsANa0+8W5m5 azozUrGOimBn/3DfrRuQg3rVSd1uiHBmfsB9lrc3mfmB+YMCU/MMp4q5Wz++S9Pk7P9Y epAqbud/eO75dHvKhXSdouRIZa+rxHjcsRcWXh83gz2iDAItCrtmrXmUvN0tPCh9XtS0 FFvrNmFfDCbITv9hRvqv8Y20x1VGva1VBXylZnmEWrZzx0Y3RDQhW58awlAFGfcQgijV 9ueA== 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=TBNq0+RjJrOOIuKDQS0E58sMfJXH2MZVTOPteojgxi0=; b=3q76xqWMu7aTTJ/tXocOBZppA6NeFSlmzB47tVN9LF8tUaONZ8ydzTBTQomhWi9jk1 J7ND3Z6tDhStULhwnu7gZbkdXqh7hTtYCbAV3lSlt4ajmEDNBVo2H9D0QbqP98nJhJYV SZXnk2NaUQ4g4YzDc/J1XewfkZiUmnIADXu0E3rPsVpL+PRB8lXZdJt/bbH7Gs8CvnIb JuJt7seXGx8e/BXLgctjkQcotOF7IwYUJfJTv4MBsk1cwzMC9u9k8tw5YFnyq513QRPs dWk3fuaV0R0yY64lv3BaZGf2WwSk3ACj16NzLQXluD91OoqOcef52jS+vXCDPlLo1kws OnFA== X-Gm-Message-State: ANoB5pn52Pk2OkfHSYOLfLeM5Z0Tw7EJqgQ5x3B8PFh4sHPOAe1iVGYV ygDc+hJhRaGPCYUBrx2v0CI54CCxY6E55A== X-Google-Smtp-Source: AA0mqf48G9FvkSoxcIixDl472D9ggom4OVdKU3z68mlZ2Wnl5QbVSx/EmJZ06tqubEhOXo7IR+AmIw== X-Received: by 2002:aa7:dbc3:0:b0:461:6b61:81ae with SMTP id v3-20020aa7dbc3000000b004616b6181aemr75332826edt.62.1670292571471; Mon, 05 Dec 2022 18:09:31 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:30 -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 v6 04/15] cmake: don't copy chainlint.pl to build directory Date: Tue, 6 Dec 2022 03:09:02 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 Tue Dec 6 02:09:03 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: 13065318 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 63F1AC47089 for ; Tue, 6 Dec 2022 02:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233778AbiLFCJu (ORCPT ); Mon, 5 Dec 2022 21:09:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233443AbiLFCJf (ORCPT ); Mon, 5 Dec 2022 21:09:35 -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 85DBA240A4 for ; Mon, 5 Dec 2022 18:09:34 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id gh17so2815969ejb.6 for ; Mon, 05 Dec 2022 18:09:34 -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=uChl/FJABHgCcYWfJkYu98IH8LraNbjrk8zuXimDxg4=; b=UxyVny6vecuTPYcCI+6rK5Jatts5SfbAlZsjLuaGvfOPwuqXsdYScY06717PPk8oHi 789BQh8Zgovb17g6WYS8uD505rOOn97coTS02KsWoRj4HesWE6ZAr40KYV/x0X3DmNTu RvyPr1/eYyGD0JAeWBOBp5R7fNnBEo/DrPGLFEMPMuMRMFVYrJcnbzAT+m0+jgmXgV2e HvuHzJzxVZcrOkci+j7DpeMIWWt9gm4w2uvNTu+WAHi+OigYC/aMNRG2k6KaymzZdeiB MIwL8CcEQNd36TaWpLiBicaiSaciQt/P4DztQSQ3rW35IVwajnRMcyrvMgPsCWqWN2GF TacA== 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=uChl/FJABHgCcYWfJkYu98IH8LraNbjrk8zuXimDxg4=; b=v2ryrx9WM6FJ8Y+myA5v16XaUnpqb6Zagz6pQ6Bt7L7SwKJREJY7JqC0anv9rcpFbP jnvzZGyZS+DRmWHFqkCOvojnbEpm7JJECgTOwS40jkMrLkDbpyhDz9kfQbMI1un9wrBU JPOw49tmx7IAzvWOt/DiZ+tVaUQw+XEuWm1jClbamr2m/5BbxKESIPoiNq1p6oOkmc0C mKrWupmlZNKzhg4MlxaEeRDZTg3HsZ4KNNcMHBMKnEmZ1OV0c3mT9SboVBzVsSQMm99u dcmA2Kc1D6jCiSxJj+kS9S5F/WegXUPpv69yWdHkF4q5ORwthu5a+BZdEEt30kTTJkcp Rleg== X-Gm-Message-State: ANoB5pmuhzdw5s1CpwHqDFd7uRbSILF9XBaNj1FuqxoY9R6rsML2vfC3 lkWUaZguOKOaENgoGEjDxGw2lGDVo6T2hw== X-Google-Smtp-Source: AA0mqf4dazbGQqusT99XIbMSLGp2+lKAE6oNLmUVV5q6hoB2CODgXSTmQTmUKtJ7PJ9cwvAHK0PBxA== X-Received: by 2002:a17:906:b103:b0:7c0:9a2e:2840 with SMTP id u3-20020a170906b10300b007c09a2e2840mr22940636ejy.404.1670292572528; Mon, 05 Dec 2022 18:09:32 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:31 -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 v6 05/15] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4 Date: Tue, 6 Dec 2022 03:09:03 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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. As this isn't needed on Windows let's skip this there. There's also an unconfirmed (it works in CI) report[5] that invoking the "chmod" command fails in some scenarios. 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 5. https://lore.kernel.org/git/87f22a55-ee84-2f76-7b9b-924a97f44f89@dunelm.org.uk/ Signed-off-by: Ævar Arnfjörð Bjarmason write script --- contrib/buildsystems/CMakeLists.txt | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index c641e9349c9..7a2c3681e0d 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -840,6 +840,21 @@ 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(WIN32) + message(TRACE "skipping chmod +x '${path}' on Windows") + elseif("${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 +880,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 +895,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 +1039,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 Tue Dec 6 02:09:04 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: 13065319 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 6A632C47089 for ; Tue, 6 Dec 2022 02:09:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233811AbiLFCJw (ORCPT ); Mon, 5 Dec 2022 21:09:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231923AbiLFCJg (ORCPT ); Mon, 5 Dec 2022 21:09:36 -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 65449240BF for ; Mon, 5 Dec 2022 18:09:35 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id vp12so2808977ejc.8 for ; Mon, 05 Dec 2022 18:09:35 -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=sMNvf0+LAyxQf485J0oQYBjVV9EnaNXh4B2TEoZX5ao=; b=Vsgl+ADFV5ymsXMILWT3DGnYmdZJanVvvQjF1ZJJfhvSniTlP5oaIwhWckbR8keCUe 6M5k4xdiUXb3ITIRye+Xrootbse3kgjDtrE9nJi9vfQ68WQA2YN26ni3074eZG9nerAW i5iT0OdZe74pRxjqIl94XCZfyVm4LnuBDfhfd2ny7Ev0aLjgxQBpbn1Cr1aAWa1wWH2c AO4c+wGfjmH0lYrNH94MLFMotzzFWQpkneu3mNSWhceBmbBSIhC8O/Zfc31SyBDVxe++ xIO28RfcKaKR65aqOBLlHzGr+f5eOHaxvajVTZ9RDKK8y1R1R6DkK3Vv5Es17hcgWyIh HAuw== 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=sMNvf0+LAyxQf485J0oQYBjVV9EnaNXh4B2TEoZX5ao=; b=JW7CX4LXWffpRJIFCXQQwY1RbSEaIwEgEV0E1sHm1nJjM7E+0OElSYwRJPkDMlOA94 ajs/1KmfkIlTQk0Ks2sA5l52EfvRHH2pSIzbc/WWbNuWYkNQBhQqzz5ofGNf7ycj2uf1 2QJCzIke1BK5Tl0bDSLYL54gEHFQSZot8iw+gFldm8gC6Rbpp0OeVUIZytYVuDaOoeR6 A9SrwPXd7BuInfLbQQQEcgQ1O+liPRlCPqyVT9X2UuEfw4n1QF3YCleSJ0sSOlmt8BJT TW7Or119pEwHFw57rNeL+NJNmUGlW5XHH3F0JYg+QGtCo2Q0JnXYRc0amq5I41/i4EcB R6CA== X-Gm-Message-State: ANoB5pkMmK3NwlJzxR+RuNBl6aPt/9HZ7X++ueVBTYXownKHm4N62JRl 5Sxb4MWDS8Rk2mGtYtjueWBgc9uu0JHYKw== X-Google-Smtp-Source: AA0mqf4lhz5eF3y/f6rZUfTlXo9P4amW6Ow5KAmRV0O7CuYBuGjysaStzY2AscH5iotA6bMNBrAhiQ== X-Received: by 2002:a17:906:4a0c:b0:7c0:e306:fe72 with SMTP id w12-20020a1709064a0c00b007c0e306fe72mr8392167eju.243.1670292573567; Mon, 05 Dec 2022 18:09:33 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:32 -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 v6 06/15] cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable Date: Tue, 6 Dec 2022 03:09:04 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 7a2c3681e0d..ad47430f9be 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1120,12 +1120,6 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) #Setting the build directory in test-lib.sh before running tests file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake "file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")") - #misc copies - file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/) - file(GLOB mergetools "${CMAKE_SOURCE_DIR}/mergetools/*") - file(COPY ${mergetools} DESTINATION ${CMAKE_BINARY_DIR}/mergetools/) - file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-prompt.sh DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) - file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-completion.bash DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) endif() file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh index cc6bb2cdeaa..dcd6e9c3f75 100644 --- a/t/lib-gettext.sh +++ b/t/lib-gettext.sh @@ -7,7 +7,7 @@ . ./test-lib.sh GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" -GIT_PO_PATH="$GIT_BUILD_DIR/po" +GIT_PO_PATH="$GIT_SOURCE_DIR/po" export GIT_TEXTDOMAINDIR GIT_PO_PATH if test -n "$GIT_TEST_INSTALLED" diff --git a/t/lib-gitweb.sh b/t/lib-gitweb.sh index 1f32ca66ea5..6f68df247af 100644 --- a/t/lib-gitweb.sh +++ b/t/lib-gitweb.sh @@ -49,7 +49,7 @@ EOF error "Cannot find gitweb at $GITWEB_TEST_INSTALLED." say "# Testing $SCRIPT_NAME" else # normal case, use source version of gitweb - SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl" + SCRIPT_NAME="$GIT_SOURCE_DIR/gitweb/gitweb.perl" fi export SCRIPT_NAME } diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh index 8b1c3bd39f2..2090d12a489 100755 --- a/t/t7609-mergetool--lib.sh +++ b/t/t7609-mergetool--lib.sh @@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'mergetool --tool=vimdiff creates the expected layout' ' - . "$GIT_BUILD_DIR"/mergetools/vimdiff && + . "$GIT_SOURCE_DIR"/mergetools/vimdiff && run_unit_tests ' diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 43de868b800..1bd4cae92fe 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -33,7 +33,7 @@ complete () GIT_TESTING_ALL_COMMAND_LIST='add checkout check-attr rebase ls-files' GIT_TESTING_PORCELAIN_COMMAND_LIST='add checkout rebase' -. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" +. "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" # We don't need this function to actually join words or do anything special. # Also, it's cleaner to avoid touching bash's internal completion variables. @@ -2567,7 +2567,7 @@ test_expect_success 'sourcing the completion script clears cached commands' ' ( __git_compute_all_commands && verbose test -n "$__git_all_commands" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && verbose test -z "$__git_all_commands" ) ' @@ -2576,7 +2576,7 @@ test_expect_success 'sourcing the completion script clears cached merge strategi ( __git_compute_merge_strategies && verbose test -n "$__git_merge_strategies" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && verbose test -z "$__git_merge_strategies" ) ' @@ -2587,7 +2587,7 @@ test_expect_success 'sourcing the completion script clears cached --options' ' verbose test -n "$__gitcomp_builtin_checkout" && __gitcomp_builtin notes_edit && verbose test -n "$__gitcomp_builtin_notes_edit" && - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && verbose test -z "$__gitcomp_builtin_checkout" && verbose test -z "$__gitcomp_builtin_notes_edit" ) @@ -2599,7 +2599,7 @@ test_expect_success 'option aliases are not shown by default' ' test_expect_success 'option aliases are shown with GIT_COMPLETION_SHOW_ALL' ' ( - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && GIT_COMPLETION_SHOW_ALL=1 && export GIT_COMPLETION_SHOW_ALL && test_completion "git clone --recurs" <<-\EOF --recurse-submodules Z @@ -2610,7 +2610,7 @@ test_expect_success 'option aliases are shown with GIT_COMPLETION_SHOW_ALL' ' test_expect_success 'plumbing commands are excluded without GIT_COMPLETION_SHOW_ALL_COMMANDS' ' ( - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && sane_unset GIT_TESTING_PORCELAIN_COMMAND_LIST && # Just mainporcelain, not plumbing commands @@ -2622,7 +2622,7 @@ test_expect_success 'plumbing commands are excluded without GIT_COMPLETION_SHOW_ test_expect_success 'all commands are shown with GIT_COMPLETION_SHOW_ALL_COMMANDS (also main non-builtin)' ' ( - . "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" && + . "$GIT_SOURCE_DIR/contrib/completion/git-completion.bash" && GIT_COMPLETION_SHOW_ALL_COMMANDS=1 && export GIT_COMPLETION_SHOW_ALL_COMMANDS && sane_unset GIT_TESTING_PORCELAIN_COMMAND_LIST && diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index d459fae6551..06f0abfc294 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -10,7 +10,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./lib-bash.sh -. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" +. "$GIT_SOURCE_DIR/contrib/completion/git-prompt.sh" actual="$TRASH_DIRECTORY/actual" c_red='\\[\\e[31m\\]' diff --git a/t/test-lib.sh b/t/test-lib.sh index 6db377f68b8..36358811a0f 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -47,6 +47,10 @@ then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2 exit 1 fi + +# For CMake the top-level source directory is different from our build +# directory. With the top-level Makefile they're the same. +GIT_SOURCE_DIR="$GIT_BUILD_DIR" if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" then GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 @@ -1447,7 +1451,7 @@ then make_valgrind_symlink $file done # special-case the mergetools loadables - make_symlink "$GIT_BUILD_DIR"/mergetools "$GIT_VALGRIND/bin/mergetools" + make_symlink "$GIT_SOURCE_DIR"/mergetools "$GIT_VALGRIND/bin/mergetools" OLDIFS=$IFS IFS=: for path in $PATH @@ -1500,6 +1504,8 @@ GIT_CONFIG_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.." export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM GIT_CEILING_DIRECTORIES +MERGE_TOOLS_DIR="$GIT_SOURCE_DIR/mergetools" +export MERGE_TOOLS_DIR if test -z "$GIT_TEST_CMP" then From patchwork Tue Dec 6 02:09:05 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: 13065320 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 031A9C4708E for ; Tue, 6 Dec 2022 02:09:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233742AbiLFCJ4 (ORCPT ); Mon, 5 Dec 2022 21:09:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233759AbiLFCJh (ORCPT ); Mon, 5 Dec 2022 21:09:37 -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 568C7240B8 for ; Mon, 5 Dec 2022 18:09:36 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id n21so2787816ejb.9 for ; Mon, 05 Dec 2022 18:09:36 -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=PfShSiGhMf34r5bJqw+kCZtQun7H3mDsNB7fc00ugOc=; b=XCJNrp23ps0y1FieS4AsS0n9KTb39xjCdUXtMNbk0sjlHK6FYrt5YUBxKThPiX5W0b 27ZayKRVaE4XorULWOivtMSig4E8NOO0nHdVs8CmFXFcHwL5pSt5ENAU324X6dLAUVJ/ roW5PTfzjnMufltA3DoLWlgqiZEUMtdEHoHo7iQbS3MtK0BHK+3w3KTt0nUR+at95y2u fAq/+kYKcoz1voIhLEKgVNfeQ9H2Vye5DGMWaIobhC3IH52qcV9MxMUjvxfEzX09FBXG jjM7BlF+ro4K6xkdO1Y8Oc1FvOPQHnj2KKYjwY9FbH366zdPspWus4igaNOvDTAJj3+a CCrw== 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=PfShSiGhMf34r5bJqw+kCZtQun7H3mDsNB7fc00ugOc=; b=6dBG5d3fgCZ9GuUy5LEKNIbGqfVTgPBMd/jKSh+VnSrzm+DGWc1wl+4jVZnmnWuuJE B+TqH+rHFLux2zDWcvK+7dPk1VsSeXM5eOHeKufPbi2LTT34kEDbzxdNIQ7BefcdoW2k gbhqWSpLhSPejlvSVu21aQhzSrW9jjozblS3rteuOLnOuyjwQDDWWZS5wILDm/hQiU4d 4lBUN9HrOjp1czyEeicRJ48Iy68jXtN/Gc/shGnnA0BH3uo7qdHGEjZQ7RoKajHNh6Zu NqACFYpVKv2+XGthtaKVbtTWKxN+zqUoPJ5r1q3/CPyQGIILTc54xjQwvoqrkJ1hhJLv Rjrg== X-Gm-Message-State: ANoB5pkr+RI9Nw5RU0scjl17izgwukcxfeyzZs7nDLUnw6nlvmrn7dds wiY7dYhhUMZvvjLKf/jW/lQ5x9DtwWsO7Q== X-Google-Smtp-Source: AA0mqf59rSn3s0ZIOM83X/25L8w5r/eCwAYfvdl0xmNHfxj9wSxoq5Sc5asiqTTtYiGPaQbqO54y7A== X-Received: by 2002:a17:906:2481:b0:7b9:a749:e70b with SMTP id e1-20020a170906248100b007b9a749e70bmr48744828ejb.567.1670292574506; Mon, 05 Dec 2022 18:09:34 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:33 -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 v6 07/15] cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh Date: Tue, 6 Dec 2022 03:09:05 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 ad47430f9be..2d66d471acb 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1101,6 +1101,9 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n") +if(PCRE2_FOUND) + file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "USE_LIBPCRE2='YesPlease'\n") +endif() file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n") From patchwork Tue Dec 6 02:09:06 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: 13065321 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 B8E6DC47089 for ; Tue, 6 Dec 2022 02:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233817AbiLFCJ5 (ORCPT ); Mon, 5 Dec 2022 21:09:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233303AbiLFCJt (ORCPT ); Mon, 5 Dec 2022 21:09:49 -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 3167E248D2 for ; Mon, 5 Dec 2022 18:09:37 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id fc4so2755486ejc.12 for ; Mon, 05 Dec 2022 18:09:37 -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=fUq7xuZ0D+6gVl+eHlL+oBolHtQjseWFXsJAh3CnkoI=; b=NjGFLCmKzeolp264bADeYs0WyFgitKH9riwVvVDXGSwYlsUdTZJMzz9ULwX9rQzqvh aFnnLVtI5A978ss+e+oBLtNS1gbrATxHOQOjN8CSpNTNiojCpD9ZnAWjaI0fq/0U0VQf BJNhayI0l5/ir9sJE9wjgsqaUGl9SPqCL1KoNJfpI0El5GNqcbuKkNuUEI5njK30BFDX IUMZ74z/MwHEDHTRbLtpUBX+ymjwjeIzdZ09jx9A712I0jBFtYmnEPwOfMHnic+bc+Es Os1KbTqyVvgEYKrd8XLVXxKjayn9yfRLfFXsIEfEqlb2x2YCjnC2MmbTOhIufNwDCNX8 sajQ== 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=fUq7xuZ0D+6gVl+eHlL+oBolHtQjseWFXsJAh3CnkoI=; b=IRuzXOZ7+ki4m1XuK6Hp/RCDTCIKN2YapAgazeErgQ1tfTaRgYOfxlfT+4CGNaCGJZ hdvgtwZFpOCkyuhphX1QxTM6CaVtXbr5bh+h7tUCuyIl6/U2MNHSp/RJLAWdzNh5T802 uBrgPyGN/fmiGthQGENmSRHQViNiHUlEwgNuyhZMZV7SP9D6MvCJqHm0r0zK8O5DiWft K3vr5j4DEVI2Tf6akq2YEbvqGLHWxDcPs/KCazdthxRQKaf5SpSOFfKxfGD0wusLDzXX z9wqCcS6zDoR+W7oHz6uBhCSQq57h2E4jwRtNq1LrPcnreB1Og/2U7ZxSnSkyiOFIMRo 4F6Q== X-Gm-Message-State: ANoB5pn9zBel+cYn+gzrxgmCPIvc787ihqOUNPiIrmMDKLlL6xOMhHTT oQ57mTx2HMxMutABmnsAARRN4mGDAN8D5Q== X-Google-Smtp-Source: AA0mqf7Rw5VHgw5ExUJ013z1a2LL17Ttixh3H/ejDvlRl59K4tWnvDvfcUWl1QlSSANXn66ovDctDA== X-Received: by 2002:a17:907:9c0a:b0:7ae:1e53:8dd4 with SMTP id ld10-20020a1709079c0a00b007ae1e538dd4mr28741371ejc.42.1670292575460; Mon, 05 Dec 2022 18:09:35 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:34 -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 v6 08/15] Makefile + test-lib.sh: don't prefer cmake-built to make-built git Date: Tue, 6 Dec 2022 03:09:06 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 Tue Dec 6 02:09:07 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: 13065322 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 E7497C4708C for ; Tue, 6 Dec 2022 02:10:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233834AbiLFCKH (ORCPT ); Mon, 5 Dec 2022 21:10:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233777AbiLFCJt (ORCPT ); Mon, 5 Dec 2022 21:09: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 2345A248E3 for ; Mon, 5 Dec 2022 18:09:38 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id vp12so2809141ejc.8 for ; Mon, 05 Dec 2022 18:09:38 -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=2St+QUt0mvUlgktyu+E/VHX5plavms8gTBOOD36edxA=; b=I2XCSPwkTX/HE4raMzR/ZErPlGB5j7AzUTGcKdNBvTcHg9M7N9UdqT8rKo5yComVUy 0+0mm2Rz/HT3NATZICI3VEl8vFJxGeX9UyBSojKpoKj/ASZlP+hkW8HDF8RPItvHKuT4 lmm/L9DsGpzUHzLpTA+/8p0kF7OwL7Fe1w4dFOfxvWP7as+l487HkYdX0BR1jpcKwnIU 9QjDr+8ct3nEBJE5BHc5EGgOACrfXY2BYjbqva3afF5XRCy7+5MBLaHpIh0/d6EJE33Z sIp5GttuU3bNFCEJ2JGX30VS46cV68SPJ3QyGLhpl1Sxy/nQDWyRjeoetKD6fSn9nGDT /9Mw== 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=2St+QUt0mvUlgktyu+E/VHX5plavms8gTBOOD36edxA=; b=jGPQh0mwBZj/FwKU7ggeV9y03cOwf7SnSKT2+7YdPG6oECPjcNNKrEnhdIlZ1brTFT ROIJBXTM/5ti9C6BbQptbc6MgDPbG7lrUbBZjhQVKrEA4lINHn7XpdlbpwbryOcQkuFY JnBQB1mPF3CZEhB0uhsOXcapnoyc5wVqrRM1VEf/U36Bm0a+cEBrR36vbuEKHUPhNbrT hg3VfiqPjHdwnen6rwWdnEmC0bIN5Hk5M3oGz1iToqsJIDQIeCU/jSuALA6FctjFrNJi NSlZEny2r8JXdcvpnaJUi3HUhNftVYv3rUVPSL445eNyXCyCfaJFIXpEmhW1OnNFBaN8 yFHw== X-Gm-Message-State: ANoB5plEww5LueVq4bS+UB5vl9eFn7DyerVs44JAkWmZPL7mqoYojoUD 2y1WSD641EFLgRxNf+Wf3LOkVDlX07hW/A== X-Google-Smtp-Source: AA0mqf7SC+Rf0dU3KvIAHl+NLg8xTd9L3QnjMj7ZjThHeW5ayF8SpSW27S3YoQOV4FV/mjFfDhx+RQ== X-Received: by 2002:a17:907:a710:b0:7ba:fd1f:524 with SMTP id vw16-20020a170907a71000b007bafd1f0524mr11308537ejc.361.1670292576363; Mon, 05 Dec 2022 18:09:36 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:35 -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 v6 09/15] test-lib.sh: support a "GIT_TEST_BUILD_DIR" Date: Tue, 6 Dec 2022 03:09:07 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Complement 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 Tue Dec 6 02:09:08 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: 13065323 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 ECE56C4708C for ; Tue, 6 Dec 2022 02:10:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233874AbiLFCKR (ORCPT ); Mon, 5 Dec 2022 21:10:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbiLFCJv (ORCPT ); Mon, 5 Dec 2022 21:09:51 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6165224943 for ; Mon, 5 Dec 2022 18:09:39 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id c66so12061550edf.5 for ; Mon, 05 Dec 2022 18:09:39 -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=7hGdzmXj3lZ5FQepIPPqrhKgzqMOxpKb5tN205sbsNs=; b=LYzcIMQasTK4z21As3g0sN9JxucjnifiYxqUa62Xq/Yp5Wt7p+0PKXV2O7Y8gKfCak yUV6IOOY6aPKcB4LOW/KJnJu/3Q//VH0ZmlBosKc4SnuXueucYjfsm9UZ/iBfr3FOhl2 rVcfU9cCOHiUsTxpElaiB3nAynnL/nw+6GR05dXg6J/T9bYj7ur7RO2YEWdtbNv5hde/ wTID03IglvMwQu7wVRHBqaqckxa/X/E0xGl7Z4NgZb14PeL15oauPCt9QlfpQNMWQHD9 z0BkXiVuL7eP79e+owe3j06MQq+boppc40b12gS23ILaZ2nIc6MlQ/m73tMBrpp7MTUf DbbQ== 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=7hGdzmXj3lZ5FQepIPPqrhKgzqMOxpKb5tN205sbsNs=; b=UtX/kNXM6F5iFg7zONWOhg9MoGAPwPltebXMNthcV2MiNAvUp13rBedk6eNa/8Ujik mRIhheRvTTFH5g2K0zPluSHh8bl+4d+OpD1OsqxiH42N1uepsRkm4diq0az+1LZYezyJ +UnRc2omB2EXA2QHW6bowUIGEhIUf/ymi0ufz+07+Dm3/Jq6oltRR0LX1LHo54Whcjiq l+FaVXbe2L1qFawdCJQ9vdpgCshGFlDFhpyQVNcneGYjUK5Nker8taqdSwW+iR4xf0bj 6YI1XPGgacO8ghekI4l7V+ST5k2W+XGWNPCwr9Uw8/N94N+xmNG3Vge9L5UdIZRNcndG SCwQ== X-Gm-Message-State: ANoB5pkiXIJ3XYBXkvJMM9cOHWytGQAE2abXBCKkR51CND+/NTpxsG/i kR3xDRGI+x1KmxV6Y02d//aUbZ/YZSqkXQ== X-Google-Smtp-Source: AA0mqf7fM6GhbmfEDXHYen0SWu05b5GyDJsI1JhWx37qz4+7jNd8rs5GB5EN6qzH37YfQs7saMDUJQ== X-Received: by 2002:aa7:cd91:0:b0:469:2f36:fd with SMTP id x17-20020aa7cd91000000b004692f3600fdmr62900931edv.385.1670292577317; Mon, 05 Dec 2022 18:09:37 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:36 -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 v6 10/15] cmake: optionally be able to run tests before "ctest" Date: Tue, 6 Dec 2022 03:09:08 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 2d66d471acb..385e4e9d772 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1117,12 +1117,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 "Have GIT_CTEST_SETS_BUILD_DIR=ON. Need a 'ctest' run to write GIT-BUILD-DIR") +else() + message(STATUS "Have GIT_CTEST_SETS_BUILD_DIR=OFF. Wrote out a GIT-BUILD-DIR, no 'ctest' required") +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") @@ -1132,6 +1153,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 Tue Dec 6 02:09:09 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: 13065324 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 3AC68C47089 for ; Tue, 6 Dec 2022 02:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232591AbiLFCKS (ORCPT ); Mon, 5 Dec 2022 21:10:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbiLFCJv (ORCPT ); Mon, 5 Dec 2022 21:09:51 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 647FC24952 for ; Mon, 5 Dec 2022 18:09:40 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id bj12so2751493ejb.13 for ; Mon, 05 Dec 2022 18:09:40 -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=xTSqo+LxeQPCVnjxi10OnM1T7dNPysU9WXkmP05tiR4=; b=KnHE5qv9oHqK32QNTkNWinHZSMNippFW9VPLRfCeL7xg8JdgcG7hbIzq1CAPbUelsw ZY2lCkqOy6tIHWqZiOlLDdKiiSAHezSzBuQoszx66FcCXcxGot/xOVncBQkD4m0AgFfd FVRsxRFrQ/9VFA3RcktFy9SXhXT12Tb+wT1cmKF1V/7f8i2cYakmi9qD0rZ5GstYUAGd lhv3dl+zJ4PuN03cgnEO8I9WMHH+57Nt3vIu9mlr9k5V+1GO73sAPA5xc/DvCae7lLer yQRpFb7GlGs7BxN3TMg3gnt0Z4ForO+vw1aJXo8Ifkms/jG+TUeqClB1I/Rf6M28vocw 3CAg== 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=xTSqo+LxeQPCVnjxi10OnM1T7dNPysU9WXkmP05tiR4=; b=aAAbqdHGu7NG+YYYLhK0vjJKhDmLNuvl0T9hxgueONh5cEfbcVxjisPa0GD1gUzCfC E5AcY4ZGS7stVV6p4qF0xaMKvI3yU3tP77u7U3SEndxJEutMXjim7v5t9upwt39FPA2c FBAvSvYl//znq/Uoiate3xpZ6dYvNq1iRKlZd8Jc38vpYbzxFp2meorjBPdaQ+qcjKR6 LCWZr6a9o+YYD2QTRbE3jxSZOYI5zPgId/EClUGe+37UxoPW8T58uQEFQbXN0h+1MNH6 qsaowEpPo5AHaMZkhPz4UeyJcP7k+3ZmfRqXuxGN8DEA4ipf3OIuIsArk61YnwdrppsD 9Nsw== X-Gm-Message-State: ANoB5plHfEac/Rxl1pva4M+8bWDMfAV8NeQ4x0mKjNBmCG1H3FpL6C45 3BnRRYYS2WzsVaLRcf3WTv8tXBCSy16ANQ== X-Google-Smtp-Source: AA0mqf55VPGRkQluxB0Yo/WzeHgdHoqryI85WKdnQwCtaaiD8lCLsw47jvh45DaTAhj7Z/0ZA9fALQ== X-Received: by 2002:a17:907:7650:b0:781:e568:294f with SMTP id kj16-20020a170907765000b00781e568294fmr57989422ejc.447.1670292578571; Mon, 05 Dec 2022 18:09:38 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:37 -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 v6 11/15] cmake: support GIT_TEST_OPTS, abstract away WIN32 defaults Date: Tue, 6 Dec 2022 03:09:09 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 385e4e9d772..034ab2c879a 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) @@ -1148,10 +1179,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 Windows-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 Tue Dec 6 02:09:10 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: 13065325 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 20487C4708C for ; Tue, 6 Dec 2022 02:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233171AbiLFCKW (ORCPT ); Mon, 5 Dec 2022 21:10:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233354AbiLFCKF (ORCPT ); Mon, 5 Dec 2022 21:10:05 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C10D2497F for ; Mon, 5 Dec 2022 18:09:41 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id n20so2952720ejh.0 for ; Mon, 05 Dec 2022 18:09:41 -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=viJsghI/3Fk8umUZECXDvvJadMIoRX7tU11djF1A+sc=; b=AstlsQSHWuQ8XajSy0l2gpZHCBjFZnlwZE41PudiAzBpDyP68EM/itNqOXbrTvGatr qITO0rPaxQN3cgWIpMZnASNkvRPtd9kpOyLx9qtnf48jEHJNY0YB+97IDL24qM2r3/pm C3UOANHZHnoZnqvVQAJEH3Qd9fe6DlqQLvhJwPOWbKOag4QoT2LZKz7OXT829U2c0ukI vusSRl6kA1eovI7pnGF+vAUecL/o2Rt3ObjHR+mjB380V9dYmbIyxkmYGPlxxAbqVVnM +CCfLOjwsxyW5MgjbzsWRR5mbQOB1OAm9fD61/FC6Sz5uC9A0FGujO9fGpvGs0mkeMFg +Azw== 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=viJsghI/3Fk8umUZECXDvvJadMIoRX7tU11djF1A+sc=; b=WX7AjvPbFS8w21rGSpHOjU+paP6Sy/XgtcvoGAhoGywQx1NWWKfQEppTuSlusg11zJ BbWvcFP4qKBHyGCvItEhSLHeDa6rtMIpxmAeMPANlLD/byDZlzb9TqYCmdsTGALHU9An n75pGfGlrVHvKnCUoyyolmb4kYzBijcqo4rPIfBdF3wbsmsttfhH451+LfKj5DKzglC7 l3+DOrrHmovFBQYvBjtijIYdbHy95NU3Yag0o296BKVVp9bS1jKIX9ebrcySKW+kGscL xbg/YKwNeLu/TslROfq7oBhM6DN3tJvPh4mRcuRboDQzWMjZcPgUQg4ZtY2yWk4EGQob 7ycg== X-Gm-Message-State: ANoB5pkuPKShEY2FuPV8e6Xj0jQGSkhTDGw38xhpSyC7cArytcTBwfvP lqrOqVyIUmubNKdlsZ/8YO0A+egvMFq2Kg== X-Google-Smtp-Source: AA0mqf5qC0c0EvEgvZpm+NvSisENIhPBfRbO3JcyYRJ+Psr30Gy8hkB7VNEfowA5tifHsmfhBwu5ug== X-Received: by 2002:a17:906:a082:b0:7bd:1fdf:ac09 with SMTP id q2-20020a170906a08200b007bd1fdfac09mr41674835ejy.287.1670292579509; Mon, 05 Dec 2022 18:09:39 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:38 -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 v6 12/15] cmake: increase test timeout on Windows only Date: Tue, 6 Dec 2022 03:09:10 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 034ab2c879a..139498c5d5b 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1206,8 +1206,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 Tue Dec 6 02:09:11 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: 13065327 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 3BFD8C4708C for ; Tue, 6 Dec 2022 02:10:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232113AbiLFCKg (ORCPT ); Mon, 5 Dec 2022 21:10:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233849AbiLFCKL (ORCPT ); Mon, 5 Dec 2022 21:10:11 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567C324BD2 for ; Mon, 5 Dec 2022 18:09:42 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id m18so1275179eji.5 for ; Mon, 05 Dec 2022 18:09: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=5oWX0AvD7Igjh+Ey8Euv0CCxaToxr6+bB0B5AWnxct8=; b=mAPhkhLVpiII1tp1IMkdDiq6KyDgVLBVblbbh5gpuJgMqXDAfNfM9N2I+VMZvJ+9NM WG+GxDojmuuyqEk4Yy/oydhJEsxp3FsU+jWqA/gR17RkukchbsoaOWI/Jppvks9crGog MVPCM9TDrsyysapJ4u2GvlMGmQTcQFnsaPCIKdqCvQyx2R2M6OIVUEcOqsr941vM+tw6 AcJhUaTIwUclLKDJU4IB6Vz7PCTJ7eSzf7vGyuG5//pOOweAoQpPU/cCGkJ8j/G6HXfS QJ3LKZV67JchuKrC9H0CNUkOHILA69r0DeV2kAwgsu62OoqwFZU/tgfCNEHXUM3Vh+ee +RrA== 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=5oWX0AvD7Igjh+Ey8Euv0CCxaToxr6+bB0B5AWnxct8=; b=5ikDxBqADEzGUsKU7wXmP7Nzwvc2ZQ8Iu/u7KM7qQkh4UuAZBmJj+srf0HLgJy+i/y fmtaHFVZRsutEEptTCApxhTsVzNyGRhMMcfpJdJUfCA2D9WnfVJZKhHoZmHsZdG4QC0m 06csalHuxeWe/bbWBaEvKxdtNTKdorv7yIh49nndamSZmDa4v6LfRII0NN9Dxn2Gb4Ud TQMUW3oXSrj/OjITA9DIzIZZYnSB7Gsmgw/u8tPSFdGjPyIcEc+2qRxckgqyVQdcDFkU FTrSdYIyG09rkRiTuxSXR6zcBIK9wwSBX5jP1n4nG/p/FbOFkXgcjJJ6wP6GzRp90jOw n1Eg== X-Gm-Message-State: ANoB5pmrVIMfI0gORwl/LXWGKIlzWZc5bB5GOdM8YS/y9SXXIF33272w Wh1uQr+qS9IT3BtLJAQd/CEQv60NCPSt0Q== X-Google-Smtp-Source: AA0mqf4sd6mLpqqojBorwf5IocHzx1AP/8m6hhhI3sWRsFIJRTCE1EKUQRm/0VqniLlMFLnYi+wpew== X-Received: by 2002:a17:906:7d13:b0:7bc:addd:2c54 with SMTP id u19-20020a1709067d1300b007bcaddd2c54mr31181244ejo.24.1670292580518; Mon, 05 Dec 2022 18:09:40 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09:39 -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 v6 13/15] cmake: only look for "sh" in "C:/Program Files" on Windows Date: Tue, 6 Dec 2022 03:09:11 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 139498c5d5b..9e3e46c93f5 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 Tue Dec 6 02:09:12 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: 13065326 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 5FC31C47089 for ; Tue, 6 Dec 2022 02:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233924AbiLFCKe (ORCPT ); Mon, 5 Dec 2022 21:10:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233844AbiLFCKH (ORCPT ); Mon, 5 Dec 2022 21:10:07 -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 3E99F24BC2 for ; Mon, 5 Dec 2022 18:09:42 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id vp12so2809459ejc.8 for ; Mon, 05 Dec 2022 18:09: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=2xv1B1ji+0XJiZ8hE0aP94bCqA6HfbJJL8lQvuxuS6E=; b=GD6FBn3mNNrpgVQJg3kuhGA1TXFhmGrd34e+36Vh5SIyxmGBOUsUGUrHxwM2RS0v// 7Mb+1BrHrZlOCH1RDsj98sLenPM0CYSSBuXx3JLpLXRvxxdLgunSMfg21zm+YHM5I3Zq I7eNKWDJSkafkOhq8ajVleWLbQGXfuqMJ70kK06RFAuApuj2HXMk47Tw7M6IqAXTkUOF 6FBXk9phIA+MCYNbw2AGlcpE4EylbRQgB5RJsNmwKTxBaFwN5X977G8XFVXCN9yQNy8C V6bk60aZIYOvW6xV5GaLzDh/o73xb1xzNLX3kYcXcldYoYEWxHjuf9OT1NrYSHJJ8KYt ybaw== 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=2xv1B1ji+0XJiZ8hE0aP94bCqA6HfbJJL8lQvuxuS6E=; b=hZhJ3xqkZKaBm3GaPNGv9vUjjpSMb9VQ3/ToCVf1wV4i9AubePexjEhuuux0knsJbL MiOg+T/bFsQYWuiJUidDc4mp8HsyOo99Tl9rkcgkLEuyRV4Ueb6rG61gYgcOkBiYZ77Z SYMnr3BPVcjbrEKFCC5l4AsGQhbmRnaPfpo4xguaHjn+ym91FZANhBHnextE+hq+M2N4 E+RHc1jBWrlJJi8K6CDKYDNEmaJ18d9cXm/u7mm1kQtD6HQ8IzKWpqIRnNjdvs8UVKDp EtODNZGgDCexjyt/sBwNQ3K3/EMkiWpD84XTLoLgJRQowN6J3nBN6XJmZrmUyBZIKRXf 8aKw== X-Gm-Message-State: ANoB5pn90faEH8Qz3drEVkMKBxMN93t/gS10/og7vJnkbCTdN3ockdwP 17vl0mnoQ9kGIfJygqsJdP7T2uEOseU1Pw== X-Google-Smtp-Source: AA0mqf71Yht8wUBKLa9kWUVeVqMAwBvY9e+K2RpPOsa14EsiTaJNwKmIs9zyx9KvK6PerpWXxnssfQ== X-Received: by 2002:a17:906:abcf:b0:7c0:fb28:96ee with SMTP id kq15-20020a170906abcf00b007c0fb2896eemr4407191ejb.660.1670292581550; Mon, 05 Dec 2022 18:09:41 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09: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 v6 14/15] cmake: copy over git-p4.py for t983[56] perforce test Date: Tue, 6 Dec 2022 03:09:12 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 9e3e46c93f5..b1b1f327e95 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -940,6 +940,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 Tue Dec 6 02:09:13 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: 13065328 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 66590C4708E for ; Tue, 6 Dec 2022 02:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233849AbiLFCKi (ORCPT ); Mon, 5 Dec 2022 21:10:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233797AbiLFCKQ (ORCPT ); Mon, 5 Dec 2022 21:10:16 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F34224BF5 for ; Mon, 5 Dec 2022 18:09:44 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id m19so18326892edj.8 for ; Mon, 05 Dec 2022 18:09: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=ZXKj0L/ir8yHB/1jX+Bp4bkPo6AG2/dOPJzImBOqw2g=; b=VIB20vLxOcxQR/YoFqHDBrehBbY5qHZ2F/QzPEprvkG/Xd8kzVDQdXGbnZDZdeRX/J Nh3k3kCiPAtEtq75K9oA9vZ4Unh1IRnxg8APHKsgQQzCnpImeQujICAuHZoRBPyuS7Hj vGGixVtfbipFf42SRkJeNtgLcBnxmmga4AAO41GXf2Hf3tZle52qnbe35vbzs3CGNy8Q E4mgMiy61cZYSXgxdjK9W032LKj4qXXcnhXirLoyPHsJRrPRN38wae8Wv4Blh2SfU0nN AgoOfn7AnK2R2asINV7jIO6K21WmSf/P1PLRq58+Fuzxidc/o2Di7fS3mGnwmNtUSNHS 0Ptg== 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=ZXKj0L/ir8yHB/1jX+Bp4bkPo6AG2/dOPJzImBOqw2g=; b=IbNc4bCc3NjbP2hpTsw6S5N3enfT27bjgmg2VxzJZfwyRzG1cpf4UepIN0K56AkNk/ 1TIrYGTj9wufrdm8q+71MkVw6LVyn8sQv2vs+sxE63RnVWGgrYil2ofa3p1pJbhiAC3G BTcmwDphutpcXEuUsE/3hSkwK8w8fNt9wAv9BNXKFFlruPjjvxxO+zupiWMzWrvgQ3DN ASrvXkS2lSnqzWjSWP1dU4I4ZZJrElyIGLcaTZbMHFHm/WdklHi2XvcNkMq2tiUS0V5p /FB8mARe0iTjsYj9//05kCaK7LvrAPWoqdwZPGY/DGwChXwKq84+Ir/UrE4lDuC7c8YU uabA== X-Gm-Message-State: ANoB5pkd3XNWWebUtBpxzu/LqZdPUMOanddtB1Q6kCs1qwkO7hxMroY1 GIFgfJzjgEXMKMh/uEUFXR+P7f5EDjK89A== X-Google-Smtp-Source: AA0mqf4qIHMHkP3mUqkZJh8duuxkS6Y12G87wj8XrdBWvmCWoRSY8jat6lCRp1z+Qf0N1rrlReyx2Q== X-Received: by 2002:aa7:c756:0:b0:46b:7038:b1f9 with SMTP id c22-20020aa7c756000000b0046b7038b1f9mr28780094eds.306.1670292582418; Mon, 05 Dec 2022 18:09:42 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id o3-20020a170906768300b007c099174a12sm6966186ejm.178.2022.12.05.18.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 18:09: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 v6 15/15] CI: add a "linux-cmake-test" to run cmake & ctest on linux Date: Tue, 6 Dec 2022 03:09:13 +0100 Message-Id: X-Mailer: git-send-email 2.39.0.rc1.1006.gb4c675778ba 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 | 11 +++++++++-- 2 files changed, 12 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..339962bc7c1 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -12,6 +12,7 @@ esac run_tests=t +mc= case "$jobname" in linux-gcc) export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main @@ -43,12 +44,18 @@ pedantic) export DEVOPTS=pedantic run_tests= ;; +linux-cmake-ctest) + cb=contrib/buildsystems + group CMake cmake -S "$cb" -B "$cb/out" + mc="-C $cb/out" + ;; esac -group Build make +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