From: Michael Ellerman <mpe@ellerman.id.au>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 9/9] selftests/powerpc: Properly handle failure in switch_endian_test
Date: Wed, 19 Aug 2020 11:57:27 +1000 [thread overview]
Message-ID: <20200819015727.1977134-9-mpe@ellerman.id.au> (raw)
In-Reply-To: <20200819015727.1977134-1-mpe@ellerman.id.au>
On older CPUs the switch_endian() syscall doesn't work. Currently that
causes the switch_endian_test to just crash. Instead detect the
failure and properly exit with a failure message.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
.../switch_endian/switch_endian_test.S | 23 +++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S b/tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S
index cc4930467235..7887f78cf072 100644
--- a/tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S
+++ b/tools/testing/selftests/powerpc/switch_endian/switch_endian_test.S
@@ -3,9 +3,13 @@
.data
.balign 8
-message:
+success_message:
.ascii "success: switch_endian_test\n\0"
+ .balign 8
+failure_message:
+ .ascii "failure: switch_endian_test\n\0"
+
.section ".toc"
.balign 8
pattern:
@@ -64,6 +68,9 @@ FUNC_START(_start)
li r0, __NR_switch_endian
sc
+ tdi 0, 0, 0x48 // b +8 if the endian was switched
+ b .Lfail // exit if endian didn't switch
+
#include "check-reversed.S"
/* Flip back, r0 already has the switch syscall number */
@@ -71,12 +78,20 @@ FUNC_START(_start)
#include "check.S"
+ ld r4, success_message@got(%r2)
+ li r5, 28 // strlen(success_message)
+ li r14, 0 // exit status
+.Lout:
li r0, __NR_write
li r3, 1 /* stdout */
- ld r4, message@got(%r2)
- li r5, 28 /* strlen(message3) */
sc
li r0, __NR_exit
- li r3, 0
+ mr r3, r14
sc
b .
+
+.Lfail:
+ ld r4, failure_message@got(%r2)
+ li r5, 28 // strlen(failure_message)
+ li r14, 1
+ b .Lout
--
2.25.1
next prev parent reply other threads:[~2020-08-19 2:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 1:57 [PATCH 1/9] selftests/powerpc: Make using_hash_mmu() work on Cell & PowerMac Michael Ellerman
2020-08-19 1:57 ` [PATCH 2/9] selftests/powerpc: Give the bad_accesses test longer to run Michael Ellerman
2020-08-19 1:57 ` [PATCH 3/9] selftests/powerpc: Move set_dscr() into rfi_flush.c Michael Ellerman
2020-08-19 1:57 ` [PATCH 4/9] selftests/powerpc: Include asm/cputable.h from utils.h Michael Ellerman
2020-08-19 1:57 ` [PATCH 5/9] selftests/powerpc: Don't run DSCR tests on old systems Michael Ellerman
2020-08-19 1:57 ` [PATCH 6/9] selftests/powerpc: Skip security tests on older CPUs Michael Ellerman
2020-08-19 1:57 ` [PATCH 7/9] selftests/powerpc: Skip L3 bank test " Michael Ellerman
2020-08-19 1:57 ` [PATCH 8/9] selftests/powerpc: Don't touch VMX/VSX " Michael Ellerman
2020-08-19 1:57 ` Michael Ellerman [this message]
2020-09-09 13:27 ` [PATCH 1/9] selftests/powerpc: Make using_hash_mmu() work on Cell & PowerMac Michael Ellerman
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=20200819015727.1977134-9-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=linuxppc-dev@ozlabs.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