From: "Hanne-Lotta Mäenpää" <hannelotta@gmail.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: skhan@linuxfoundation.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rtc@vger.kernel.org
Subject: Re: [PATCH] selftests: Improve test output grammar, code style
Date: Fri, 16 May 2025 11:44:39 +0300 [thread overview]
Message-ID: <b1ac8546-b385-4ed9-b15e-da147c35ade3@gmail.com> (raw)
In-Reply-To: <20250515165629d521d4a2@mail.local>
Hello,
On 5/15/25 19:56, Alexandre Belloni wrote:
> Hello,
>
> On 15/05/2025 19:22:49+0300, Hanne-Lotta Mäenpää wrote:
>> Add small grammar fixes in perf events and Real Time Clock tests'
>> output messages.
>>
>> Include braces around a single if statement, when there are multiple
>> statements in the else branch, to align with the kernel coding style.
>>
>> Signed-off-by: Hanne-Lotta Mäenpää <hannelotta@gmail.com>
>> ---
>> tools/testing/selftests/perf_events/watermark_signal.c | 7 ++++---
>> tools/testing/selftests/rtc/rtctest.c | 10 +++++-----
>> 2 files changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/testing/selftests/perf_events/watermark_signal.c b/tools/testing/selftests/perf_events/watermark_signal.c
>> index 49dc1e831174..6176afd4950b 100644
>> --- a/tools/testing/selftests/perf_events/watermark_signal.c
>> +++ b/tools/testing/selftests/perf_events/watermark_signal.c
>> @@ -65,8 +65,9 @@ TEST(watermark_signal)
>>
>> child = fork();
>> EXPECT_GE(child, 0);
>> - if (child == 0)
>> + if (child == 0) {
>> do_child();
>> + }
>
> This change seems unrelated.
It is related as a code style fix. I noticed it while reviewing the
tests, and decided not to make a separate commit of it. Inspiration is
from the kernel coding style docs, see the second last example in:
https://www.kernel.org/doc/html/latest/process/coding-style.html#placing-braces-and-spaces
>
>> else if (child < 0) {
>> perror("fork()");
>> goto cleanup;
>> @@ -75,7 +76,7 @@ TEST(watermark_signal)
>> if (waitpid(child, &child_status, WSTOPPED) != child ||
>> !(WIFSTOPPED(child_status) && WSTOPSIG(child_status) == SIGSTOP)) {
>> fprintf(stderr,
>> - "failed to sycnhronize with child errno=%d status=%x\n",
>> + "failed to synchronize with child errno=%d status=%x\n",
>> errno,
>> child_status);
>> goto cleanup;
>> @@ -84,7 +85,7 @@ TEST(watermark_signal)
>> fd = syscall(__NR_perf_event_open, &attr, child, -1, -1,
>> PERF_FLAG_FD_CLOEXEC);
>> if (fd < 0) {
>> - fprintf(stderr, "failed opening event %llx\n", attr.config);
>> + fprintf(stderr, "failed to setup performance monitoring %llx\n", attr.config);
>> goto cleanup;
>> }
>>
>> diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c
>> index be175c0e6ae3..8fd4d5d3b527 100644
>> --- a/tools/testing/selftests/rtc/rtctest.c
>> +++ b/tools/testing/selftests/rtc/rtctest.c
>> @@ -138,10 +138,10 @@ TEST_F_TIMEOUT(rtc, date_read_loop, READ_LOOP_DURATION_SEC + 2) {
>> rtc_read = rtc_time_to_timestamp(&rtc_tm);
>> /* Time should not go backwards */
>> ASSERT_LE(prev_rtc_read, rtc_read);
>> - /* Time should not increase more then 1s at a time */
>> + /* Time should not increase more than 1s per read */
>> ASSERT_GE(prev_rtc_read + 1, rtc_read);
>>
>> - /* Sleep 11ms to avoid killing / overheating the RTC */
>> + /* Sleep 11ms to avoid overheating the RTC */
>> nanosleep_with_retries(READ_LOOP_SLEEP_MS * 1000000);
>>
>> prev_rtc_read = rtc_read;
>> @@ -236,7 +236,7 @@ TEST_F(rtc, alarm_alm_set) {
>> if (alarm_state == RTC_ALARM_DISABLED)
>> SKIP(return, "Skipping test since alarms are not supported.");
>> if (alarm_state == RTC_ALARM_RES_MINUTE)
>> - SKIP(return, "Skipping test since alarms has only minute granularity.");
>> + SKIP(return, "Skipping test since alarms have only minute granularity.");
>
> I guess the proper fix is to remove the s in alarms as there is only one
> alarm.
You are right. I sent patch v2 in another email, with the proposed change.
>
>>
>> rc = ioctl(self->fd, RTC_RD_TIME, &tm);
>> ASSERT_NE(-1, rc);
>> @@ -306,7 +306,7 @@ TEST_F(rtc, alarm_wkalm_set) {
>> if (alarm_state == RTC_ALARM_DISABLED)
>> SKIP(return, "Skipping test since alarms are not supported.");
>> if (alarm_state == RTC_ALARM_RES_MINUTE)
>> - SKIP(return, "Skipping test since alarms has only minute granularity.");
>> + SKIP(return, "Skipping test since alarms have only minute granularity.");
>>
>> rc = ioctl(self->fd, RTC_RD_TIME, &alarm.time);
>> ASSERT_NE(-1, rc);
>> @@ -502,7 +502,7 @@ int main(int argc, char **argv)
>> if (access(rtc_file, R_OK) == 0)
>> ret = test_harness_run(argc, argv);
>> else
>> - ksft_exit_skip("[SKIP]: Cannot access rtc file %s - Exiting\n",
>> + ksft_exit_skip("Cannot access RTC file %s - exiting\n",
>> rtc_file);
>>
>> return ret;
>> --
>> 2.39.5
>>
>
Best regards,
Hanne-Lotta Mäenpää
prev parent reply other threads:[~2025-05-16 8:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 16:22 Hanne-Lotta Mäenpää
2025-05-15 16:56 ` Alexandre Belloni
2025-05-16 8:44 ` Hanne-Lotta Mäenpää [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=b1ac8546-b385-4ed9-b15e-da147c35ade3@gmail.com \
--to=hannelotta@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.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
all inboxes | Powered by JetHome®