Linux Power Management development
 help / color / mirror / Atom feed
From: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
To: "Loïc Minier" <loic.minier@oss.qualcomm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"Shuah Khan" <shuah@kernel.org>,
	"Muhammad Usama Anjum" <usama.anjum@arm.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	linux-pm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Subject: Re: [PATCH] selftests: cpufreq: Propagate do_test() exit status
Date: Thu, 3 Dec 2026 11:07:46 +0800	[thread overview]
Message-ID: <9fafe114-88e0-4101-82ee-07d25f9fc0ef@oss.qualcomm.com> (raw)
In-Reply-To: <20261202-kselftests-cpufreq-exit-status-v1-1-05e9c2a9a075@oss.qualcomm.com>

Hi Loic,

Thanks a lot for the patch.

On 12/3/2026 4:59 AM, Loïc Minier wrote:
> main.sh runs do_test through tee and checks ${PIPESTATUS[0]}, but by the
> time the "exit ${PIPESTATUS[0]}" in the if body is executed, PIPESTATUS
> has already been overwritten by the [ test, so the script exits 0.
> 
> As a result, when do_test() bails out, e.g. with "No cpu is managed by
> cpufreq core, exiting", the test is reported as passing:
> 
>    # Bail out!  No cpu is managed by cpufreq core, exiting
>    # # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
>    ok 1 selftests: cpufreq: main.sh
> 
> This was hit on a Qualcomm Glymur laptop with CONFIG_CPU_FREQ=y but
> without CONFIG_ARM_SCMI_CPUFREQ, so no CPU had a cpufreq policy.
> 
> Save the pipeline status before testing it, so that the failure is
> reported:
> 
>    not ok 1 selftests: cpufreq: main.sh # exit=1
> 
> Fixes: c7e84706fd3b ("selftests: cpufreq: conform test to TAP")
> Signed-off-by: Loïc Minier <loic.minier@oss.qualcomm.com>

The fix looks correct to me.

However, I think the issue was introduced by commit 40d70d4d6097
("selftests: cpufreq: Write test output to stdout as well"). Commit
c7e84706fd3b ("selftests: cpufreq: conform test to TAP") attempted to
fix it by checking PIPESTATUS, but the fix did not work as intended.

So the Fixes tag should point to 40d70d4d6097 instead, right?

> ---
> Tested on a Qualcomm Glymur laptop without CONFIG_ARM_SCMI_CPUFREQ:
> the bail-out was reported as "ok 1" before this change and as "not
> ok 1 ... # exit=1" after it.
> ---
>   tools/testing/selftests/cpufreq/main.sh | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/cpufreq/main.sh b/tools/testing/selftests/cpufreq/main.sh
> index f12ff7416e41..03163cd7813e 100755
> --- a/tools/testing/selftests/cpufreq/main.sh
> +++ b/tools/testing/selftests/cpufreq/main.sh
> @@ -207,8 +207,9 @@ prerequisite
>   # Run requested functions
>   clear_dumps $OUTFILE
>   do_test | tee -a $OUTFILE.txt
> -if [ "${PIPESTATUS[0]}" -ne 0 ]; then
> -    exit ${PIPESTATUS[0]};
> +ret=${PIPESTATUS[0]}
> +if [ "$ret" -ne 0 ]; then
> +    exit "$ret"
>   fi
>   dmesg_dumps $OUTFILE
>   
> 
> ---
> base-commit: 0df89587a56e0f0392a9d5380334fb87ec4f2690
> change-id: 20261202-kselftests-cpufreq-exit-status-3759fb29842c
> 
> Best regards,
> --
> Loïc Minier <loic.minier@oss.qualcomm.com>
> 
> 


-- 
Thx and BRs,
Zhongqiu Han

  reply	other threads:[~2026-12-03  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 20:59 [PATCH] selftests: cpufreq: Propagate do_test() exit status Loïc Minier
2026-12-03  3:07 ` Zhongqiu Han [this message]
2026-12-03 13:42   ` Loïc Minier

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=9fafe114-88e0-4101-82ee-07d25f9fc0ef@oss.qualcomm.com \
    --to=zhongqiu.han@oss.qualcomm.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=loic.minier@oss.qualcomm.com \
    --cc=rafael@kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=usama.anjum@arm.com \
    --cc=viresh.kumar@linaro.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