Subject: Re: [PATCH V10 17/28] selftests, powerpc: Add ptrace tests for EBB

From: Anshuman Khandual <[email-masked]>
Date: Wed, 02 Mar 2016 14:29:28 +0530

On 03/02/2016 06:02 AM, Cyril Bur wrote:
> On Tue, 16 Feb 2016 14:29:47 +0530
> Anshuman Khandual <[email-masked]> wrote:
> 
>> This patch adds ptrace interface test for EBB specific
>> registers. This also adds some generic ptrace interface
>> based helper functions to be used by other patches later
>> on in the series.
>>
>> Signed-off-by: Anshuman Khandual <[email-masked]>
>> ---
>>  tools/testing/selftests/powerpc/Makefile           |   3 +-
>>  tools/testing/selftests/powerpc/ptrace/Makefile    |   7 +
>>  .../testing/selftests/powerpc/ptrace/ptrace-ebb.c  | 150 ++++++++++++++
>>  .../testing/selftests/powerpc/ptrace/ptrace-ebb.h  | 103 ++++++++++
>>  tools/testing/selftests/powerpc/ptrace/ptrace.h    | 225 +++++++++++++++++++++
>>  5 files changed, 487 insertions(+), 1 deletion(-)
>>  create mode 100644 tools/testing/selftests/powerpc/ptrace/Makefile
>>  create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c
>>  create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-ebb.h
>>  create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace.h
>>
>> diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
>> index 0c2706b..5b3c62c 100644
>> --- a/tools/testing/selftests/powerpc/Makefile
>> +++ b/tools/testing/selftests/powerpc/Makefile
>> @@ -22,7 +22,8 @@ SUB_DIRS = benchmarks 		\
>>  	   switch_endian	\
>>  	   syscalls		\
>>  	   tm			\
>> -	   vphn
>> +	   vphn			\
>> +	   ptrace
>>  
>>  endif
>>  
>> diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
>> new file mode 100644
>> index 0000000..8666ac0
>> --- /dev/null
>> +++ b/tools/testing/selftests/powerpc/ptrace/Makefile
>> @@ -0,0 +1,7 @@
>> +TEST_PROGS := ptrace-ebb
>> +all: $(TEST_PROGS)
>> +
>> +$(TEST_PROGS): ../harness.c ptrace.S ../utils.c
>> +ptrace-ebb: ../pmu/event.c ../pmu/lib.c ../pmu/ebb/ebb_handler.S ../pmu/ebb/busy_loop.S
>> +clean:
>> +	rm -f $(TEST_PROGS) *.o
> 
> If you:
> include ../../lib.mk
> 
> Then this Makefile just works with run_tests and install targets from the
> base Makefile

Sure, will do that.

> 
>> diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c b/tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c
>> new file mode 100644
>> index 0000000..e1ca608
>> --- /dev/null
>> +++ b/tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c
>> @@ -0,0 +1,150 @@
>> +/*
>> + * Ptrace interface test for EBB
>> + *
>> + * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version
>> + * 2 of the License, or (at your option) any later version.
>> + */
>> +#include "../pmu/ebb/ebb.h"
>> +#include "ptrace.h"
>> +#include "ptrace-ebb.h"
>> +
> 
> Check out tools/testing/selftests/powerpc/utils.h which provides a nice (and
> super hacky) FAIL_IF() macro.

Sure, will check it out and see where all it can be used.