Re: [PATCH] tools build: Add test-reallocarray.c to test-all.c to fix the build Was: Re: reallocarray failure on centos:7 superseded by raw data API

From: Jiri Olsa
Date: Thu Feb 14 2019 - 10:56:28 EST


On Thu, Feb 14, 2019 at 12:30:18PM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

>
> Reported-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: Alexei Starovoitov <ast@xxxxxx>
> Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
> Cc: Jakub Kicinski <jakub.kicinski@xxxxxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Cc: Song Liu <songliubraving@xxxxxx>
> Cc: Yonghong Song <yhs@xxxxxx>
> Fixes: 531b014e7a2f ("tools: bpf: make use of reallocarray")
> Link: https://lkml.kernel.org/n/tip-aonqku8axii8rxki5g11w40b@xxxxxxxxxxxxxx
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>


Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

jirka

>
> diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
> index 74329957553a..e903b86b742f 100644
> --- a/tools/build/feature/test-all.c
> +++ b/tools/build/feature/test-all.c
> @@ -174,6 +174,10 @@
> # include "test-libaio.c"
> #undef main
>
> +#define main main_test_reallocarray
> +# include "test-reallocarray.c"
> +#undef main
> +
> int main(int argc, char *argv[])
> {
> main_test_libpython();
> @@ -214,6 +218,7 @@ int main(int argc, char *argv[])
> main_test_sdt();
> main_test_setns();
> main_test_libaio();
> + main_test_reallocarray();
>
> return 0;
> }
> diff --git a/tools/build/feature/test-reallocarray.c b/tools/build/feature/test-reallocarray.c
> index 8170de35150d..8f6743e31da7 100644
> --- a/tools/build/feature/test-reallocarray.c
> +++ b/tools/build/feature/test-reallocarray.c
> @@ -6,3 +6,5 @@ int main(void)
> {
> return !!reallocarray(NULL, 1, 1);
> }
> +
> +#undef _GNU_SOURCE