From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Shuah Khan <shuah@kernel.org>,
Muhammad Usama Anjum <usama.anjum@collabora.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kernel@collabora.com
Subject: [PATCH 1/4] selftests: x86: check_initial_reg_state: conform test to TAP format output
Date: Sun, 14 Apr 2024 18:18:04 +0500 [thread overview]
Message-ID: <20240414131807.2253344-2-usama.anjum@collabora.com> (raw)
In-Reply-To: <20240414131807.2253344-1-usama.anjum@collabora.com>
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>
---
.../selftests/x86/check_initial_reg_state.c | 24 +++++++++----------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/x86/check_initial_reg_state.c b/tools/testing/selftests/x86/check_initial_reg_state.c
index 3bc95f3ed5859..c3d42b193222a 100644
--- a/tools/testing/selftests/x86/check_initial_reg_state.c
+++ b/tools/testing/selftests/x86/check_initial_reg_state.c
@@ -7,6 +7,7 @@
#define _GNU_SOURCE
#include <stdio.h>
+#include "../kselftest.h"
unsigned long ax, bx, cx, dx, si, di, bp, sp, flags;
unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
@@ -53,20 +54,19 @@ asm (
int main()
{
- int nerrs = 0;
+ ksft_print_header();
+ ksft_set_plan(2);
- if (sp == 0) {
- printf("[FAIL]\tTest was built incorrectly\n");
- return 1;
- }
+ if (sp == 0)
+ ksft_exit_fail_msg("Test was built incorrectly\n");
if (ax || bx || cx || dx || si || di || bp
#ifdef __x86_64__
|| r8 || r9 || r10 || r11 || r12 || r13 || r14 || r15
#endif
) {
- printf("[FAIL]\tAll GPRs except SP should be 0\n");
-#define SHOW(x) printf("\t" #x " = 0x%lx\n", x);
+ ksft_test_result_fail("All GPRs except SP should be 0\n");
+#define SHOW(x) ksft_print_msg("\t" #x " = 0x%lx\n", x);
SHOW(ax);
SHOW(bx);
SHOW(cx);
@@ -85,17 +85,15 @@ int main()
SHOW(r14);
SHOW(r15);
#endif
- nerrs++;
} else {
- printf("[OK]\tAll GPRs except SP are 0\n");
+ ksft_test_result_pass("All GPRs except SP are 0\n");
}
if (flags != 0x202) {
- printf("[FAIL]\tFLAGS is 0x%lx, but it should be 0x202\n", flags);
- nerrs++;
+ ksft_test_result_fail("FLAGS is 0x%lx, but it should be 0x202\n", flags);
} else {
- printf("[OK]\tFLAGS is 0x202\n");
+ ksft_test_result_pass("FLAGS is 0x202\n");
}
- return nerrs ? 1 : 0;
+ ksft_finished();
}
--
2.39.2
next prev parent reply other threads:[~2024-04-14 13:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-14 13:18 [PATCH 0/4] selftest: x86: conform tests " Muhammad Usama Anjum
2024-04-14 13:18 ` Muhammad Usama Anjum [this message]
2024-04-14 13:18 ` [PATCH 2/4] selftests: x86: corrupt_xstate_header: conform test " Muhammad Usama Anjum
2024-04-14 13:18 ` [PATCH 3/4] selftests: fsgsbase_restore: " Muhammad Usama Anjum
2024-04-14 13:18 ` [PATCH 4/4] selftests: entry_from_vm86: " Muhammad Usama Anjum
2024-04-22 12:36 ` [PATCH 0/4] selftest: x86: conform tests " Muhammad Usama Anjum
2024-05-28 5:02 ` Muhammad Usama Anjum
2024-05-28 5:04 ` Muhammad Usama Anjum
2024-06-07 20:52 ` Shuah Khan
2024-06-10 5:19 ` Muhammad Usama Anjum
2024-07-02 10:17 ` Muhammad Usama Anjum
2024-07-09 23:39 ` Shuah Khan
2024-07-10 8:58 ` Muhammad Usama Anjum
2024-07-11 16:14 ` 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=20240414131807.2253344-2-usama.anjum@collabora.com \
--to=usama.anjum@collabora.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.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®