linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brendan Higgins <brendanhiggins@google.com>
To: Daniel Latypov <dlatypov@google.com>
Cc: David Gow <davidgow@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2 4/4] minor: kunit: tool: fix unit test so it can run from non-root dir
Date: Thu, 14 Jan 2021 14:15:34 -0800	[thread overview]
Message-ID: <CAFd5g45zCc03uR1G1XBBKTfN_84Xdybn6h1N=w_L75uHJiVriA@mail.gmail.com> (raw)
In-Reply-To: <20201202190824.1309398-4-dlatypov@google.com>

On Wed, Dec 2, 2020 at 11:09 AM Daniel Latypov <dlatypov@google.com> 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/<file>'
>
> 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 <dlatypov@google.com>

Tested-by: Brendan Higgins <brendanhiggins@google.com>
Acked-by: Brendan Higgins <brendanhiggins@google.com>

  parent reply	other threads:[~2021-01-14 22:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 19:08 [PATCH v2 1/4] kunit: tool: fix unit test cleanup handling Daniel Latypov
2020-12-02 19:08 ` [PATCH v2 2/4] kunit: tool: stop using bare asserts in unit test Daniel Latypov
2020-12-03  3:05   ` David Gow
2021-01-14 22:22   ` Brendan Higgins
2020-12-02 19:08 ` [PATCH v2 3/4] kunit: tool: use `with open()` " Daniel Latypov
2020-12-03  3:06   ` David Gow
2021-01-14 22:19   ` Brendan Higgins
2020-12-02 19:08 ` [PATCH v2 4/4] minor: kunit: tool: fix unit test so it can run from non-root dir Daniel Latypov
2020-12-03  3:06   ` David Gow
2021-01-14 22:15   ` Brendan Higgins [this message]
2020-12-03  3:05 ` [PATCH v2 1/4] kunit: tool: fix unit test cleanup handling David Gow
2020-12-03  5:15   ` Daniel Latypov
2021-01-14 22:24 ` Brendan Higgins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFd5g45zCc03uR1G1XBBKTfN_84Xdybn6h1N=w_L75uHJiVriA@mail.gmail.com' \
    --to=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).