public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
Cc: fstests@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-xfs@vger.kernel.org, ritesh.list@gmail.com,
	ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org
Subject: Re: [PATCH v3 5/6] common/config: Introduce _exit wrapper around exit command
Date: Wed, 9 Apr 2025 10:44:02 +1000	[thread overview]
Message-ID: <Z_XC0sMObxxHOWM5@dread.disaster.area> (raw)
In-Reply-To: <37155b56-34ba-4d5d-a023-242abbe525b5@gmail.com>

On Tue, Apr 08, 2025 at 10:13:54PM +0530, Nirjhar Roy (IBM) wrote:
> On 4/8/25 17:05, Dave Chinner wrote:
> > On Tue, Apr 08, 2025 at 05:37:21AM +0000, Nirjhar Roy (IBM) wrote:
> > > diff --git a/common/config b/common/config
> > > index 79bec87f..eb6af35a 100644
> > > --- a/common/config
> > > +++ b/common/config
> > > @@ -96,6 +96,14 @@ export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
> > >   export RECREATE_TEST_DEV=${RECREATE_TEST_DEV:=false}
> > > +# This functions sets the exit code to status and then exits. Don't use
> > > +# exit directly, as it might not set the value of "status" correctly.
> > > +_exit()
> > > +{
> > > +	status="$1"
> > > +	exit "$status"
> > > +}
> > The only issue with putting this helper in common/config is that
> > calling _exit() requires sourcing common/config from the shell
> > context that calls it.
> > 
> > This means every test must source common/config and re-execute the
> > environment setup, even though we already have all the environment
> > set up because it was exported from check when it sourced
> > common/config.
> > 
> > We have the same problem with _fatal() - it is defined in
> > common/config instead of an independent common file. If we put such
> > functions in their own common file, they can be sourced
> > without dependencies on any other common file being included first.
> > 
> > e.g. we create common/exit and place all the functions that
> > terminate tests in it - _fatal, _notrun, _exit, etc and source that
> > file once per shell context before we source common/config,
> > common/rc, etc. This means we can source and call those termination
> > functions from any context without having to worry about
> > dependencies...
> 
> Yes, I agree to the above. Do you want this refactoring to be done as a part
> of this patch series in the further revisions, or can this be sent as a
> separate series?

Seperate series is fine. You're not making the dependency mess any
worse than it already is with this change...

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2025-04-09  0:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08  5:37 [PATCH v3 0/6] Minor cleanups in common/ Nirjhar Roy (IBM)
2025-04-08  5:37 ` [PATCH v3 1/6] generic/749: Remove redundant sourcing of common/rc Nirjhar Roy (IBM)
2025-04-08  5:37 ` [PATCH v3 2/6] generic/367: Remove redundant sourcing if common/config Nirjhar Roy (IBM)
2025-04-08  9:06   ` Ritesh Harjani
2025-04-09  5:04   ` Zorro Lang
2025-04-08  5:37 ` [PATCH v3 3/6] check: Remove redundant _test_mount in check Nirjhar Roy (IBM)
2025-04-08  5:37 ` [PATCH v3 4/6] check,common{rc,preamble}: Decouple init_rc() call from sourcing common/rc Nirjhar Roy (IBM)
2025-04-08  5:37 ` [PATCH v3 5/6] common/config: Introduce _exit wrapper around exit command Nirjhar Roy (IBM)
2025-04-08  9:13   ` Ritesh Harjani
2025-04-08 16:15     ` Nirjhar Roy (IBM)
2025-04-08 16:32       ` Darrick J. Wong
2025-04-08 16:35         ` Nirjhar Roy (IBM)
2025-04-08 11:35   ` Dave Chinner
2025-04-08 16:43     ` Nirjhar Roy (IBM)
2025-04-09  0:44       ` Dave Chinner [this message]
2025-04-09  7:07         ` Nirjhar Roy (IBM)
2025-04-08  5:37 ` [PATCH v3 6/6] common: exit --> _exit Nirjhar Roy (IBM)

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=Z_XC0sMObxxHOWM5@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nirjhar.roy.lists@gmail.com \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=zlang@kernel.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