mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Rae Moar <rmoar@google.com>
Cc: John Stultz <jstultz@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org,
	Daniel Diaz <daniel.diaz@linaro.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] kunit: time: Add faster unit test with shorter time range
Date: Thu, 14 Mar 2024 12:30:50 -0700	[thread overview]
Message-ID: <c34e1c68-254f-489b-925f-0e7906b3a89f@roeck-us.net> (raw)
In-Reply-To: <CA+GJov5V5+X9FY7MD1Q+eBeEcJeUjQEuK3Qw8LJ0Oho9KtuXtQ@mail.gmail.com>

On 3/14/24 12:05, Rae Moar wrote:
> On Wed, Mar 13, 2024 at 5:01 PM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> Commit a547c4ce10bd ("kunit: time: Mark test as slow using test
>> attributes") marked the time unit test as slow. This means it does not
>> run anymore if slow tests are disabled. This reduces test coverage and
>> is thus undesirable. At the same time, the test currently covers a range
>> of 160,000 years, which has limited value.
>>
>> Add additional test case covering a total range of 1,600 years. This test
>> takes less than a second to run even on slow systems while still covering
>> twice the leap year calculation range of 400 years around the center date.
>> This test can run even with slow tests disabled.
> 
> Hello!
> 
> I really like this addition of another time range test. This looks good to me.
> 
> Thanks!
> -Rae
> 
> Reviewed-by: Rae Moar <rmoar@google.com>
> 
>>
>> Cc: Rae Moar <rmoar@google.com>
>> Cc: Shuah Khan <skhan@linuxfoundation.org>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   kernel/time/time_test.c | 35 +++++++++++++++++++++++++++--------
>>   1 file changed, 27 insertions(+), 8 deletions(-)
>>
>> diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c
>> index 3e5d422dd15c..15c6f3a5e73c 100644
>> --- a/kernel/time/time_test.c
>> +++ b/kernel/time/time_test.c
>> @@ -47,18 +47,18 @@ static void advance_date(long *year, int *month, int *mday, int *yday)
>>   }
>>
>>   /*
>> - * Checks every day in a 160000 years interval centered at 1970-01-01
>> + * Checks every day in a specified interval centered at 1970-01-01
>>    * against the expected result.
>>    */
>> -static void time64_to_tm_test_date_range(struct kunit *test)
>> +static void time64_to_tm_test_date_range(struct kunit *test, int years)
>>   {
>>          /*
>> -        * 80000 years  = (80000 / 400) * 400 years
>> -        *              = (80000 / 400) * 146097 days
>> -        *              = (80000 / 400) * 146097 * 86400 seconds
>> +        * years        = (years / 400) * 400 years
> 
> This is tiny but if there is another version, I find this comment a
> bit confusing. Could you change this to maybe be "total seconds ="
> instead of "years =" because years is used as a unit on the right side
> of the equation?
> 

Good point. "total seconds" might be just as confusing, though.
How about "total range", "time range", or just "range" ?

Thanks,
Guenter


  reply	other threads:[~2024-03-14 19:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 21:01 Guenter Roeck
2024-03-14 19:05 ` Rae Moar
2024-03-14 19:30   ` Guenter Roeck [this message]
2024-03-14 19:44     ` Rae Moar
2024-03-14 22:08       ` Guenter Roeck

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=c34e1c68-254f-489b-925f-0e7906b3a89f@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=daniel.diaz@linaro.org \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmoar@google.com \
    --cc=sboyd@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@linutronix.de \
    /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®