From: Shuah Khan <skhan@linuxfoundation.org>
To: Muhammad Usama Anjum <usama.anjum@collabora.com>,
Shuah Khan <shuah@kernel.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Colin Ian King <colin.i.king@gmail.com>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kernel@collabora.com, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH 1/4] kselftests: vdso: vdso_test_clock_getres: conform test to TAP output
Date: Fri, 7 Jun 2024 14:15:32 -0600 [thread overview]
Message-ID: <b1f1302f-faa2-4081-a73d-b57f9c924e23@linuxfoundation.org> (raw)
In-Reply-To: <20240529072454.2522495-2-usama.anjum@collabora.com>
On 5/29/24 01:24, Muhammad Usama Anjum wrote:
> Conform the layout, informational and status messages to TAP. No
> functional change is intended other than the layout of output messages.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
The message doesn't match the change. This patch converts the
test to use kselftest_harness.h
Please fix the message to indicate what changes are being made and
why.
> ---
> .../selftests/vDSO/vdso_test_clock_getres.c | 68 +++++++++----------
> 1 file changed, 33 insertions(+), 35 deletions(-)
>
> diff --git a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c b/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
> index 38d46a8bf7cba..c1ede40521f05 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
> @@ -25,7 +25,7 @@
> #include <unistd.h>
> #include <sys/syscall.h>
>
> -#include "../kselftest.h"
> +#include "../kselftest_harness.h"
>
> static long syscall_clock_getres(clockid_t _clkid, struct timespec *_ts)
> {
> @@ -54,18 +54,8 @@ const char *vdso_clock_name[12] = {
> /*
> * This function calls clock_getres in vdso and by system call
> * with different values for clock_id.
> - *
> - * Example of output:
> - *
> - * clock_id: CLOCK_REALTIME [PASS]
> - * clock_id: CLOCK_BOOTTIME [PASS]
> - * clock_id: CLOCK_TAI [PASS]
> - * clock_id: CLOCK_REALTIME_COARSE [PASS]
> - * clock_id: CLOCK_MONOTONIC [PASS]
> - * clock_id: CLOCK_MONOTONIC_RAW [PASS]
> - * clock_id: CLOCK_MONOTONIC_COARSE [PASS]
> */
> -static inline int vdso_test_clock(unsigned int clock_id)
> +static inline void vdso_test_clock(struct __test_metadata *_metadata, unsigned int clock_id)
> {
> struct timespec x, y;
>
> @@ -73,52 +63,60 @@ static inline int vdso_test_clock(unsigned int clock_id)
> clock_getres(clock_id, &x);
> syscall_clock_getres(clock_id, &y);
>
> - if ((x.tv_sec != y.tv_sec) || (x.tv_nsec != y.tv_nsec)) {
> - printf(" [FAIL]\n");
> - return KSFT_FAIL;
> - }
> -
> - printf(" [PASS]\n");
> - return KSFT_PASS;
> + ASSERT_EQ(0, ((x.tv_sec != y.tv_sec) || (x.tv_nsec != y.tv_nsec)));
> }
>
> -int main(int argc, char **argv)
> -{
> - int ret = 0;
> -
> #if _POSIX_TIMERS > 0
>
> #ifdef CLOCK_REALTIME
> - ret += vdso_test_clock(CLOCK_REALTIME);
> +TEST(clock_realtime)
> +{
> + vdso_test_clock(_metadata, CLOCK_REALTIME);
> +}
> #endif
>
> #ifdef CLOCK_BOOTTIME
> - ret += vdso_test_clock(CLOCK_BOOTTIME);
> +TEST(clock_boottime)
> +{
> + vdso_test_clock(_metadata, CLOCK_BOOTTIME);
> +}
> #endif
>
> #ifdef CLOCK_TAI
> - ret += vdso_test_clock(CLOCK_TAI);
> +TEST(clock_tai)
> +{
> + vdso_test_clock(_metadata, CLOCK_TAI);
> +}
> #endif
>
> #ifdef CLOCK_REALTIME_COARSE
> - ret += vdso_test_clock(CLOCK_REALTIME_COARSE);
> +TEST(clock_realtime_coarse)
> +{
> + vdso_test_clock(_metadata, CLOCK_REALTIME_COARSE);
> +}
> #endif
>
> #ifdef CLOCK_MONOTONIC
> - ret += vdso_test_clock(CLOCK_MONOTONIC);
> +TEST(clock_monotonic)
> +{
> + vdso_test_clock(_metadata, CLOCK_MONOTONIC);
> +}
> #endif
>
> #ifdef CLOCK_MONOTONIC_RAW
> - ret += vdso_test_clock(CLOCK_MONOTONIC_RAW);
> +TEST(clock_monotonic_raw)
> +{
> + vdso_test_clock(_metadata, CLOCK_MONOTONIC_RAW);
> +}
> #endif
>
> #ifdef CLOCK_MONOTONIC_COARSE
> - ret += vdso_test_clock(CLOCK_MONOTONIC_COARSE);
> +TEST(clock_monotonic_coarse)
> +{
> + vdso_test_clock(_metadata, CLOCK_MONOTONIC_COARSE);
> +}
> #endif
>
> -#endif
> - if (ret > 0)
> - return KSFT_FAIL;
> +#endif /* _POSIX_TIMERS > 0 */
>
> - return KSFT_PASS;
> -}
> +TEST_HARNESS_MAIN
thanks,
-- Shuah
next prev parent reply other threads:[~2024-06-07 20:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 7:24 [PATCH 0/4] kselftests: vdso: conform tests " Muhammad Usama Anjum
2024-05-29 7:24 ` [PATCH 1/4] kselftests: vdso: vdso_test_clock_getres: conform test " Muhammad Usama Anjum
2024-06-07 20:15 ` Shuah Khan [this message]
2024-05-29 7:24 ` [PATCH 2/4] kselftests: vdso: vdso_test_correctness: " Muhammad Usama Anjum
2024-05-29 7:24 ` [PATCH 3/4] kselftests: vdso: vdso_test_getcpu: " Muhammad Usama Anjum
2024-05-29 7:24 ` [PATCH 4/4] kselftests: vdso: vdso_test_gettimeofday: " Muhammad Usama Anjum
2024-06-07 20:16 ` [PATCH 0/4] kselftests: vdso: conform tests " Shuah Khan
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=b1f1302f-faa2-4081-a73d-b57f9c924e23@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=colin.i.king@gmail.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=usama.anjum@collabora.com \
--cc=vincenzo.frascino@arm.com \
--cc=yangtiezhu@loongson.cn \
/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®