Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3092663pxb; Mon, 4 Apr 2022 07:38:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6efITaE/c3oJqyIHlgdRR8IditWtmBkVyFV+Bh6ySsw5Ob6epoT8yDkQdlvLvIAOjlNOB X-Received: by 2002:a17:907:3d93:b0:6e7:ff3b:df29 with SMTP id he19-20020a1709073d9300b006e7ff3bdf29mr367689ejc.638.1649083084178; Mon, 04 Apr 2022 07:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649083084; cv=none; d=google.com; s=arc-20160816; b=oHzTvhg006D7It7FDX8A5/ECh7PLaU3gn7icvBD286NSeidrgBtBvLivrdp9lV1WTe 9unQwaJwKB0/D/nDkuGPmJEF3FdROzg6IkdihVeHmqExBhNqOY2LeOLGMhw49BAyEUMY wVQcAdDpUdOdCr1xMHRJ4ebbLb2AQdowm1PRbON3slmHpatAa205FiOglr/jTZiIBqZ0 MAqvOcWX6615rWdd82Onf2VbCJwLXwTN4DTJbpPrg74jAsFpv6MXLhMoYtjeo5v6P6fb 2JaSMp+Up7j5/FkWzjX9lhzeppS1lZ8lzaMDhef4KkVG0FljhXub/I2AneJEJ1zJIniD ge/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tIgHyqz4/1sXAHyLaXGAJ7Tj9MXYOswEHmYuO4dH3gU=; b=DHoBw84JrrIMlkfhcnHnqRdpcjVXBMldL7yplvWRdTo0RQ9ndXuuPNRs1CMqEXyYmc ZvvTlHTzMQdk51hqOk+wRRZgB+5ivI5A+mp+Q+nXIZgTBEwLsDuTXsdsjkS7V7Q5fj7e Si6pZfK5/0h9tdRsxZay7VsYmZAfJEqrDsjpxdp5HZPSN/iGJljAGXMGF8kn6DgJvka8 DEHoMcAowpvjJzZBNK16UDVLS7Aq/WQLPt1WkyFAVVmdSigxCR8Fp8+V76m5nNQttnT2 pcitgD83383ZEyJSVRy5H9LnYUFBOmjxuz5xyPyVi1awkB8oWS2nC1awNJc77DHzXPyL 1DRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Px6/sfJA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qx4-20020a170906fcc400b006e7fc0eed1dsi1117763ejb.112.2022.04.04.07.37.35; Mon, 04 Apr 2022 07:38:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Px6/sfJA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376763AbiDDAEz (ORCPT + 99 others); Sun, 3 Apr 2022 20:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbiDDAEy (ORCPT ); Sun, 3 Apr 2022 20:04:54 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3FE532EDF; Sun, 3 Apr 2022 17:02:59 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id 14so5730001ily.11; Sun, 03 Apr 2022 17:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tIgHyqz4/1sXAHyLaXGAJ7Tj9MXYOswEHmYuO4dH3gU=; b=Px6/sfJAAtEoSKD0CVO1B4ZRLpKaIJHiDZoNGpmq+5Y5oHAehZsqm5OoKB4XKSzqA2 HmQ455NW9KXiJp163PyBCcq2mGmwQPu6oZwkO8aqo3WKpOFaVUdvgxEZgtV5UcabAlSj eEKFVaLBNAw+FqL4aYqYLrMw9nWsY0BpJaZJnKUEDxPKuEB1cEEW1OIqgRhabwqb3lWy r1XYJD2+x3OaTcYqECEVZW3pqi2Z5jVV6nY8w7R2K3prpixyP7yIKMbWz3ZhqRmUMQ5Y NL7RK2NxveFQRc1fYLe0rEWYXt2WHlfbRnlp6ryJyIpDOLqLOgIIt5cuSmb9ZqQeEn7x ih9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tIgHyqz4/1sXAHyLaXGAJ7Tj9MXYOswEHmYuO4dH3gU=; b=IvuGLZwd3oZCKxsqxlFbjOXWD4mM2Ur1lDD+MsUmYmI1I7p4lhZlsUso7/dunN22RU DBTmXO7bDA3smLO/FhH8o1DSTEEWMwJf8KGPK2FWaVJOJ/WNp7C2IzelBW8lBEp1pimB z5Icb3KRlSjdzEqrAUquhRmGF9+0byXxHMBpG8UDGPXCFgvnuCsIUywPVF2+PDk3ROIT YDPsl+2HzXie2K/EnpVgWBkXWiTKz86yYmZn9t/tJ9ieRAVBeddqPKPgA05WFe7EVQ+n 3AFe3kK9CWBqTbHaJD6YJWFCz+UwWN07S9mkZkSfoK8vrYqTvGpBKZf5zew/Oj071VPS jlIw== X-Gm-Message-State: AOAM532NXFoyP8k9iZI3M7DGAKZ/DyIVjMIZ0qts1+KPs/mGDWoleci3 8TMDz/+5FZkWOrsJlIR2urINLf4LBTgWpSk4PTGcZfhi X-Received: by 2002:a92:cd89:0:b0:2c9:bdf3:c5dd with SMTP id r9-20020a92cd89000000b002c9bdf3c5ddmr4035472ilb.252.1649030579155; Sun, 03 Apr 2022 17:02:59 -0700 (PDT) MIME-Version: 1.0 References: <20220403135245.1713283-1-ytcoode@gmail.com> In-Reply-To: <20220403135245.1713283-1-ytcoode@gmail.com> From: Andrii Nakryiko Date: Sun, 3 Apr 2022 17:02:48 -0700 Message-ID: Subject: Re: [PATCH bpf-next] selftests/bpf: Fix cd_flavor_subdir() of test_progs To: Yuntao Wang Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , Networking , bpf , open list , "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 3, 2022 at 6:53 AM Yuntao Wang wrote: > > Currently, when we run test_progs with just executable file name, for > example 'PATH=. test_progs-no_alu32', cd_flavor_subdir() will not check First time seeing this PATH=. trick just to avoid ./test_progs-no_alu32, but sure, the fix makes sense. Applied to bpf-next. > if test_progs is running as a flavored test runner and switch into > corresponding sub-directory. > > This will cause test_progs-no_alu32 executed by the > 'PATH=. test_progs-no_alu32' command to run in the wrong directory and > load the wrong BPF objects. > > Signed-off-by: Yuntao Wang > --- > tools/testing/selftests/bpf/test_progs.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c > index 2ecb73a65206..0a4b45d7b515 100644 > --- a/tools/testing/selftests/bpf/test_progs.c > +++ b/tools/testing/selftests/bpf/test_progs.c > @@ -761,8 +761,10 @@ int cd_flavor_subdir(const char *exec_name) > const char *flavor = strrchr(exec_name, '/'); > > if (!flavor) > - return 0; > - flavor++; > + flavor = exec_name; > + else > + flavor++; > + > flavor = strrchr(flavor, '-'); > if (!flavor) > return 0; > -- > 2.35.1 >