Re: [PATCH v3 3/4] t7005: sanitize test environment for subsequent tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 11, 2025 at 6:34 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>
> On Mon, Aug 11, 2025 at 6:17 PM D. Ben Knoble
> <ben.knoble+github@xxxxxxxxx> wrote:
> > Some of the editor tests manipulate the environment or config in ways
> > that affect future tests, but those modifications are visible to future
> > tests and create a footgun for them.
> >
> > Use test_config, subshells, single-command environment overrides, and
> > test helpers to automatically undo environment and config modifications
> > once finished.
> >
> > Signed-off-by: D. Ben Knoble <ben.knoble+github@xxxxxxxxx>
> > ---
> > diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh
> > @@ -34,61 +34,57 @@
> > -TERM=dumb
> > -export TERM
> >  test_expect_success 'dumb should error out when falling back on vi' '
> > -       test_must_fail git commit --amend
> > +       TERM=dumb test_must_fail git commit --amend
> >  '
>
> Don't use one-shot environment variable assignments when calling shell
> functions. Instead, you can do this:
>
>     test_env TERM=dumb test_must_fail git commit --amend
>
> or employ the standard assignment/export boilerplate:
>
>     TERM=dumb &&
>     export TERM &&
>     test_must_fail git commit --amend
>
> References:
> https://lore.kernel.org/git/20240727053509.34339-1-ericsunshine@xxxxxxxxxxx/T/#u
> https://lore.kernel.org/git/20180713055205.32351-1-sunshine@xxxxxxxxxxxxxx/T/#u

Yep ;) I had the latter, switched (see range-diff, I think), and then
CI caught me. Why doesn't the local test run catch it, though?





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux