[LTP] [PATCH] endian_switch01.c: drop unused main4()

Jan Stancek jstancek@redhat.com
Fri Mar 10 08:10:10 CET 2023


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



More information about the ltp mailing list