From: Marc Herbert <Marc.Herbert@linux.intel.com>
To: Dave Jiang <dave.jiang@intel.com>,
linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Cc: alison.schofield@intel.com, Dan Williams <dan.j.williams@intel.com>
Subject: Re: [NDCTL PATCH v8 4/4] cxl/test: Add test for cxl features device
Date: Thu, 22 May 2025 10:46:25 -0700 [thread overview]
Message-ID: <b1043cc3-c3be-45a3-b093-7ffba9f5d204@linux.intel.com> (raw)
In-Reply-To: <20250522155653.1346768-5-dave.jiang@intel.com>
[Sorry for commenting for the first time on v8]
Could you move all the cxl-features.sh code to a
main() function and then call main "$@" at the end?
It's a pretty standard practice and has many benefits listed here:
https://github.com/thesofproject/sof-test/issues/740
More inline
On 2025-05-22 08:56, Dave Jiang wrote:
> diff --git a/test/cxl-features.sh b/test/cxl-features.sh
> new file mode 100755
> index 000000000000..a730310ec7b0
> --- /dev/null
> +++ b/test/cxl-features.sh
> @@ -0,0 +1,31 @@
> +#!/bin/bash -Ex
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (C) 2025 Intel Corporation. All rights reserved.
> +
> +rc=77
Once this is a function:
local rc=77
> +# 237 is -ENODEV
> +ERR_NODEV=237
> +
> +. $(dirname $0)/common
> +FEATURES="$TEST_PATH"/fwctl
> +
> +trap 'err $LINENO' ERR
> +
> +modprobe cxl_test
> +
> +test -x "$FEATURES" || do_skip "no CXL Features Control"
> +# disable trap
> +trap - $(compgen -A signal)
ALL of them? Is that really necessary? Or just ERR maybe?
A comment maybe?
traps are usually the reserved domain of test/common.
If this just for ERR, then you shouldn't need to change
traps at all:
rc=0
"$FEATURES" || rc=$?
|| and friends turn off "set -e" and "trap ERR" temporarily
(otherwise they would be incompatible with each other)
> +"$FEATURES"
> +rc=$?
> +
> +echo "error: $rc"
> +if [ "$rc" -eq "$ERR_NODEV" ]; then
> + do_skip "no CXL FWCTL char dev"
> +elif [ "$rc" -ne 0 ]; then
> + echo "fail: $LINENO" && exit 1
> +fi
> +
> +trap 'err $LINENO' ERR
In a distant future this should live in test/common...
> +
> +_cxl_cleanup
prev parent reply other threads:[~2025-05-22 17:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 15:56 [NDCTL PATCH v8 0/4] ndctl: Add support and test for CXL Features support Dave Jiang
2025-05-22 15:56 ` [NDCTL PATCH v8 1/4] cxl: Add cxl_bus_get_by_provider() Dave Jiang
2025-05-22 15:56 ` [NDCTL PATCH v8 2/4] cxl: Enumerate major/minor of FWCTL char device Dave Jiang
2025-05-22 15:56 ` [NDCTL PATCH v8 3/4] ndctl: Add features.h from kernel UAPI Dave Jiang
2025-05-22 15:56 ` [NDCTL PATCH v8 4/4] cxl/test: Add test for cxl features device Dave Jiang
2025-05-22 17:46 ` Marc Herbert [this message]
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=b1043cc3-c3be-45a3-b093-7ffba9f5d204@linux.intel.com \
--to=marc.herbert@linux.intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox