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

Cyril Hrubis chrubis@suse.cz
Thu Jan 26 11:35:07 CET 2023


Hi!
> 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");
                          ^
			  Maybe I would change this to be closer to the
			  original, so that it's clear that a piece of
			  code needs to be written for the test to be
			  enabled and that this is not inherently not
			  supported

Something as:

	TST_TEST_TCONF("Signal handler for this architecture hasn't been written");


Other than this it looks fine, with a better message:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list