Re: [PATCH] perf jit: move test functionality in to a test

From: Ian Rogers
Date: Wed Nov 27 2019 - 13:49:45 EST


On Wed, Nov 27, 2019 at 8:06 AM Arnaldo Carvalho de Melo
<arnaldo.melo@xxxxxxxxx> wrote:
>
> Em Wed, Nov 27, 2019 at 12:23:28PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Nov 26, 2019 at 03:59:13PM -0800, Ian Rogers escreveu:
> > > Adds a test for minimal jit_write_elf functionality.
> >
> > Thanks, tested and applied.
>
> Had to apply this to have it built in systems where HAVE_JITDUMP isn't
> defined:

Thanks for fixing this!
Ian

> diff --git a/tools/perf/tests/genelf.c b/tools/perf/tests/genelf.c
> index d392e9300881..28dfd17a6b9f 100644
> --- a/tools/perf/tests/genelf.c
> +++ b/tools/perf/tests/genelf.c
> @@ -17,16 +17,15 @@
>
> #define TEMPL "/tmp/perf-test-XXXXXX"
>
> -static unsigned char x86_code[] = {
> - 0xBB, 0x2A, 0x00, 0x00, 0x00, /* movl $42, %ebx */
> - 0xB8, 0x01, 0x00, 0x00, 0x00, /* movl $1, %eax */
> - 0xCD, 0x80 /* int $0x80 */
> -};
> -
> int test__jit_write_elf(struct test *test __maybe_unused,
> int subtest __maybe_unused)
> {
> #ifdef HAVE_JITDUMP
> + static unsigned char x86_code[] = {
> + 0xBB, 0x2A, 0x00, 0x00, 0x00, /* movl $42, %ebx */
> + 0xB8, 0x01, 0x00, 0x00, 0x00, /* movl $1, %eax */
> + 0xCD, 0x80 /* int $0x80 */
> + };
> char path[PATH_MAX];
> int fd, ret;
>
> @@ -48,6 +47,6 @@ int test__jit_write_elf(struct test *test __maybe_unused,
>
> return ret ? TEST_FAIL : 0;
> #else
> - return TEST_SKIPPED;
> + return TEST_SKIP;
> #endif
> }
>
>