Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp618478pxb; Thu, 14 Jan 2021 14:18:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZy4G6lCb52tnHW9goi15aavIAnCdDReAdhtZociH7sEHRtaPGiuVhyh2RW7xtjR0kv59/ X-Received: by 2002:a05:6402:4251:: with SMTP id g17mr7087580edb.205.1610662685410; Thu, 14 Jan 2021 14:18:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610662685; cv=none; d=google.com; s=arc-20160816; b=DfI15cjkylXPTJPgcHriD/sXhErDz6eYDJIepRBz6eBVG6KzCnCHSNxbvBZXZPGQO1 K0+05kNu2gaaq2MGyVUydqxwld/9cuJY0njEvkFmVTIGxy0oYl1MGA3vbMNG7KJdvyec jKfz0gKUDF7qnG+jH2xGyfw1DdLZ3oeh4cpbWBBHhMyvSoCKJrWL7wCOJbK/tCbGaiYz HOLTrTjx97hSc6/W7G4SvvDby45WtRCOKBVYfFFQiRPSDZEjO+QpChv1FicFSdoMAXs2 XmOXJ/LdBUYsH2K30v1QXdB4GvXSasJUp2YgdAv8pjot1dXPld6vFUgHyOI6wisSQuBv HmIA== 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=viLqZ1oTiB1mDCbGax90NixXMd2O9e+6OHhtAzYjF2A=; b=QixGXWqeFEu5pAUNFWUA/MHGWuqHACYiwgTvtIXbpDfcP5hpeWAoH/J5zdBm85o/kS YhZSoSftsCdKj6cWuZHlrLo+kuLIBrPzz0lKuG62Qqrf7fHTRQ8flU6Kw2VRhSh9gprO n8lk/8NzsYDbXPyQFxJV9Xhqfw01tAZ4nhhsap9gJKNZn1KauAxlM0cWI8xwR7F4UIje keoAZnK5XxEL3+7z6quJQmkLqW7yOyIZkpcgm2UQPeVEGRQaLN1Jx0q5Rnnn1tWMS1ze gOO/g7qNtl1kp7Kh5pWEdP65AevId/ix0nnRFWXIkvevZx5s1evVtHsikFpzzmKdI+iX y4cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oUPemRik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn16si2790623edb.73.2021.01.14.14.17.42; Thu, 14 Jan 2021 14:18:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oUPemRik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730619AbhANWQg (ORCPT + 99 others); Thu, 14 Jan 2021 17:16:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730493AbhANWQZ (ORCPT ); Thu, 14 Jan 2021 17:16:25 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9099C061757 for ; Thu, 14 Jan 2021 14:15:45 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id c13so4186796pfi.12 for ; Thu, 14 Jan 2021 14:15:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=viLqZ1oTiB1mDCbGax90NixXMd2O9e+6OHhtAzYjF2A=; b=oUPemRikyZUvUOElbPoojMzBdbT4dCyMi7+RXYhDRSc68BJxat5t8JS0KfqE8Shzyy DGFsxMLewaaVkOzeS1k4hbeQxU/IgHuLA8H3TdlsXJVnA/7f6yAp0QumEqT3CGCr+Veq ZX+f8TqwWku2Xwy1pXKFktaCAF0IRlHTmnuUA6+YNrqpqwxDYcVRBOFwnzquB6eBGd8T h8aSxfceZt9JLwDHKU10WXXaSI8aEbTNZXFNvWDBMZ2e8EpUhE+uDljRspQbRoBpYrs/ ZSMx+JnDJqFuZpV45jmNsFcTMSDwUAoby1E3dRrTpkPKIqEi4Aa03l+jxlYW8YEoemXu WyaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=viLqZ1oTiB1mDCbGax90NixXMd2O9e+6OHhtAzYjF2A=; b=r6tNmlqp2T9vucao+eNaSANn/E5x6oLNLPzaElZgbTWf4mheAMC0rURZNnnpabSkJp zygvHfv7x6fd4BHpiPvT1bpOPFlTAvfgHI+4fyhVwm07QXOrH/abSu4vyDr3uNbO6daA vBP1HqbnCV5gfFMKqae/wmvMi6m0TwzHkm0avKEGLyisbRyEAkVNhTl2Vx8q9npmIkHX +pm24GwNrYmkvL0oBJOWTI4prqVNEnMb+maQD/7SCp42mS2gfr0xA6DFC4LXbMtUZYQI Ie5XrP7PyyPGxT2I5piFc9Fnrzpg7NrmGEqZ1HewHQ9suAKljs6rHkySP2d4QwUFVfvQ x2FQ== X-Gm-Message-State: AOAM532LX+rWI+rLhNECVPKp2jN5sobNBVkhwKs/NIhgR9/AS3LaoIPN O4L5U+aMaaUo/TFrQPep4i86o4+VAXYXjP9lWLmpYw== X-Received: by 2002:a63:c84a:: with SMTP id l10mr9672013pgi.159.1610662545004; Thu, 14 Jan 2021 14:15:45 -0800 (PST) MIME-Version: 1.0 References: <20201202190824.1309398-1-dlatypov@google.com> <20201202190824.1309398-4-dlatypov@google.com> In-Reply-To: <20201202190824.1309398-4-dlatypov@google.com> From: Brendan Higgins Date: Thu, 14 Jan 2021 14:15:34 -0800 Message-ID: Subject: Re: [PATCH v2 4/4] minor: kunit: tool: fix unit test so it can run from non-root dir To: Daniel Latypov Cc: David Gow , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 2, 2020 at 11:09 AM Daniel Latypov wrote: > > Also take this time to rename get_absolute_path() to test_data_path(). > > 1. the name is currently a lie. It gives relative paths, e.g. if I run > from the same dir as the test file, it gives './test_data/' > > See https://docs.python.org/3/reference/import.html#__file__, which > doesn't stipulate that implementations provide absolute paths. > > 2. it's only used for generating paths to tools/testing/kunit/test_data/ > So we can tersen things by making it less general. > > Cache the absolute path to the test data files per suggestion from [1]. > Using relative paths, the tests break because of this code in kunit.py > if get_kernel_root_path(): > os.chdir(get_kernel_root_path()) > > [1] https://lore.kernel.org/linux-kselftest/CABVgOSnH0gz7z5JhRCGyG1wg0zDDBTLoSUCoB-gWMeXLgVTo2w@mail.gmail.com/ > > Fixes: 5578d008d9e0 ("kunit: tool: fix running kunit_tool from outside kernel tree") > Signed-off-by: Daniel Latypov Tested-by: Brendan Higgins Acked-by: Brendan Higgins