public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] endian_switch01.c: drop unused main4()
@ 2023-03-10  7:10 Jan Stancek
  2023-03-10  7:30 ` Petr Vorel
  2023-03-13 14:28 ` Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Stancek @ 2023-03-10  7:10 UTC (permalink / raw)
  To: ltp

Drop the unused main4() and move AT_HWCAP check to check_le_switch_supported().
Tested on RHEL7.9 3.10 based kernel, and RHEL9.0 5.14.0 based kernel.

Acked-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 .../kernel/syscalls/switch/endian_switch01.c    | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/testcases/kernel/syscalls/switch/endian_switch01.c b/testcases/kernel/syscalls/switch/endian_switch01.c
index eae193fc15f2..d965aed56dfd 100644
--- a/testcases/kernel/syscalls/switch/endian_switch01.c
+++ b/testcases/kernel/syscalls/switch/endian_switch01.c
@@ -15,6 +15,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <elf.h>
+#include <sys/auxv.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include "tst_test.h"
@@ -40,6 +41,9 @@ void check_le_switch_supported(void)
 		exit(errno);
 	}
 
+	if (!(getauxval(AT_HWCAP) & PPC_FEATURE_TRUE_LE))
+		tst_brk(TCONF, "Processor does not support little-endian mode");
+
 	SAFE_WAIT(&status);
 	if (WIFSIGNALED(status)) {
 		int sig = WTERMSIG(status);
@@ -94,19 +98,6 @@ static struct tst_test test = {
 	.forks_child = 1,
 };
 
-int main4(int argc, char **argv, LTP_ATTRIBUTE_UNUSED char **envp,
-	unsigned long *auxv)
-{
-	for (; *auxv != AT_NULL && *auxv != AT_HWCAP; auxv += 2)
-		;
-
-	if (!(auxv[0] == AT_HWCAP && (auxv[1] & PPC_FEATURE_TRUE_LE)))
-		tst_brk(TCONF, "Processor does not support little-endian mode");
-
-	tst_run_tcases(argc, argv, &test);
-	return 0;
-}
-
 #else /* defined (__powerpc64__) || (__powerpc__) */
 TST_TEST_TCONF("This system does not support running of switch() syscall");
 #endif
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-13 17:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10  7:10 [LTP] [PATCH] endian_switch01.c: drop unused main4() Jan Stancek
2023-03-10  7:30 ` Petr Vorel
2023-03-13 14:28 ` Cyril Hrubis
2023-03-13 17:17   ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox