Zorro Lang <zlang@xxxxxxxxxx> writes: > On Thu, May 01, 2025 at 08:47:46AM +0530, Ritesh Harjani wrote: >> "Nirjhar Roy (IBM)" <nirjhar.roy.lists@xxxxxxxxx> writes: >> >> > Introduce a new file common/exit that will contain all the exit >> > related functions. This will remove the dependencies these functions >> > have on other non-related helper files and they can be indepedently >> > sourced. This was suggested by Dave Chinner[1]. >> > While moving the exit related functions, remove _die() and die_now() >> > and replace die_now with _fatal(). It is of no use to keep the >> > unnecessary wrappers. >> > >> > [1] https://lore.kernel.org/linux-xfs/Z_UJ7XcpmtkPRhTr@xxxxxxxxxxxxxxxxxxx/ >> > Suggested-by: Dave Chinner <david@xxxxxxxxxxxxx> >> > Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@xxxxxxxxx> >> > --- >> > check | 2 ++ >> > common/config | 17 ----------------- >> > common/exit | 39 +++++++++++++++++++++++++++++++++++++++ >> > common/preamble | 3 +++ >> > common/punch | 39 +++++++++++++++++---------------------- >> > common/rc | 28 ---------------------------- >> > 6 files changed, 61 insertions(+), 67 deletions(-) >> > create mode 100644 common/exit >> > >> > diff --git a/check b/check >> > index 9451c350..bd84f213 100755 >> > --- a/check >> > +++ b/check >> > @@ -46,6 +46,8 @@ export DIFF_LENGTH=${DIFF_LENGTH:=10} >> > >> > # by default don't output timestamps >> > timestamp=${TIMESTAMP:=false} >> > +. common/exit >> > +. common/test_names >> >> So this gets sourced at the beginning of check script here. >> >> > >> > rm -f $tmp.list $tmp.tmp $tmp.grep $here/$iam.out $tmp.report.* $tmp.arglist >> > >> <...> >> > diff --git a/common/preamble b/common/preamble >> > index ba029a34..51d03396 100644 >> > --- a/common/preamble >> > +++ b/common/preamble >> > @@ -33,6 +33,9 @@ _register_cleanup() >> > # explicitly as a member of the 'all' group. >> > _begin_fstest() >> > { >> > + . common/exit >> > + . common/test_names >> > + >> >> Why do we need to source these files here again? >> Isn't check script already sourcing both of this in the beginning >> itself? > > The _begin_fstest is called at the beginning of each test case (e.g. generic/001). > And "check" run each test cases likes: > > cmd="generic/001" > ./$cmd > > So the imported things (by "check") can't help sub-case running aah right. Each testcase is inoked by "exec ./$seq" and it won't have the function definitions sourced from the previous shell process. So we will need to source the necessary files again within the test execution. -ritesh