All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: marc.herbert@linux.intel.com, linux-cxl@vger.kernel.org,
	nvdimm@lists.linux.dev, alison.schofield@intel.com,
	dan.j.williams@intel.com
Subject: Re: [ndctl PATCH 2/3] test/common: move err() function at the top
Date: Tue, 29 Jul 2025 08:14:38 -0700	[thread overview]
Message-ID: <880da88e-2cad-4e8b-9d9b-ad9e2fcdb56d@intel.com> (raw)
In-Reply-To: <20250724221323.365191-3-marc.herbert@linux.intel.com>



On 7/24/25 3:00 PM, marc.herbert@linux.intel.com wrote:
> From: Marc Herbert <marc.herbert@linux.intel.com>
> 
> move err() function at the top so we can fail early. err() does not have
> any dependency so it can be first.
> 
> Signed-off-by: Marc Herbert <marc.herbert@linux.intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  test/common | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/test/common b/test/common
> index 2d8422f26436..2d076402ef7c 100644
> --- a/test/common
> +++ b/test/common
> @@ -1,6 +1,20 @@
>  # SPDX-License-Identifier: GPL-2.0
>  # Copyright (C) 2018, FUJITSU LIMITED. All rights reserved.
>  
> +# err
> +# $1: line number which error detected
> +# $2: cleanup function (optional)
> +#
> +
> +test_basename=$(basename "$0")
> +
> +err()
> +{
> +	echo test/"$test_basename": failed at line "$1"
> +	[ -n "$2" ] && "$2"
> +	exit "$rc"
> +}
> +
>  # Global variables
>  
>  # NDCTL
> @@ -53,17 +67,6 @@ E820_BUS="e820"
>  
>  # Functions
>  
> -# err
> -# $1: line number which error detected
> -# $2: cleanup function (optional)
> -#
> -err()
> -{
> -	echo test/$(basename $0): failed at line $1
> -	[ -n "$2" ] && "$2"
> -	exit $rc
> -}
> -
>  reset()
>  {
>  	$NDCTL disable-region -b $NFIT_TEST_BUS0 all


  reply	other threads:[~2025-07-29 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 22:00 test/common: stop relying on bash $SECONDS in check_dmesg() marc.herbert
2025-07-24 22:00 ` [ndctl PATCH 1/3] test/common: add missing quotes marc.herbert
2025-07-29 15:14   ` Dave Jiang
2025-08-06 21:43   ` Alison Schofield
2025-07-24 22:00 ` [ndctl PATCH 2/3] test/common: move err() function at the top marc.herbert
2025-07-29 15:14   ` Dave Jiang [this message]
2025-08-06 21:44   ` Alison Schofield
2025-07-24 22:00 ` [ndctl PATCH 3/3] test/common: stop relying on bash $SECONDS in check_dmesg() marc.herbert
2025-07-29 15:19   ` Dave Jiang
2025-08-22  0:10   ` Alison Schofield
2025-08-22  0:21 ` Alison Schofield

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=880da88e-2cad-4e8b-9d9b-ad9e2fcdb56d@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=marc.herbert@linux.intel.com \
    --cc=nvdimm@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.