From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 45ACB1F4B4 for ; Sat, 23 Jan 2021 21:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726264AbhAWVHx (ORCPT ); Sat, 23 Jan 2021 16:07:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbhAWVHv (ORCPT ); Sat, 23 Jan 2021 16:07:51 -0500 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C03C0613D6 for ; Sat, 23 Jan 2021 13:07:10 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id o18so6868329qtp.10 for ; Sat, 23 Jan 2021 13:07:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=i//gTJdCEJfBXfS5HiHrjvNxBCz2IgCFSkyq8YOmVqc=; b=t10vViwDd47p1mOq2Ma0LuPOexnjXMrPfPVgm50PwsZM19t6IPAqAO5O3evN/FzAUc w6s6SiZ8QxaRnPXTdGyJ0FfOpDGPKEmXJvhq4A4NMSZmVZ4I6KkWTf5RdXXCjZtrfUwg VzvKhJUYi5M8KlxqAKma1LUDuQa4PbBiSt3wlwI646MEUMkq+7m4eVeL9Xm8dVg+8UB6 os6dltnYA4/yPzr9vq0N2vB8Eyz/oAonrKglG7rhvcJ52c8bWzxN6H9glgnaYrKFkTZX BGo0RgVudY2B/gXDXJHgR1Oln6nFTxyOlKxP9Ygz5Uw789nQk58LmYD/kNO0unMxXxa4 u6dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=i//gTJdCEJfBXfS5HiHrjvNxBCz2IgCFSkyq8YOmVqc=; b=TL2HZVO9tuyxG3zn/LoB29T+KRhEXijgPii4woASKfBJuZjlNZpUguA4OpkMc0dXzI Nz/3vwFNuHLkY699UDE7xUtDuiniqLpjEdATRmfR0S/Xr/HAAF2jZF9P4Hm9nH0Pec/z CQT+vAz59BXp8B7mpkIBacuLJmCb9I8PUW1pvqaEcCBdJHGNuvOyPtl5euUMDF3guSqm F+yCi8o3Qm4h6nTALT1w6XCIKCBwadjnQYWXEldHVP2zWfxZr69EWwkvlW42dk+hvpMb FWxNhUw5IERvPsRdZPWgmFsNBrJ44pchjqrzSiEeE1dtksK/vevTu3fS43O2jazS7ABR EEfg== X-Gm-Message-State: AOAM531f1rbqx6Xy/1ZQiZGjcFn6cCVBOWgp0jpHiuej+K21BlvFgtDG SAHJfSaQyt1mBx3WTwsoTeQF5nRrzK6JTA== X-Google-Smtp-Source: ABdhPJyEhpXE5xKjflOEFVkQBlJcavm1CCKnArq4Iv1aTWSkU9IZ8yuSlFk2dlYLe77RJhRS/ouXgg== X-Received: by 2002:ac8:5a82:: with SMTP id c2mr1882180qtc.90.1611436029882; Sat, 23 Jan 2021 13:07:09 -0800 (PST) Received: from ?IPv6:2600:1700:e72:80a0:98e8:103:e6ee:9536? ([2600:1700:e72:80a0:98e8:103:e6ee:9536]) by smtp.gmail.com with UTF8SMTPSA id p26sm1193118qkk.6.2021.01.23.13.07.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Jan 2021 13:07:09 -0800 (PST) Subject: Re: [PATCH v3 8/9] test-lib: test_region looks for trace2 regions To: Derrick Stolee via GitGitGadget , git@vger.kernel.org Cc: newren@gmail.com, gitster@pobox.com, Derrick Stolee , Derrick Stolee References: From: Derrick Stolee Message-ID: <096e2969-60d2-3ebe-3855-a9c954ebd07e@gmail.com> Date: Sat, 23 Jan 2021 16:07:08 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Thunderbird/85.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On 1/23/2021 2:58 PM, Derrick Stolee via GitGitGadget wrote: ... > + if test $exitcode != $expect_exit = 1] ... > + if test $exitcode != $expect_exit = 1] As Elijah pointed out, these lines are bogus. I'm not sure how they passed the tests without failure, but here is a replacement for this patch: --- >8 --- >From ff15d509b89edd4830d85d53cea3079a6b0c1c08 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 11 Jan 2021 08:53:09 -0500 Subject: [PATCH 8/9] test-lib: test_region looks for trace2 regions Most test cases can verify Git's behavior using input/output expectations or changes to the .git directory. However, sometimes we want to check that Git did or did not run a certain section of code. This is particularly important for performance-only features that we want to ensure have been enabled in certain cases. Add a new 'test_region' function that checks if a trace2 region was entered and left in a given trace2 event log. There is one existing test (t0500-progress-display.sh) that performs this check already, so use the helper function instead. Note that this changes the expectations slightly. The old test (incorrectly) used two patterns for the 'grep' invocation, but this performs an OR of the patterns, not an AND. This means that as long as one region_enter event was logged, the test would succeed, even if it was not due to the progress category. More uses will be added in a later change. t6423-merge-rename-directories.sh also greps for region_enter lines, but it verifies the number of such lines, which is not the same as an existence check. Signed-off-by: Derrick Stolee --- t/t0500-progress-display.sh | 3 +-- t/test-lib-functions.sh | 42 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh index 1ed1df351c..84cce345e7 100755 --- a/t/t0500-progress-display.sh +++ b/t/t0500-progress-display.sh @@ -303,8 +303,7 @@ test_expect_success 'progress generates traces' ' "Working hard" stderr && # t0212/parse_events.perl intentionally omits regions and data. - grep -e "region_enter" -e "\"category\":\"progress\"" trace.event && - grep -e "region_leave" -e "\"category\":\"progress\"" trace.event && + test_region progress "Working hard" trace.event && grep "\"key\":\"total_objects\",\"value\":\"40\"" trace.event && grep "\"key\":\"total_bytes\",\"value\":\"409600\"" trace.event ' diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 999982fe4a..9fc4cf8476 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1655,3 +1655,45 @@ test_subcommand () { grep "\[$expr\]" fi } + +# Check that the given command was invoked as part of the +# trace2-format trace on stdin. +# +# test_region [!]