[LTP] [PATCH 2/2] hugemmap15.c: Use TST_TEST_TCONF() for unsupported archs

Petr Vorel
2023-01-25T22:27:31Z

15625f6185 broke LTP build at least on riscv32 and mipsel32
(and for any new arch in the future). Replace #error directive with
TST_TEST_TCONF() fixes that.

Fixes: 15625f6185 ("Hugetlb: Migrating libhugetlbfs icache-hygiene")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
index 4730d8d184..836225acd8 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
@@ -19,6 +19,13 @@
*/

#define _GNU_SOURCE
+
+#include "hugetlb.h"
+#if defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || \
+ defined(__s390__) || defined(__s390x__) || defined(__sparc__) || \
+ defined(__aarch64__) || (defined(__riscv) && __riscv_xlen == 64) || \
+ defined(__i386__) || defined(__x86_64__) || defined(__arm__)
+
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
@@ -30,8 +37,6 @@
#include <sys/param.h>
#include <sys/types.h>

-#include "hugetlb.h"
-
#define SUCC_JMP 1
#define FAIL_JMP 2
#define COPY_SIZE 128
@@ -142,8 +147,6 @@ static void sig_handler(int signum, siginfo_t *si, void *uc)
siglongjmp(sig_escape, FAIL_JMP + SIGSEGV);
}
#endif
-#else
-#error "Need to setup signal conditions for this arch"
#endif
}

@@ -241,3 +244,6 @@ static struct tst_test test = {
.test_all = run_test,
.hugepages = {3, TST_NEEDS},
};
+#else
+ TST_TEST_TCONF("Architecture not supported");
+#endif
--
2.39.1