From patchwork Mon Sep 6 04:20:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 12476279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8BDCC433F5 for ; Mon, 6 Sep 2021 04:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F57261029 for ; Mon, 6 Sep 2021 04:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234748AbhIFEVO (ORCPT ); Mon, 6 Sep 2021 00:21:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234281AbhIFEVO (ORCPT ); Mon, 6 Sep 2021 00:21:14 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C2FC061757 for ; Sun, 5 Sep 2021 21:20:09 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id m2so3605006wmm.0 for ; Sun, 05 Sep 2021 21:20:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:mime-version :content-transfer-encoding:fcc:to:cc; bh=X72Y2JXlkRf06MadaeInEifKFENsLmUYZCAf8FbSmSA=; b=IqXUwfenDpyVI+SQeQBVKB+DVwFn8mVIX/YljpnJiu6CbxkL8INcAAzwZEm/XQfnj4 Q51Pdh9eOcUQNXlzHuWL+sTI9FMMQYom+4OEYpVrMlbCpfruT2exLdXia/eYHt6Nu9v5 QOYYJqz3ZrVuNfAzsukQ9NTzFfQNm1/N0wiHrhGBw/KmNJQLBUK0Yp/7/MsKNrSn5Uom VwkPcuWNaCV99MDZm19UklXTFZwch024xgBeL0lbDyUjK0A3fgi4a1HK1+ci109LS1JK Meyl9XBtWI4ROu6MAUaEq2XZQRBuGqCR9QDlxtmpuqQoFArEnKZdQu+JEcmrn6ncCcpC SIng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:mime-version:content-transfer-encoding:fcc:to:cc; bh=X72Y2JXlkRf06MadaeInEifKFENsLmUYZCAf8FbSmSA=; b=bkRUOL5PSBUxXJPMjfBvTgCxKRsKGYK5ESYW9Sa07L7Wbcpt39EFNI2fOPG7AdILrw Eygwc3vkvicM4Dn98OisvY6gSptkj9zlfxi5oPia+qa/J2TiayvfVE3FmHVEVXGZYq5s tYhV2JpcRk5iivmZcVnP2Pzj8JSewo6VTx8JhSEY0gggJ72AbNGxMJcVdzQFVAHvr2pP ahr6gepwvOXR8wAHm90E/P2Y7NKdOiDs4NH9S0n+azxq7Q3ys5JI04R12beSOg/xdFbJ ufrbrUTA+gqqjvH8NSxBDh+YZg82xuOmklyoAdgGt1sMZMrep+2e8ro/NVtK8ksq2tqo ujhQ== X-Gm-Message-State: AOAM531WJ01LykOTYpu6CuI96shoVJ2/qttlM4yLWwko5bEJGqW9SexY xWlefbq+orvVbqp4eKlRBvmT3l3+q0M= X-Google-Smtp-Source: ABdhPJzPx0Zvjj5iSyDgxiZHBRRPasnofaxdRG2GK4UC5mfDEvDothCKCNcoulEi8Y8pdyLmpcETmA== X-Received: by 2002:a1c:a783:: with SMTP id q125mr9222592wme.77.1630902008541; Sun, 05 Sep 2021 21:20:08 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y15sm7376279wmi.18.2021.09.05.21.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 21:20:08 -0700 (PDT) Message-Id: <2f566f330e01ed4249edad54671e98301dbeec5a.1630902006.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Mon, 06 Sep 2021 04:20:04 +0000 Subject: [PATCH v4 1/3] test-lib-functions: use 'TEST_SHELL_PATH' in 'test_pause' MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: SZEDER =?utf-8?b?R8OhYm9y?= , Elijah Newren , Johannes Schindelin , Jens Lehmann , Eric Sunshine , Taylor Blau , Carlo Arenas , Jeff King , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain 3f824e91c8 (t/Makefile: introduce TEST_SHELL_PATH, 2017-12-08) made it easy to use a different shell for the tests than 'SHELL_PATH' used at compile time. But 'test_pause' still invokes 'SHELL_PATH'. If TEST_SHELL_PATH is set, invoke that shell in 'test_pause' for consistency. Suggested-by: Carlo Marcelo Arenas Belón Signed-off-by: Philippe Blain --- t/test-lib-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index e28411bb75a..1884177e293 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -139,7 +139,7 @@ test_tick () { # Be sure to remove all invocations of this command before submitting. test_pause () { - "$SHELL_PATH" <&6 >&5 2>&7 + "$TEST_SHELL_PATH" <&6 >&5 2>&7 } # Wrap git with a debugger. Adding this to a command can make it easier From patchwork Mon Sep 6 04:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 12476281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8334C433F5 for ; Mon, 6 Sep 2021 04:20:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABBBA60FBF for ; Mon, 6 Sep 2021 04:20:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238091AbhIFEVX (ORCPT ); Mon, 6 Sep 2021 00:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234514AbhIFEVO (ORCPT ); Mon, 6 Sep 2021 00:21:14 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABE7DC061575 for ; Sun, 5 Sep 2021 21:20:10 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id q11so7710112wrr.9 for ; Sun, 05 Sep 2021 21:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=ZghqnjUMTOJqieudxaed7aADlrHH4VJ7f9c2Txe4F3Y=; b=KH3NkYGGf1I1RnCVNjTOj9bRroenBUa0r3NGNZI76I2BpiuNKNSfgBWxaQKI2ujFpi vbTdV5cSwzFi8NhNzOA0ulZr9zzDg/mjsJ08AD0/jJYHceotRUa/17QErUpXXCaS3dLV tDAbD06gTktt2gi59rFWw5VfJ8VzYihpDQmthBoJJn53aeqg7o1p4Hol9XwczURHwYEW rI/SEDwdvCQpfsdHnTtb+ewcVbozlGPl86XEvxOZHVl7gEFjQQ/NEiwwm8IZGIT/+OsH aYwbgESpAcZ2h49U8GFVgSL2YykAlzcZSG1Ol4NIBjOQlvK6IAVWyvtuOuGlMiwbHkeN h3OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=ZghqnjUMTOJqieudxaed7aADlrHH4VJ7f9c2Txe4F3Y=; b=lsgufDts1Dwzl47wF7xWTQoLserAlJz+L6rD5ikRpmORsJrqDnhOHVWa6OMVJ54INv zwjQuIvJm/kCWhbiekpUgtLcLQMOfT1cgVv/7NuYi38jc/mOrWk29arEOEl5iicPw8d1 Sa1T+YYlr2/DORNXzqRvAZdIOrQBFwT0nE9mgGPE8PYa+DZeMSQrugi/sTu8BCB8MoFS 6hg6IOBYKv5ihM0fL6WnMNJkSq3WYkkk1sg2z5CZYkYEMTcvaoIy9D2ZR50NHFdj3iTv NtPsSet7i+QdItI11EvJ7KOnriePmgUZfxu953i9CKaK7WT9dtXFRTXSD8JACJqfRUuC EAPA== X-Gm-Message-State: AOAM5325ExfVOpcws+OksWe0qE6H/i6M2pZ6/Z1WyjRALqQvP+SbKudp LqE/aV3b4RSEFzEPTuqcIl/Ms7FrnZ0= X-Google-Smtp-Source: ABdhPJwPZnF5jHNLIGAmoup2rmiUvVgWVXIn192BJ/zNu50scNAvNKio/+KTOS1qrCxaEG42hCNrsw== X-Received: by 2002:adf:eb4b:: with SMTP id u11mr11193102wrn.327.1630902009280; Sun, 05 Sep 2021 21:20:09 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a6sm6670143wrh.97.2021.09.05.21.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Sep 2021 21:20:08 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Mon, 06 Sep 2021 04:20:05 +0000 Subject: [PATCH v4 2/3] test-lib-functions: optionally keep HOME, TERM and SHELL in 'test_pause' Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: SZEDER =?utf-8?b?R8OhYm9y?= , Elijah Newren , Johannes Schindelin , Jens Lehmann , Eric Sunshine , Taylor Blau , Carlo Arenas , Jeff King , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain The 'test_pause' function, which is designed to help interactive debugging and exploration of tests, currently inherits the value of HOME and TERM set by 'test-lib.sh': HOME="$TRASH_DIRECTORY" and TERM=dumb. It also invokes the shell defined by TEST_SHELL_PATH, which defaults to /bin/sh (through SHELL_PATH). Changing the value of HOME means that any customization configured in a developers' shell startup files and any Git aliases defined in their global Git configuration file are not available in the shell invoked by 'test_pause'. Changing the value of TERM to 'dumb' means that colored output is disabled for all commands in that shell. Using /bin/sh as the shell invoked by 'test_pause' is not ideal since some platforms (i.e. Debian and derivatives) use Dash as /bin/sh, and this shell is usually compiled without readline support, which makes for a poor interactive command line experience. To make the interactive command line experience in the shell invoked by 'test_pause' more pleasant, save the values of HOME and TERM in USER_HOME and USER_TERM before changing them in test-lib.sh, and add options to 'test_pause' to optionally use these variables to invoke the shell. Also add an option to invoke SHELL instead of TEST_SHELL_PATH, so that developer's interactive shell is used. We use options instead of changing the behaviour unconditionally since these three variables can slightly change command behaviour. Moreover, using the original HOME means commands could overwrite files in a user's home directory. Be explicit about these caveats in the new 'Usage' section in test-lib-functions.sh. Finally, add '[options]' to the test_pause synopsys in t/README, and mention that the full list of helper functions and their options can be found in test-lib-functions.sh. Helped-by: Elijah Newren Signed-off-by: Philippe Blain --- t/README | 5 +++-- t/test-lib-functions.sh | 47 ++++++++++++++++++++++++++++++++++++++++- t/test-lib.sh | 6 ++++-- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/t/README b/t/README index 9e701223020..cc8be6e67ad 100644 --- a/t/README +++ b/t/README @@ -753,7 +753,8 @@ Test harness library -------------------- There are a handful helper functions defined in the test harness -library for your script to use. +library for your script to use. Some of them are listed below; +see test-lib-functions.sh for the full list and their options. - test_expect_success []