From patchwork Wed Sep 27 10:18:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 727499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25778E810BE for ; Wed, 27 Sep 2023 10:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231184AbjI0KTO (ORCPT ); Wed, 27 Sep 2023 06:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbjI0KTL (ORCPT ); Wed, 27 Sep 2023 06:19:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C3059DB; Wed, 27 Sep 2023 03:19:10 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D23A6C433C8; Wed, 27 Sep 2023 10:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695809950; bh=q8UFTGCW+PEFQaExarcKjuMastWfb/GcwHIY56H9Tcw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KCp/48UmNhG+JUhenczTWbQ01+AmwHSJ/xcynPmRlgAsXCa4o+g9mRDPbDHUTwFNY knZA5sC1MFntWgcmwvXDf7ki3fruJuUFMVRjBGiFx4tB9FDEboR/yuUGWs5h+NmybG dpVkqylLX+TvWpAoaIOjtKyl+qKIejaU3ad2fHRq15duc7pF1nDVQDaqRCyABs4+fc uF3OBobSRo1FfYDvo8IhFN8FGCvF1ZWurUIrp4q8DD0fMh6JrqhwcJn/hlf8AHxdud 277wi2XqBg2CkrgJw/Tk4+mnEg+UzcIfK//psyM19om44R9Pl1X25jxlNsWL7LYo7k qBvjw4w9aw3qg== From: Mark Brown Date: Wed, 27 Sep 2023 12:18:57 +0200 Subject: [PATCH 1/3] kselftest: Add a ksft_perror() helper MIME-Version: 1.0 Message-Id: <20230927-ktap-posix-timers-v1-1-399de1cbfbea@kernel.org> References: <20230927-ktap-posix-timers-v1-0-399de1cbfbea@kernel.org> In-Reply-To: <20230927-ktap-posix-timers-v1-0-399de1cbfbea@kernel.org> To: Shuah Khan , John Stultz , Thomas Gleixner , Stephen Boyd Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1471; i=broonie@kernel.org; h=from:subject:message-id; bh=q8UFTGCW+PEFQaExarcKjuMastWfb/GcwHIY56H9Tcw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlFAGYNK6gOtJ44o+Ey79dZT7jaZTXslGQO8ibW 4QF+xvnPF+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZRQBmAAKCRAk1otyXVSH 0MnuB/0fKCe7L0bWZzezE38N7jQMuQoyEPoFefE9z2hmqRzbaxOlz7qYon9WgdI+eJsZKncV8rh ZlKpz5PotKnC6WFxN3zmVoro2yulWq7knYrKKBcP0FQeZ2KdUuEzR2c1+SXfiSI2R0Up1X7JXaO 6PquwMvoc+z+ElwmKiehj74I7f9rxBuxobQBDwlRpjSlcHTYKVHAFkAvD8tqAtawQaM0dI5ZOxC +2A26seWgb7MMnLFFEKGihIBEziLtf539Z78/CmaQ0XuIUSSI6vRtal4H9QaGlurqK4b2sViq0n oGbDsaKEjptRXTElzBtZNSydt/u5eTUEgTR5XKSiHzOAeP/Z X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The standard library perror() function provides a convenient way to print an error message based on the current errno but this doesn't play nicely with KTAP output. Provide a helper which does an equivalent thing in a KTAP compatible format. nolibc doesn't have a strerror() and adding the table of strings required doesn't seem like a good fit for what it's trying to do so when we're using that only print the errno. Signed-off-by: Mark Brown --- tools/testing/selftests/kselftest.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 529d29a35900..af9f1202d423 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -48,6 +48,7 @@ #include #include #include +#include #include #endif @@ -155,6 +156,19 @@ static inline void ksft_print_msg(const char *msg, ...) va_end(args); } +static inline void ksft_perror(const char *msg) +{ +#ifndef NOLIBC + ksft_print_msg("%s: %s (%d)\n", msg, strerror(errno), errno); +#else + /* + * nolibc doesn't provide strerror() and it seems + * inappropriate to add one, just print the errno. + */ + ksft_print_msg("%s: %d)\n", msg, errno); +#endif +} + static inline void ksft_test_result_pass(const char *msg, ...) { int saved_errno = errno; From patchwork Wed Sep 27 10:18:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 726855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46F15E810BE for ; Wed, 27 Sep 2023 10:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbjI0KTP (ORCPT ); Wed, 27 Sep 2023 06:19:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231196AbjI0KTO (ORCPT ); Wed, 27 Sep 2023 06:19:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5806959DD; Wed, 27 Sep 2023 03:19:12 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97504C433C9; Wed, 27 Sep 2023 10:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695809951; bh=iD1Vck+S4QQft7BTkmuK0ma2eIqgxVFnU1MUyNKVw4U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MId2KBAaZTaZ6MGBXjGQG7DIv5i4LhjKxhKNkzWFZAH/bHIHgNLdzzabQNgxbURc3 YUR3fy9EqY5BI2j9J1EArx+Nz02x+NZbgah0n77TrXnzlp53pVqCnpUeDL0n2aEKVh E52i6MWKW33uC51bvhkUVByuYMBeoOCbhNH5M6JcsTBIrolDMcLYUvqwSmnXTljQEV kVL2nzfHidbN7dU3GLi2nSq6OlG3eH98W5tr/KYJgQu88iG0bYJohj23TPfsfp1jhk YTZeKS1qY5ZnmUB4hCEIvxYTdesNPUrSuKW9XP1sRf8YYv2d1gS2mV95JeT17sktEG /B9hqBN6/GMxg== From: Mark Brown Date: Wed, 27 Sep 2023 12:18:58 +0200 Subject: [PATCH 2/3] selftests: timers: Convert posix_timers test to generate KTAP output MIME-Version: 1.0 Message-Id: <20230927-ktap-posix-timers-v1-2-399de1cbfbea@kernel.org> References: <20230927-ktap-posix-timers-v1-0-399de1cbfbea@kernel.org> In-Reply-To: <20230927-ktap-posix-timers-v1-0-399de1cbfbea@kernel.org> To: Shuah Khan , John Stultz , Thomas Gleixner , Stephen Boyd Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=6161; i=broonie@kernel.org; h=from:subject:message-id; bh=iD1Vck+S4QQft7BTkmuK0ma2eIqgxVFnU1MUyNKVw4U=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlFAGZZAdKazmdjvuqdjsRoyW6Y2uwOwJX+eXU4 Ek28g+AxUuJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZRQBmQAKCRAk1otyXVSH 0KMNB/0Wzs5srSnzDTwH8Vy5t4CukNA5q4cLL2YheCHtsweN6EqCrtV2bGoVTIY7R2So4Dxx/fc LFCMLHfRFLd/ZwWBKPUkzd0iITWX48AMl6IV8FIORikxJdpK8R2beuYX5UHTAdGbHnO8Erf0AN1 eNT6bodDTAyz7Ksl8y83CTQ/OQnDukiG9F49qGck3qo9gtCTrvTCmEw71jevyyP3HjYT9kBwKs9 WDiWOmL+RYc4tBwhVh/vXvcP5M7DsyYfbn31kahicnifMfTlffowwARz+rOHDQe2CRYKlJbtYKU 0I3Z+ko/kW7e+FPhqTM1R46y39PL6gGn49TztSN66s738Voe X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently the posix_timers test does not produce KTAP output but rather a custom format. This means that we only get a pass/fail for the suite, not for each individual test that the suite does. Convert to using the standard kselftest output functions which result in KTAP output being generated. As part of this fix the printing of diagnostics in the unlikely event that the pthread APIs fail, these were using perror() but the API functions directly return an error code instead of setting errno. Signed-off-by: Mark Brown --- tools/testing/selftests/timers/posix_timers.c | 81 ++++++++++++++------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index 8a17c0e8d82b..d49dd3ffd0d9 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -76,22 +76,21 @@ static int check_diff(struct timeval start, struct timeval end) static int check_itimer(int which) { + const char *name; int err; struct timeval start, end; struct itimerval val = { .it_value.tv_sec = DELAY, }; - printf("Check itimer "); - if (which == ITIMER_VIRTUAL) - printf("virtual... "); + name = "ITIMER_VIRTUAL"; else if (which == ITIMER_PROF) - printf("prof... "); + name = "ITIMER_PROF"; else if (which == ITIMER_REAL) - printf("real... "); - - fflush(stdout); + name = "ITIMER_REAL"; + else + return -1; done = 0; @@ -104,13 +103,13 @@ static int check_itimer(int which) err = gettimeofday(&start, NULL); if (err < 0) { - perror("Can't call gettimeofday()\n"); + ksft_perror("Can't call gettimeofday()"); return -1; } err = setitimer(which, &val, NULL); if (err < 0) { - perror("Can't set timer\n"); + ksft_perror("Can't set timer"); return -1; } @@ -123,20 +122,18 @@ static int check_itimer(int which) err = gettimeofday(&end, NULL); if (err < 0) { - perror("Can't call gettimeofday()\n"); + ksft_perror("Can't call gettimeofday()"); return -1; } - if (!check_diff(start, end)) - printf("[OK]\n"); - else - printf("[FAIL]\n"); + ksft_test_result(check_diff(start, end) == 0, "%s\n", name); return 0; } static int check_timer_create(int which) { + const char *type; int err; timer_t id; struct timeval start, end; @@ -144,31 +141,32 @@ static int check_timer_create(int which) .it_value.tv_sec = DELAY, }; - printf("Check timer_create() "); if (which == CLOCK_THREAD_CPUTIME_ID) { - printf("per thread... "); + type = "thread"; } else if (which == CLOCK_PROCESS_CPUTIME_ID) { - printf("per process... "); + type = "process"; + } else { + ksft_print_msg("Unknown timer_create() type %d\n", which); + return -1; } - fflush(stdout); done = 0; err = timer_create(which, NULL, &id); if (err < 0) { - perror("Can't create timer\n"); + ksft_perror("Can't create timer"); return -1; } signal(SIGALRM, sig_handler); err = gettimeofday(&start, NULL); if (err < 0) { - perror("Can't call gettimeofday()\n"); + ksft_perror("Can't call gettimeofday()"); return -1; } err = timer_settime(id, 0, &val, NULL); if (err < 0) { - perror("Can't set timer\n"); + ksft_perror("Can't set timer"); return -1; } @@ -176,14 +174,12 @@ static int check_timer_create(int which) err = gettimeofday(&end, NULL); if (err < 0) { - perror("Can't call gettimeofday()\n"); + ksft_perror("Can't call gettimeofday()"); return -1; } - if (!check_diff(start, end)) - printf("[OK]\n"); - else - printf("[FAIL]\n"); + ksft_test_result(check_diff(start, end) == 0, + "timer_create() per %s\n", type); return 0; } @@ -220,25 +216,25 @@ static int check_timer_distribution(void) .it_interval.tv_nsec = 1000 * 1000, }; - printf("Check timer_create() per process signal distribution... "); - fflush(stdout); - remain = nthreads + 1; /* worker threads + this thread */ signal(SIGALRM, distribution_handler); err = timer_create(CLOCK_PROCESS_CPUTIME_ID, NULL, &id); if (err < 0) { - perror("Can't create timer\n"); + ksft_perror("Can't create timer"); return -1; } err = timer_settime(id, 0, &val, NULL); if (err < 0) { - perror("Can't set timer\n"); + ksft_perror("Can't set timer"); return -1; } for (i = 0; i < nthreads; i++) { - if (pthread_create(&threads[i], NULL, distribution_thread, NULL)) { - perror("Can't create thread\n"); + err = pthread_create(&threads[i], NULL, distribution_thread, + NULL); + if (err) { + ksft_print_msg("Can't create thread: %s (%d)\n", + strerror(errno), errno); return -1; } } @@ -247,25 +243,30 @@ static int check_timer_distribution(void) while (__atomic_load_n(&remain, __ATOMIC_RELAXED)); for (i = 0; i < nthreads; i++) { - if (pthread_join(threads[i], NULL)) { - perror("Can't join thread\n"); + err = pthread_join(threads[i], NULL); + if (err) { + ksft_print_msg("Can't join thread: %s (%d)\n", + strerror(errno), errno); return -1; } } if (timer_delete(id)) { - perror("Can't delete timer\n"); + ksft_perror("Can't delete timer"); return -1; } - printf("[OK]\n"); + ksft_test_result_pass("check_timer_distribution\n"); return 0; } int main(int argc, char **argv) { - printf("Testing posix timers. False negative may happen on CPU execution \n"); - printf("based timers if other threads run on the CPU...\n"); + ksft_print_header(); + ksft_set_plan(6); + + ksft_print_msg("Testing posix timers. False negative may happen on CPU execution \n"); + ksft_print_msg("based timers if other threads run on the CPU...\n"); if (check_itimer(ITIMER_VIRTUAL) < 0) return ksft_exit_fail(); @@ -294,5 +295,5 @@ int main(int argc, char **argv) if (check_timer_distribution() < 0) return ksft_exit_fail(); - return ksft_exit_pass(); + ksft_finished(); } From patchwork Wed Sep 27 10:18:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 727498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CAB3E810C0 for ; Wed, 27 Sep 2023 10:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231231AbjI0KTQ (ORCPT ); Wed, 27 Sep 2023 06:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbjI0KTQ (ORCPT ); Wed, 27 Sep 2023 06:19:16 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4644959E2; Wed, 27 Sep 2023 03:19:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CBB9C433CB; Wed, 27 Sep 2023 10:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695809953; bh=63LUFA7Rl18RX8Q038A1fYQa94hjblSR5oEGq9wpy9M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CNDXL9gSoveVjidsqC1k/2LIN1hh2S5fELc/bM0aWxDbf1F1qTGT9JIWuq2p0kQWA VbtWjdUnvqynQGHunCxKKylvq/NEZ1GSzE7rFQg8K07TL4SnRrT5f2dy5cLX4xDcZ6 LGQyYSHUnh/VwrflPTQctGMdSMONlN0f7SlEiRpxEH8mkXl4eSeBgGrvfYca7TZXsd Wlu8nVJTI5cwgq+OR8tRZeJPosKMA980CHmOfzZ14ZkSvPzc3d5x85SDZH531THDv+ 388gPs30MGiK33PYkApvKP5l18NAC2UH/Bxp7eTiDKZJ4gkAXIyGiche7bKDvA3OVY cAI6vClWcFuuQ== From: Mark Brown Date: Wed, 27 Sep 2023 12:18:59 +0200 Subject: [PATCH 3/3] selftests: timers: Convert nsleep-lat test to generate KTAP output MIME-Version: 1.0 Message-Id: <20230927-ktap-posix-timers-v1-3-399de1cbfbea@kernel.org> References: <20230927-ktap-posix-timers-v1-0-399de1cbfbea@kernel.org> In-Reply-To: <20230927-ktap-posix-timers-v1-0-399de1cbfbea@kernel.org> To: Shuah Khan , John Stultz , Thomas Gleixner , Stephen Boyd Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=2526; i=broonie@kernel.org; h=from:subject:message-id; bh=63LUFA7Rl18RX8Q038A1fYQa94hjblSR5oEGq9wpy9M=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlFAGahoQsX/geKms8lLTrIjGh9lXenG7MMNoBY V2BUzIxQuCJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZRQBmgAKCRAk1otyXVSH 0E3kCACDFYKSRI/bju7XA5tvQmMIDmo50WpFrllXyh1+Edx6XHx4SPX2EOIgZimzb8zIOngirha O14Jd8sJ3wTPgNhiEn5rjZPKHLKeBPZSiKBB18oG3hppYlH5QzQLGbTh4iMcLGHsdsjx/i11YD/ pVcILKC2dPQ1TpQdnX3kxiPHnDCBg6sKjDGC+OavOx7AppQ87LiegTclLRVI+F222rcyZZwLr7o v565/QixdxM6qouc/icy+c5Z/mWk2sTZIVPXzOtbEqMviIntLkZpLd/bAQ7kOIb3q7XJ/NCmb/R PNIvJ06W+xnJA2ShnhXIqi4XIWP3L73qFrPqE2nmFxh4PZIu X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently the nsleep-lat test does not produce KTAP output but rather a custom format. This means that we only get a pass/fail for the suite, not for each individual test that the suite does. Convert to using the standard kselftest output functions which result in KTAP output being generated. Signed-off-by: Mark Brown --- tools/testing/selftests/timers/nsleep-lat.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/timers/nsleep-lat.c b/tools/testing/selftests/timers/nsleep-lat.c index eb3e79ed7b4a..edb5acacf214 100644 --- a/tools/testing/selftests/timers/nsleep-lat.c +++ b/tools/testing/selftests/timers/nsleep-lat.c @@ -118,7 +118,7 @@ int nanosleep_lat_test(int clockid, long long ns) clock_gettime(clockid, &end); if (((timespec_sub(start, end)/count)-ns) > UNRESONABLE_LATENCY) { - printf("Large rel latency: %lld ns :", (timespec_sub(start, end)/count)-ns); + ksft_print_msg("Large rel latency: %lld ns :", (timespec_sub(start, end)/count)-ns); return -1; } @@ -132,20 +132,23 @@ int nanosleep_lat_test(int clockid, long long ns) } if (latency/count > UNRESONABLE_LATENCY) { - printf("Large abs latency: %lld ns :", latency/count); + ksft_print_msg("Large abs latency: %lld ns :", latency/count); return -1; } return 0; } - +#define SKIPPED_CLOCK_COUNT 3 int main(int argc, char **argv) { long long length; int clockid, ret; + ksft_print_header(); + ksft_set_plan(NR_CLOCKIDS - CLOCK_REALTIME - SKIPPED_CLOCK_COUNT); + for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) { /* Skip cputime clockids since nanosleep won't increment cputime */ @@ -154,9 +157,6 @@ int main(int argc, char **argv) clockid == CLOCK_HWSPECIFIC) continue; - printf("nsleep latency %-26s ", clockstring(clockid)); - fflush(stdout); - length = 10; while (length <= (NSEC_PER_SEC * 10)) { ret = nanosleep_lat_test(clockid, length); @@ -167,14 +167,12 @@ int main(int argc, char **argv) } if (ret == UNSUPPORTED) { - printf("[UNSUPPORTED]\n"); - continue; - } - if (ret < 0) { - printf("[FAILED]\n"); - return ksft_exit_fail(); + ksft_test_result_skip("%s\n", clockstring(clockid)); + } else { + ksft_test_result(ret >= 0, "%s\n", + clockstring(clockid)); } - printf("[OK]\n"); } - return ksft_exit_pass(); + + ksft_finished(); }