Re: [PATCH] selftests: breakpoints: re-order TEST_GEN_PROGS targets

2017-09-08 Thread Fathi Boudra
Shuah, should I resend?

On 29 June 2017 at 12:39, Fathi Boudra <fathi.bou...@linaro.org> wrote:
> breakpoint_test can fail on arm64 with older/unpatched glibc:
>
>  breakpoint_test_arm64.c: In function 'run_test':
>  breakpoint_test_arm64.c:170:25: error: 'TRAP_HWBKPT' undeclared (first use
>  in this function)
>
> due to glibc missing several of the TRAP_* constants in the userspace
> definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT.
> See https://sourceware.org/bugzilla/show_bug.cgi?id=21286
>
> It prevents to build step_after_suspend_test afterward, since make won't
> continue.
>
> We still want to be able to build and run the test, independently of
> breakpoint_test_arm64 build failure. Re-order TEST_GEN_PROGS to be able to
> build step_after_suspend_test first.
>
> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
> ---
>  tools/testing/selftests/breakpoints/Makefile | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/breakpoints/Makefile 
> b/tools/testing/selftests/breakpoints/Makefile
> index 6b214b7b10fb..247b0a1899d7 100644
> --- a/tools/testing/selftests/breakpoints/Makefile
> +++ b/tools/testing/selftests/breakpoints/Makefile
> @@ -2,14 +2,14 @@
>  uname_M := $(shell uname -m 2>/dev/null || echo not)
>  ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>
> +TEST_GEN_PROGS := step_after_suspend_test
> +
>  ifeq ($(ARCH),x86)
> -TEST_GEN_PROGS := breakpoint_test
> +TEST_GEN_PROGS += breakpoint_test
>  endif
>  ifneq (,$(filter $(ARCH),aarch64 arm64))
> -TEST_GEN_PROGS := breakpoint_test_arm64
> +TEST_GEN_PROGS += breakpoint_test_arm64
>  endif
>
> -TEST_GEN_PROGS += step_after_suspend_test
> -
>  include ../lib.mk
>
> --
> 2.13.0


Re: [PATCH] selftests: breakpoints: re-order TEST_GEN_PROGS targets

2017-09-08 Thread Fathi Boudra
Shuah, should I resend?

On 29 June 2017 at 12:39, Fathi Boudra  wrote:
> breakpoint_test can fail on arm64 with older/unpatched glibc:
>
>  breakpoint_test_arm64.c: In function 'run_test':
>  breakpoint_test_arm64.c:170:25: error: 'TRAP_HWBKPT' undeclared (first use
>  in this function)
>
> due to glibc missing several of the TRAP_* constants in the userspace
> definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT.
> See https://sourceware.org/bugzilla/show_bug.cgi?id=21286
>
> It prevents to build step_after_suspend_test afterward, since make won't
> continue.
>
> We still want to be able to build and run the test, independently of
> breakpoint_test_arm64 build failure. Re-order TEST_GEN_PROGS to be able to
> build step_after_suspend_test first.
>
> Signed-off-by: Fathi Boudra 
> ---
>  tools/testing/selftests/breakpoints/Makefile | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/breakpoints/Makefile 
> b/tools/testing/selftests/breakpoints/Makefile
> index 6b214b7b10fb..247b0a1899d7 100644
> --- a/tools/testing/selftests/breakpoints/Makefile
> +++ b/tools/testing/selftests/breakpoints/Makefile
> @@ -2,14 +2,14 @@
>  uname_M := $(shell uname -m 2>/dev/null || echo not)
>  ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>
> +TEST_GEN_PROGS := step_after_suspend_test
> +
>  ifeq ($(ARCH),x86)
> -TEST_GEN_PROGS := breakpoint_test
> +TEST_GEN_PROGS += breakpoint_test
>  endif
>  ifneq (,$(filter $(ARCH),aarch64 arm64))
> -TEST_GEN_PROGS := breakpoint_test_arm64
> +TEST_GEN_PROGS += breakpoint_test_arm64
>  endif
>
> -TEST_GEN_PROGS += step_after_suspend_test
> -
>  include ../lib.mk
>
> --
> 2.13.0


Re: [PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-07-03 Thread Fathi Boudra
On 1 July 2017 at 04:48, Michael Ellerman <m...@ellerman.id.au> wrote:
> Fathi Boudra <fathi.bou...@linaro.org> writes:
>
>> On 30 June 2017 at 05:20, Bamvor Zhang Jian <bamvor.zhangj...@linaro.org> 
>> wrote:
>>> On 29 June 2017 at 19:39, Fathi Boudra <fathi.bou...@linaro.org> wrote:
>>>> On 29 June 2017 at 12:01, Michael Ellerman <m...@ellerman.id.au> wrote:
>>>>> Fathi Boudra <fathi.bou...@linaro.org> writes:
>>>>>
>>>>>> Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>>>>>> figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>>>>>
>>>>> Can you explain how it fixes the values for cross-compilation?
>>>>
>>>> When pkg-config is invoked in a cross-build environment, it will
>>>> return your sysroot headers path instead of the hardcoded
>>>> -I/usr/include/libmount
>>>>
>>>> For example in my oe environment, when I invoke "pkg-config --cflags
>>>> mount", it returns:
>>>> -I/build/tmp-rpb-glibc/sysroots/hikey/usr/include/libmount
>>> I suppose we could also pass the extra CFLAGS and LDFLAGS directly to
>>> make it work. correct?
>>
>> or use the appropriate tool for getting CFLAGS/LDFLAGS instead of:
>> 1. hardcoding it and potentially get them wrong
>> 2. expecting the user will have to take extra steps, while he can just run 
>> make
>
> Sure. But by using the "appropriate tool" you create a new dependency on
> that tool.
>
> For folks building natively it's probably not a big deal, they probably
> already have pkg-config installed, but for cross building it's another
> thing to get working.
>
> Currently most of the selftests build, and cross-build, with nothing but
> a C compiler and libc, and we should try to maintain that as much as
> possible.

As you said, most of selftests build. There's a precedent. memfd test
is also using pkg-config. That's why I followed similar approach.

> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-07-03 Thread Fathi Boudra
On 1 July 2017 at 04:48, Michael Ellerman  wrote:
> Fathi Boudra  writes:
>
>> On 30 June 2017 at 05:20, Bamvor Zhang Jian  
>> wrote:
>>> On 29 June 2017 at 19:39, Fathi Boudra  wrote:
>>>> On 29 June 2017 at 12:01, Michael Ellerman  wrote:
>>>>> Fathi Boudra  writes:
>>>>>
>>>>>> Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>>>>>> figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>>>>>
>>>>> Can you explain how it fixes the values for cross-compilation?
>>>>
>>>> When pkg-config is invoked in a cross-build environment, it will
>>>> return your sysroot headers path instead of the hardcoded
>>>> -I/usr/include/libmount
>>>>
>>>> For example in my oe environment, when I invoke "pkg-config --cflags
>>>> mount", it returns:
>>>> -I/build/tmp-rpb-glibc/sysroots/hikey/usr/include/libmount
>>> I suppose we could also pass the extra CFLAGS and LDFLAGS directly to
>>> make it work. correct?
>>
>> or use the appropriate tool for getting CFLAGS/LDFLAGS instead of:
>> 1. hardcoding it and potentially get them wrong
>> 2. expecting the user will have to take extra steps, while he can just run 
>> make
>
> Sure. But by using the "appropriate tool" you create a new dependency on
> that tool.
>
> For folks building natively it's probably not a big deal, they probably
> already have pkg-config installed, but for cross building it's another
> thing to get working.
>
> Currently most of the selftests build, and cross-build, with nothing but
> a C compiler and libc, and we should try to maintain that as much as
> possible.

As you said, most of selftests build. There's a precedent. memfd test
is also using pkg-config. That's why I followed similar approach.

> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-06-29 Thread Fathi Boudra
On 30 June 2017 at 05:20, Bamvor Zhang Jian <bamvor.zhangj...@linaro.org> wrote:
> On 29 June 2017 at 19:39, Fathi Boudra <fathi.bou...@linaro.org> wrote:
>> On 29 June 2017 at 12:01, Michael Ellerman <m...@ellerman.id.au> wrote:
>>> Fathi Boudra <fathi.bou...@linaro.org> writes:
>>>
>>>> Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>>>> figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>>>
>>> Can you explain how it fixes the values for cross-compilation?
>>
>> When pkg-config is invoked in a cross-build environment, it will
>> return your sysroot headers path instead of the hardcoded
>> -I/usr/include/libmount
>>
>> For example in my oe environment, when I invoke "pkg-config --cflags
>> mount", it returns:
>> -I/build/tmp-rpb-glibc/sysroots/hikey/usr/include/libmount
> I suppose we could also pass the extra CFLAGS and LDFLAGS directly to
> make it work. correct?

or use the appropriate tool for getting CFLAGS/LDFLAGS instead of:
1. hardcoding it and potentially get them wrong
2. expecting the user will have to take extra steps, while he can just run make

> Regards
>
> Bamvor
>>
>>> cheers
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" 
>>> in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-06-29 Thread Fathi Boudra
On 30 June 2017 at 05:20, Bamvor Zhang Jian  wrote:
> On 29 June 2017 at 19:39, Fathi Boudra  wrote:
>> On 29 June 2017 at 12:01, Michael Ellerman  wrote:
>>> Fathi Boudra  writes:
>>>
>>>> Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>>>> figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>>>
>>> Can you explain how it fixes the values for cross-compilation?
>>
>> When pkg-config is invoked in a cross-build environment, it will
>> return your sysroot headers path instead of the hardcoded
>> -I/usr/include/libmount
>>
>> For example in my oe environment, when I invoke "pkg-config --cflags
>> mount", it returns:
>> -I/build/tmp-rpb-glibc/sysroots/hikey/usr/include/libmount
> I suppose we could also pass the extra CFLAGS and LDFLAGS directly to
> make it work. correct?

or use the appropriate tool for getting CFLAGS/LDFLAGS instead of:
1. hardcoding it and potentially get them wrong
2. expecting the user will have to take extra steps, while he can just run make

> Regards
>
> Bamvor
>>
>>> cheers
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" 
>>> in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-06-29 Thread Fathi Boudra
On 29 June 2017 at 12:01, Michael Ellerman <m...@ellerman.id.au> wrote:
> Fathi Boudra <fathi.bou...@linaro.org> writes:
>
>> Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>> figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>
> Can you explain how it fixes the values for cross-compilation?

When pkg-config is invoked in a cross-build environment, it will
return your sysroot headers path instead of the hardcoded
-I/usr/include/libmount

For example in my oe environment, when I invoke "pkg-config --cflags
mount", it returns:
-I/build/tmp-rpb-glibc/sysroots/hikey/usr/include/libmount

> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-06-29 Thread Fathi Boudra
On 29 June 2017 at 12:01, Michael Ellerman  wrote:
> Fathi Boudra  writes:
>
>> Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>> figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>
> Can you explain how it fixes the values for cross-compilation?

When pkg-config is invoked in a cross-build environment, it will
return your sysroot headers path instead of the hardcoded
-I/usr/include/libmount

For example in my oe environment, when I invoke "pkg-config --cflags
mount", it returns:
-I/build/tmp-rpb-glibc/sysroots/hikey/usr/include/libmount

> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] kselftest build errors

2017-06-29 Thread Fathi Boudra
On 28 June 2017 at 17:21, Shuah Khan <sh...@kernel.org> wrote:
> On 06/28/2017 02:30 AM, Fathi Boudra wrote:
>> On 23 June 2017 at 22:44, Shuah Khan <sh...@kernel.org> wrote:
>>> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>>>> This patch series fixes build errors observed when building net, memfd, 
>>>> gpio and intel_pstate tests
>>>>
>>>> Marcin Nowakowski (3):
>>>>   selftests/{net,memfd}: fix undefined references to external libraries
>>>>   selftests/gpio: fix build error
>>>>   selftests/intel_pstate: fix undefined reference when building
>>>>
>>>>  tools/testing/selftests/gpio/Makefile | 2 +-
>>>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>>>  tools/testing/selftests/memfd/Makefile| 4 ++--
>>>>  tools/testing/selftests/net/Makefile  | 2 +-
>>>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>>>
>>>
>>> Hi Marcin,
>>>
>>> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
>>> last week. I pulled those in already.
>>>
>>> The gpio fix is something I need to look at closely to see if this is
>>> the way to go. I will get back to you on that.
>>
>> Any updates on the gpio fix? I've tested it and it works for me.
>>
>
> I haven't decided yet.

another alternative is to use realpath:
-GPIODIR := ../../../gpio
+GPIODIR := $(realpath ../../../gpio)

btw, this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=51c6bd7cbe0366b642d8ac90d98739c39ab091a9
should be reverted once the build error is addressed because they
shouldn't have been there in the first place due to lack of trailing
slash in the path.

> thanks,
> -- Shuah


Re: [PATCH 0/3] kselftest build errors

2017-06-29 Thread Fathi Boudra
On 28 June 2017 at 17:21, Shuah Khan  wrote:
> On 06/28/2017 02:30 AM, Fathi Boudra wrote:
>> On 23 June 2017 at 22:44, Shuah Khan  wrote:
>>> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>>>> This patch series fixes build errors observed when building net, memfd, 
>>>> gpio and intel_pstate tests
>>>>
>>>> Marcin Nowakowski (3):
>>>>   selftests/{net,memfd}: fix undefined references to external libraries
>>>>   selftests/gpio: fix build error
>>>>   selftests/intel_pstate: fix undefined reference when building
>>>>
>>>>  tools/testing/selftests/gpio/Makefile | 2 +-
>>>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>>>  tools/testing/selftests/memfd/Makefile| 4 ++--
>>>>  tools/testing/selftests/net/Makefile  | 2 +-
>>>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>>>
>>>
>>> Hi Marcin,
>>>
>>> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
>>> last week. I pulled those in already.
>>>
>>> The gpio fix is something I need to look at closely to see if this is
>>> the way to go. I will get back to you on that.
>>
>> Any updates on the gpio fix? I've tested it and it works for me.
>>
>
> I haven't decided yet.

another alternative is to use realpath:
-GPIODIR := ../../../gpio
+GPIODIR := $(realpath ../../../gpio)

btw, this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=51c6bd7cbe0366b642d8ac90d98739c39ab091a9
should be reverted once the build error is addressed because they
shouldn't have been there in the first place due to lack of trailing
slash in the path.

> thanks,
> -- Shuah


Re: [PATCH v2] selftests: add a generic testsuite for ethernet device

2017-06-29 Thread Fathi Boudra
On 4 April 2017 at 16:32, Corentin Labbe  wrote:
> This patch add a generic testsuite for testing ethernet network device driver.
>
> Signed-off-by: Corentin Labbe 
> ---
>
> Changes since v1:
> - Test for starting master interface
> - Changed printing format to "RESULT: $netdev: line"
> - Use "ip link" to get device list
>
>  tools/testing/selftests/net/Makefile |   2 +-
>  tools/testing/selftests/net/netdevice.sh | 200 
> +++
>  2 files changed, 201 insertions(+), 1 deletion(-)
>  create mode 100755 tools/testing/selftests/net/netdevice.sh
>
> diff --git a/tools/testing/selftests/net/Makefile 
> b/tools/testing/selftests/net/Makefile
> index fbfe5d0..35cbb4c 100644
> --- a/tools/testing/selftests/net/Makefile
> +++ b/tools/testing/selftests/net/Makefile
> @@ -5,7 +5,7 @@ CFLAGS += -I../../../../usr/include/
>
>  reuseport_bpf_numa: LDFLAGS += -lnuma
>
> -TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh
> +TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
>  TEST_GEN_FILES =  socket
>  TEST_GEN_FILES += psock_fanout psock_tpacket
>  TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
> diff --git a/tools/testing/selftests/net/netdevice.sh 
> b/tools/testing/selftests/net/netdevice.sh
> new file mode 100755
> index 000..4e00568
> --- /dev/null
> +++ b/tools/testing/selftests/net/netdevice.sh
> @@ -0,0 +1,200 @@
> +#!/bin/sh
> +#
> +# This test is for checking network interface
> +# For the moment it tests only ethernet interface (but wifi could be easily 
> added)
> +#
> +# We assume that all network driver are loaded
> +# if not they probably have failed earlier in the boot process and their 
> logged error will be catched by another test
> +#
> +
> +# this function will try to up the interface
> +# if already up, nothing done
> +# arg1: network interface name
> +kci_net_start()
> +{
> +   netdev=$1
> +
> +   ip link show "$netdev" |grep -q UP
> +   if [ $? -eq 0 ];then
> +   echo "SKIP: $netdev: interface already up"
> +   return 0
> +   fi
> +
> +   ip link set "$netdev" up
> +   if [ $? -ne 0 ];then
> +   echo "FAIL: $netdev: Fail to up interface"
> +   return 1
> +   else
> +   echo "PASS: $netdev: set interface up"
> +   NETDEV_STARTED=1
> +   fi
> +   return 0
> +}
> +
> +# this function will try to setup an IP and MAC address on a network 
> interface
> +# Doing nothing if the interface was already up
> +# arg1: network interface name
> +kci_net_setup()
> +{
> +   netdev=$1
> +
> +   # do nothing if the interface was already up
> +   if [ $NETDEV_STARTED -eq 0 ];then
> +   return 0
> +   fi
> +
> +   MACADDR='02:03:04:05:06:07'
> +   ip link set dev $netdev address "$MACADDR"
> +   if [ $? -ne 0 ];then
> +   echo "FAIL: $netdev: Cannot set MAC address"
> +   else
> +   ip link show $netdev |grep -q "$MACADDR"
> +   if [ $? -eq 0 ];then
> +   echo "PASS: $netdev: set MAC address"
> +   else
> +   echo "FAIL: $netdev: Cannot set MAC address"
> +   fi
> +   fi
> +
> +   #check that the interface did not already have an IP
> +   ip address show "$netdev" |grep '^[[:space:]]*inet'
> +   if [ $? -eq 0 ];then
> +   echo "SKIP: $netdev: already have an IP"
> +   return 0
> +   fi
> +
> +   # TODO what ipaddr to set ? DHCP ?
> +   echo "SKIP: $netdev: set IP address"
> +   return 0
> +}
> +
> +# test an ethtool command
> +# arg1: return code for not supported (see ethtool code source)
> +# arg2: summary of the command
> +# arg3: command to execute
> +kci_netdev_ethtool_test()
> +{
> +   if [ $# -le 2 ];then
> +   echo "SKIP: $netdev: ethtool: invalid number of arguments"
> +   return 1
> +   fi
> +   $3 >/dev/null
> +   ret=$?
> +   if [ $ret -ne 0 ];then
> +   if [ $ret -eq "$1" ];then
> +   echo "SKIP: $netdev: ethtool $2 not supported"
> +   else
> +   echo "FAIL: $netdev: ethtool $2"
> +   return 1
> +   fi
> +   else
> +   echo "PASS: $netdev: ethtool $2"
> +   fi
> +   return 0
> +}
> +
> +# test ethtool commands
> +# arg1: network interface name
> +kci_netdev_ethtool()
> +{
> +   netdev=$1
> +
> +   #check presence of ethtool
> +   ethtool --version 2>/dev/null >/dev/null
> +   if [ $? -ne 0 ];then
> +   echo "SKIP: ethtool not present"
> +   return 1
> +   fi
> +
> +   TMP_ETHTOOL_FEATURES="$(mktemp)"
> +   if [ ! -e "$TMP_ETHTOOL_FEATURES" ];then
> +   echo "SKIP: Cannot create a tmp file"
> +   return 1
> +   fi
> 

Re: [PATCH v2] selftests: add a generic testsuite for ethernet device

2017-06-29 Thread Fathi Boudra
On 4 April 2017 at 16:32, Corentin Labbe  wrote:
> This patch add a generic testsuite for testing ethernet network device driver.
>
> Signed-off-by: Corentin Labbe 
> ---
>
> Changes since v1:
> - Test for starting master interface
> - Changed printing format to "RESULT: $netdev: line"
> - Use "ip link" to get device list
>
>  tools/testing/selftests/net/Makefile |   2 +-
>  tools/testing/selftests/net/netdevice.sh | 200 
> +++
>  2 files changed, 201 insertions(+), 1 deletion(-)
>  create mode 100755 tools/testing/selftests/net/netdevice.sh
>
> diff --git a/tools/testing/selftests/net/Makefile 
> b/tools/testing/selftests/net/Makefile
> index fbfe5d0..35cbb4c 100644
> --- a/tools/testing/selftests/net/Makefile
> +++ b/tools/testing/selftests/net/Makefile
> @@ -5,7 +5,7 @@ CFLAGS += -I../../../../usr/include/
>
>  reuseport_bpf_numa: LDFLAGS += -lnuma
>
> -TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh
> +TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
>  TEST_GEN_FILES =  socket
>  TEST_GEN_FILES += psock_fanout psock_tpacket
>  TEST_GEN_FILES += reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
> diff --git a/tools/testing/selftests/net/netdevice.sh 
> b/tools/testing/selftests/net/netdevice.sh
> new file mode 100755
> index 000..4e00568
> --- /dev/null
> +++ b/tools/testing/selftests/net/netdevice.sh
> @@ -0,0 +1,200 @@
> +#!/bin/sh
> +#
> +# This test is for checking network interface
> +# For the moment it tests only ethernet interface (but wifi could be easily 
> added)
> +#
> +# We assume that all network driver are loaded
> +# if not they probably have failed earlier in the boot process and their 
> logged error will be catched by another test
> +#
> +
> +# this function will try to up the interface
> +# if already up, nothing done
> +# arg1: network interface name
> +kci_net_start()
> +{
> +   netdev=$1
> +
> +   ip link show "$netdev" |grep -q UP
> +   if [ $? -eq 0 ];then
> +   echo "SKIP: $netdev: interface already up"
> +   return 0
> +   fi
> +
> +   ip link set "$netdev" up
> +   if [ $? -ne 0 ];then
> +   echo "FAIL: $netdev: Fail to up interface"
> +   return 1
> +   else
> +   echo "PASS: $netdev: set interface up"
> +   NETDEV_STARTED=1
> +   fi
> +   return 0
> +}
> +
> +# this function will try to setup an IP and MAC address on a network 
> interface
> +# Doing nothing if the interface was already up
> +# arg1: network interface name
> +kci_net_setup()
> +{
> +   netdev=$1
> +
> +   # do nothing if the interface was already up
> +   if [ $NETDEV_STARTED -eq 0 ];then
> +   return 0
> +   fi
> +
> +   MACADDR='02:03:04:05:06:07'
> +   ip link set dev $netdev address "$MACADDR"
> +   if [ $? -ne 0 ];then
> +   echo "FAIL: $netdev: Cannot set MAC address"
> +   else
> +   ip link show $netdev |grep -q "$MACADDR"
> +   if [ $? -eq 0 ];then
> +   echo "PASS: $netdev: set MAC address"
> +   else
> +   echo "FAIL: $netdev: Cannot set MAC address"
> +   fi
> +   fi
> +
> +   #check that the interface did not already have an IP
> +   ip address show "$netdev" |grep '^[[:space:]]*inet'
> +   if [ $? -eq 0 ];then
> +   echo "SKIP: $netdev: already have an IP"
> +   return 0
> +   fi
> +
> +   # TODO what ipaddr to set ? DHCP ?
> +   echo "SKIP: $netdev: set IP address"
> +   return 0
> +}
> +
> +# test an ethtool command
> +# arg1: return code for not supported (see ethtool code source)
> +# arg2: summary of the command
> +# arg3: command to execute
> +kci_netdev_ethtool_test()
> +{
> +   if [ $# -le 2 ];then
> +   echo "SKIP: $netdev: ethtool: invalid number of arguments"
> +   return 1
> +   fi
> +   $3 >/dev/null
> +   ret=$?
> +   if [ $ret -ne 0 ];then
> +   if [ $ret -eq "$1" ];then
> +   echo "SKIP: $netdev: ethtool $2 not supported"
> +   else
> +   echo "FAIL: $netdev: ethtool $2"
> +   return 1
> +   fi
> +   else
> +   echo "PASS: $netdev: ethtool $2"
> +   fi
> +   return 0
> +}
> +
> +# test ethtool commands
> +# arg1: network interface name
> +kci_netdev_ethtool()
> +{
> +   netdev=$1
> +
> +   #check presence of ethtool
> +   ethtool --version 2>/dev/null >/dev/null
> +   if [ $? -ne 0 ];then
> +   echo "SKIP: ethtool not present"
> +   return 1
> +   fi
> +
> +   TMP_ETHTOOL_FEATURES="$(mktemp)"
> +   if [ ! -e "$TMP_ETHTOOL_FEATURES" ];then
> +   echo "SKIP: Cannot create a tmp file"
> +   return 1
> +   fi
> +
> +   ethtool -k "$netdev" > 

[PATCH v2 1/3] selftests: net: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
reuseport_bpf_numa fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc
 --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
 -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
 -o
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
 /tmp/ccfUuExT.o: In function `send_from_node':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
 undefined reference to `numa_run_on_node'
 /tmp/ccfUuExT.o: In function `main':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
 undefined reference to `numa_available'
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
 undefined reference to `numa_max_node'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libnuma.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/net/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index f6c9dbf478f8..7236427d083e 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -11,4 +11,4 @@ TEST_GEN_FILES += reuseport_dualstack
 
 include ../lib.mk
 
-$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
+$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
-- 
2.13.0



[PATCH v2 1/3] selftests: net: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
reuseport_bpf_numa fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc
 --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
 -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
 -o
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
 /tmp/ccfUuExT.o: In function `send_from_node':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
 undefined reference to `numa_run_on_node'
 /tmp/ccfUuExT.o: In function `main':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
 undefined reference to `numa_available'
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
 undefined reference to `numa_max_node'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libnuma.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/net/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index f6c9dbf478f8..7236427d083e 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -11,4 +11,4 @@ TEST_GEN_FILES += reuseport_dualstack
 
 include ../lib.mk
 
-$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
+$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
-- 
2.13.0



[PATCH v2 3/3] selftests: timers: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
posix_timers fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Denys Dmytriyenko <de...@ti.com>
Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/timers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privileges
-- 
2.13.0



[PATCH v2 3/3] selftests: timers: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
posix_timers fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Denys Dmytriyenko 
Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/timers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privileges
-- 
2.13.0



[PATCH v2 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
 reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_one_divergence':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2125:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2143:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2145:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_not_under_filter':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2169:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2202:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2227:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile 
b/tools/testing/selftests/seccomp/Makefile
index aeb0c805f3ca..7c0afc3c8aef 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,8 +1,8 @@
 TEST_GEN_PROGS := seccomp_bpf
 CFLAGS += -Wl,-no-as-needed -Wall
-LDFLAGS += -lpthread
+LDLIBS += -lpthread
 
 include ../lib.mk
 
 $(TEST_GEN_PROGS): seccomp_bpf.c ../kselftest_harness.h
-   $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
+   $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@
-- 
2.13.0



[PATCH v2 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
 reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_one_divergence':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2125:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2143:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2145:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_not_under_filter':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2169:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2202:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2227:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile 
b/tools/testing/selftests/seccomp/Makefile
index aeb0c805f3ca..7c0afc3c8aef 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,8 +1,8 @@
 TEST_GEN_PROGS := seccomp_bpf
 CFLAGS += -Wl,-no-as-needed -Wall
-LDFLAGS += -lpthread
+LDLIBS += -lpthread
 
 include ../lib.mk
 
 $(TEST_GEN_PROGS): seccomp_bpf.c ../kselftest_harness.h
-   $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
+   $(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@
-- 
2.13.0



[PATCH v2 0/3] selftests: fixes for undefined reference (LDFLAGS -> LDLIBS)

2017-06-29 Thread Fathi Boudra
This serie fixes undefined reference errors caused by the usage of LDFLAGS
instead of LDLIBS.

The issue is GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters.

Changes in v2:
  * address SeongJae Park comment: instead of replacing LDFLAGS, append LDLIBS
in the right order.

Fathi Boudra (3):
  selftests: net: use LDLIBS instead of LDFLAGS
  selftests: seccomp: use LDLIBS instead of LDFLAGS
  selftests: timers: use LDLIBS instead of LDFLAGS

 tools/testing/selftests/net/Makefile | 2 +-
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 tools/testing/selftests/timers/Makefile  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.13.0



[PATCH v2 0/3] selftests: fixes for undefined reference (LDFLAGS -> LDLIBS)

2017-06-29 Thread Fathi Boudra
This serie fixes undefined reference errors caused by the usage of LDFLAGS
instead of LDLIBS.

The issue is GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters.

Changes in v2:
  * address SeongJae Park comment: instead of replacing LDFLAGS, append LDLIBS
in the right order.

Fathi Boudra (3):
  selftests: net: use LDLIBS instead of LDFLAGS
  selftests: seccomp: use LDLIBS instead of LDFLAGS
  selftests: timers: use LDLIBS instead of LDFLAGS

 tools/testing/selftests/net/Makefile | 2 +-
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 tools/testing/selftests/timers/Makefile  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.13.0



Re: [PATCH 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
On 29 June 2017 at 00:40, sjpark <sj38.p...@gmail.com> wrote:
> Hi Fathi,
>
> On Wed, 28 Jun 2017, Fathi Boudra wrote:
>
>> seccomp_bpf fails to build due to undefined reference errors:
>>
>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>  -O2 -pipe -g -feliminate-unused-debug-types -Wl,-no-as-needed -Wall
>>  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lpthread seccomp_bpf.c -o
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf
>>  /tmp/ccrlR3MW.o: In function `tsync_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920:
>>  undefined reference to `sem_post'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920:
>>  undefined reference to `sem_post'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_setup':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1863:
>>  undefined reference to `sem_init'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_teardown':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1904:
>>  undefined reference to `sem_destroy'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1897:
>>  undefined reference to `pthread_kill'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1898:
>>  undefined reference to `pthread_cancel'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1899:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_siblings_fail_prctl':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1978:
>>  undefined reference to `sem_wait'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1990:
>>  undefined reference to `pthread_join'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1992:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_ancestor':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2016:
>>  undefined reference to `sem_wait'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2032:
>>  undefined reference to `pthread_join'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2034:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_two_sibling_want_nnp':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2046:
>>  undefined reference to `sem_wait'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2058:
>>  undefined reference to `pthread_join'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2060:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux

Re: [PATCH 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS

2017-06-29 Thread Fathi Boudra
On 29 June 2017 at 00:40, sjpark  wrote:
> Hi Fathi,
>
> On Wed, 28 Jun 2017, Fathi Boudra wrote:
>
>> seccomp_bpf fails to build due to undefined reference errors:
>>
>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>  -O2 -pipe -g -feliminate-unused-debug-types -Wl,-no-as-needed -Wall
>>  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lpthread seccomp_bpf.c -o
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf
>>  /tmp/ccrlR3MW.o: In function `tsync_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920:
>>  undefined reference to `sem_post'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1920:
>>  undefined reference to `sem_post'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_setup':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1863:
>>  undefined reference to `sem_init'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_teardown':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1904:
>>  undefined reference to `sem_destroy'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1897:
>>  undefined reference to `pthread_kill'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1898:
>>  undefined reference to `pthread_cancel'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1899:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_siblings_fail_prctl':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1978:
>>  undefined reference to `sem_wait'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1990:
>>  undefined reference to `pthread_join'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1992:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_ancestor':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2016:
>>  undefined reference to `sem_wait'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2032:
>>  undefined reference to `pthread_join'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2034:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
>>  undefined reference to `pthread_create'
>>  /tmp/ccrlR3MW.o: In function `TSYNC_two_sibling_want_nnp':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2046:
>>  undefined reference to `sem_wait'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2058:
>>  undefined reference to `pthread_join'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2060:
>>  undefined reference to `pthread_join'
>>  /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/

[PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-06-29 Thread Fathi Boudra
Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.

If pkg-config isn't installed, it gives an error (command not found) and
gpio test will fail to build because it won't be able to find the headers
or link to libmount library.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/gpio/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 298929df97e6..11eed0cdec2a 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -17,8 +17,8 @@ override define CLEAN
$(RM) -r $(EXTRA_DIRS)
 endef
 
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
+CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(shell 
pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
 
-- 
2.13.0



[PATCH 1/1] selftests: gpio: use pkg-config to determine libmount CFLAGS/LDLIBS

2017-06-29 Thread Fathi Boudra
Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.

If pkg-config isn't installed, it gives an error (command not found) and
gpio test will fail to build because it won't be able to find the headers
or link to libmount library.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/gpio/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 298929df97e6..11eed0cdec2a 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -17,8 +17,8 @@ override define CLEAN
$(RM) -r $(EXTRA_DIRS)
 endef
 
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
+CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(shell 
pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
 
-- 
2.13.0



[PATCH 1/3] selftests: net: use LDLIBS instead of LDFLAGS

2017-06-28 Thread Fathi Boudra
reuseport_bpf_numa fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc
 --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
 -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
 -o
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
 /tmp/ccfUuExT.o: In function `send_from_node':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
 undefined reference to `numa_run_on_node'
 /tmp/ccfUuExT.o: In function `main':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
 undefined reference to `numa_available'
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
 undefined reference to `numa_max_node'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libnuma.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/net/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index f6c9dbf478f8..7236427d083e 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -11,4 +11,4 @@ TEST_GEN_FILES += reuseport_dualstack
 
 include ../lib.mk
 
-$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
+$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
-- 
2.13.0



[PATCH 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS

2017-06-28 Thread Fathi Boudra
 reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_one_divergence':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2125:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2143:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2145:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_not_under_filter':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2169:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2202:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2227:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile 
b/tools/testing/selftests/seccomp/Makefile
index aeb0c805f3ca..d1c74ce70f08 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,8 +1,8 @@
 TEST_GEN_PROGS := seccomp_bpf
 CFLAGS += -Wl,-no-as-needed -Wall
-LDFLAGS += -lpthread
+LDLIBS += -lpthread
 
 include ../lib.mk
 
 $(TEST_GEN_PROGS): seccomp_bpf.c ../kselftest_harness.h
-   $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
+   $(CC) $(CFLAGS) $(LDLIBS) $< -o $@
-- 
2.13.0



[PATCH 1/3] selftests: net: use LDLIBS instead of LDFLAGS

2017-06-28 Thread Fathi Boudra
reuseport_bpf_numa fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc
 --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
 -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
 -o
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
 /tmp/ccfUuExT.o: In function `send_from_node':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
 undefined reference to `numa_run_on_node'
 /tmp/ccfUuExT.o: In function `main':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
 undefined reference to `numa_available'
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
 undefined reference to `numa_max_node'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libnuma.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/net/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index f6c9dbf478f8..7236427d083e 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -11,4 +11,4 @@ TEST_GEN_FILES += reuseport_dualstack
 
 include ../lib.mk
 
-$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
+$(OUTPUT)/reuseport_bpf_numa: LDLIBS += -lnuma
-- 
2.13.0



[PATCH 2/3] selftests: seccomp: use LDLIBS instead of LDFLAGS

2017-06-28 Thread Fathi Boudra
 reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_with_one_divergence':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2125:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2143:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2145:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'
 /tmp/ccrlR3MW.o: In function `TSYNC_two_siblings_not_under_filter':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2169:
 undefined reference to `sem_wait'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2202:
 undefined reference to `pthread_join'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:2227:
 undefined reference to `pthread_join'
 /tmp/ccrlR3MW.o: In function `tsync_start_sibling':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/seccomp/seccomp_bpf.c:1941:
 undefined reference to `pthread_create'

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile 
b/tools/testing/selftests/seccomp/Makefile
index aeb0c805f3ca..d1c74ce70f08 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,8 +1,8 @@
 TEST_GEN_PROGS := seccomp_bpf
 CFLAGS += -Wl,-no-as-needed -Wall
-LDFLAGS += -lpthread
+LDLIBS += -lpthread
 
 include ../lib.mk
 
 $(TEST_GEN_PROGS): seccomp_bpf.c ../kselftest_harness.h
-   $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
+   $(CC) $(CFLAGS) $(LDLIBS) $< -o $@
-- 
2.13.0



[PATCH 3/3] selftests: timers: use LDLIBS instead of LDFLAGS

2017-06-28 Thread Fathi Boudra
posix_timers fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Denys Dmytriyenko <de...@ti.com>
Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/timers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privileges
-- 
2.13.0



[PATCH 0/3] selftests: fixes for undefined reference (LDFLAGS -> LDLIBS)

2017-06-28 Thread Fathi Boudra
This serie fixes undefined reference errors caused by the usage of LDFLAGS
instead of LDLIBS.

The issue is GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters.

Fathi Boudra (3):
  selftests: net: use LDLIBS instead of LDFLAGS
  selftests: seccomp: use LDLIBS instead of LDFLAGS
  selftests: timers: use LDLIBS instead of LDFLAGS

 tools/testing/selftests/net/Makefile | 2 +-
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 tools/testing/selftests/timers/Makefile  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.13.0



[PATCH 3/3] selftests: timers: use LDLIBS instead of LDFLAGS

2017-06-28 Thread Fathi Boudra
posix_timers fails to build due to undefined reference errors:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

It's GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters, use LDLIBS instead of LDFLAGS to properly link against
libpthread.

Signed-off-by: Denys Dmytriyenko 
Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/timers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privileges
-- 
2.13.0



[PATCH 0/3] selftests: fixes for undefined reference (LDFLAGS -> LDLIBS)

2017-06-28 Thread Fathi Boudra
This serie fixes undefined reference errors caused by the usage of LDFLAGS
instead of LDLIBS.

The issue is GNU Make and linker specific.

The default Makefile rule looks like:

$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)

When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.

More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.

LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.

https://lkml.org/lkml/2010/2/10/362

tools/perf: libraries must come after objects

Link order matters.

Fathi Boudra (3):
  selftests: net: use LDLIBS instead of LDFLAGS
  selftests: seccomp: use LDLIBS instead of LDFLAGS
  selftests: timers: use LDLIBS instead of LDFLAGS

 tools/testing/selftests/net/Makefile | 2 +-
 tools/testing/selftests/seccomp/Makefile | 4 ++--
 tools/testing/selftests/timers/Makefile  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.13.0



Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 18:11, Shuah Khan <sh...@kernel.org> wrote:
> On 06/28/2017 09:00 AM, Fathi Boudra wrote:
>> On 28 June 2017 at 17:41, Shuah Khan <sh...@kernel.org> wrote:
>>> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>>>> On 28 June 2017 at 17:20, Shuah Khan <sh...@kernel.org> wrote:
>>>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>>>> timers test fails to build due to undefined reference:
>>>>>>
>>>>>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>>>>  -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>>>>  -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>>>>  posix_timers.c
>>>>>>  -o 
>>>>>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>>>>  /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>>>>  
>>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>>>>  undefined reference to `timer_create'
>>>>>>  
>>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>>>>  undefined reference to `timer_settime'
>>>>>>  collect2: error: ld returned 1 exit status
>>>>>>
>>>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>>>> this build issue.
>>>>>>
>>>>>> Signed-off-by: Denys Dmytriyenko <de...@ti.com>
>>>>>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
>>>>>
>>>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 
>>>>> speocific
>>>>> problem? Please try this on linux-kselftest latest.
>>>>
>>>> yes, I tried linux-kselftest next and can reproduce.
>>>> Maybe related to native build vs cross-build?
>>>> I don't think it's arm64 specific.
>>>>
>>>
>>> Can you confirm that this change doesn't cause problems in native
>>> build environments.
>>
>> yes, I tested on x86 in native build environment as well. It builds
>> and run fine.
>>
>> I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
>> cleanly on linux-kselftest next branch. I'm happy to respin the serie
>> on top of next branch if you're willing to take them.
>>
>
> Yeah. I knew your series won't apply on top of linux-kselftest next just
> looking at that patches. Hence the question whether or not these problems
> have been reproduced on linux-kselftest.
>
> Please redo the patches. The net patch needs to be done on top of
>
> SeongJae Park's fix
>
> selftest/net/Makefile: Specify output with $(OUTPUT)
>
> btw - with the the above fix, I don't see any failures on x86_64.
> I am curious why it fails in cross-build? Could you figure out if
> your cross-build environment is good.

I'm using openembedded to cross-build a full distro, not only kselftest.
I'm confident my cross-build environment is good.

The issue encountered is the same as
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next=dc816e5d84cbc28baf776799839a632d6002236f

Using LDFLAGS vs LDLIBS affects the ordering of the linker flags.
* with LDFLAGS
aarch64-linux-gnu-gcc -lrt -lpthread posix_timers.c -o posix_timers
* with LDLIBS
aarch64-linux-gnu-gcc posix_timers.c -lrt -lpthread -o posix_timers

> thanks,
> -- Shuah
>
> thanks,
> -- Shuah


Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 18:11, Shuah Khan  wrote:
> On 06/28/2017 09:00 AM, Fathi Boudra wrote:
>> On 28 June 2017 at 17:41, Shuah Khan  wrote:
>>> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>>>> On 28 June 2017 at 17:20, Shuah Khan  wrote:
>>>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>>>> timers test fails to build due to undefined reference:
>>>>>>
>>>>>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>>>>  -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>>>>  -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>>>>  posix_timers.c
>>>>>>  -o 
>>>>>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>>>>  /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>>>>  
>>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>>>>  undefined reference to `timer_create'
>>>>>>  
>>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>>>>  undefined reference to `timer_settime'
>>>>>>  collect2: error: ld returned 1 exit status
>>>>>>
>>>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>>>> this build issue.
>>>>>>
>>>>>> Signed-off-by: Denys Dmytriyenko 
>>>>>> Signed-off-by: Fathi Boudra 
>>>>>
>>>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 
>>>>> speocific
>>>>> problem? Please try this on linux-kselftest latest.
>>>>
>>>> yes, I tried linux-kselftest next and can reproduce.
>>>> Maybe related to native build vs cross-build?
>>>> I don't think it's arm64 specific.
>>>>
>>>
>>> Can you confirm that this change doesn't cause problems in native
>>> build environments.
>>
>> yes, I tested on x86 in native build environment as well. It builds
>> and run fine.
>>
>> I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
>> cleanly on linux-kselftest next branch. I'm happy to respin the serie
>> on top of next branch if you're willing to take them.
>>
>
> Yeah. I knew your series won't apply on top of linux-kselftest next just
> looking at that patches. Hence the question whether or not these problems
> have been reproduced on linux-kselftest.
>
> Please redo the patches. The net patch needs to be done on top of
>
> SeongJae Park's fix
>
> selftest/net/Makefile: Specify output with $(OUTPUT)
>
> btw - with the the above fix, I don't see any failures on x86_64.
> I am curious why it fails in cross-build? Could you figure out if
> your cross-build environment is good.

I'm using openembedded to cross-build a full distro, not only kselftest.
I'm confident my cross-build environment is good.

The issue encountered is the same as
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next=dc816e5d84cbc28baf776799839a632d6002236f

Using LDFLAGS vs LDLIBS affects the ordering of the linker flags.
* with LDFLAGS
aarch64-linux-gnu-gcc -lrt -lpthread posix_timers.c -o posix_timers
* with LDLIBS
aarch64-linux-gnu-gcc posix_timers.c -lrt -lpthread -o posix_timers

> thanks,
> -- Shuah
>
> thanks,
> -- Shuah


Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 17:41, Shuah Khan <sh...@kernel.org> wrote:
> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>> On 28 June 2017 at 17:20, Shuah Khan <sh...@kernel.org> wrote:
>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>> timers test fails to build due to undefined reference:
>>>>
>>>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>>  -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>>  -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>>  posix_timers.c
>>>>  -o 
>>>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>>  /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>>  
>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>>  undefined reference to `timer_create'
>>>>  
>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>>  undefined reference to `timer_settime'
>>>>  collect2: error: ld returned 1 exit status
>>>>
>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>> this build issue.
>>>>
>>>> Signed-off-by: Denys Dmytriyenko <de...@ti.com>
>>>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
>>>
>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 
>>> speocific
>>> problem? Please try this on linux-kselftest latest.
>>
>> yes, I tried linux-kselftest next and can reproduce.
>> Maybe related to native build vs cross-build?
>> I don't think it's arm64 specific.
>>
>
> Can you confirm that this change doesn't cause problems in native
> build environments.

yes, I tested on x86 in native build environment as well. It builds
and run fine.

I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
cleanly on linux-kselftest next branch. I'm happy to respin the serie
on top of next branch if you're willing to take them.

> thanks,
> -- Shuah

Cheers,
Fathi


Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 17:41, Shuah Khan  wrote:
> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>> On 28 June 2017 at 17:20, Shuah Khan  wrote:
>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>> timers test fails to build due to undefined reference:
>>>>
>>>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>>  -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>>  -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>>  posix_timers.c
>>>>  -o 
>>>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>>  /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>>  
>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>>  undefined reference to `timer_create'
>>>>  
>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>>  undefined reference to `timer_settime'
>>>>  collect2: error: ld returned 1 exit status
>>>>
>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>> this build issue.
>>>>
>>>> Signed-off-by: Denys Dmytriyenko 
>>>> Signed-off-by: Fathi Boudra 
>>>
>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 
>>> speocific
>>> problem? Please try this on linux-kselftest latest.
>>
>> yes, I tried linux-kselftest next and can reproduce.
>> Maybe related to native build vs cross-build?
>> I don't think it's arm64 specific.
>>
>
> Can you confirm that this change doesn't cause problems in native
> build environments.

yes, I tested on x86 in native build environment as well. It builds
and run fine.

I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
cleanly on linux-kselftest next branch. I'm happy to respin the serie
on top of next branch if you're willing to take them.

> thanks,
> -- Shuah

Cheers,
Fathi


Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 17:20, Shuah Khan <sh...@kernel.org> wrote:
> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>> timers test fails to build due to undefined reference:
>>
>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>  -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>  -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>  posix_timers.c
>>  -o 
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>  /tmp/cc1FTZzT.o: In function `check_timer_create':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>  undefined reference to `timer_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>  undefined reference to `timer_settime'
>>  collect2: error: ld returned 1 exit status
>>
>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>> this build issue.
>>
>> Signed-off-by: Denys Dmytriyenko <de...@ti.com>
>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
>
> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 
> speocific
> problem? Please try this on linux-kselftest latest.

yes, I tried linux-kselftest next and can reproduce.
Maybe related to native build vs cross-build?
I don't think it's arm64 specific.

> thanks,
> -- Shuah
>
>> ---
>>  tools/testing/selftests/timers/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/timers/Makefile 
>> b/tools/testing/selftests/timers/Makefile
>> index 5fa1d7e9a915..f48d7ca9d9b1 100644
>> --- a/tools/testing/selftests/timers/Makefile
>> +++ b/tools/testing/selftests/timers/Makefile
>> @@ -1,6 +1,6 @@
>>  BUILD_FLAGS = -DKTEST
>>  CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
>> -LDFLAGS += -lrt -lpthread
>> +LDLIBS += -lrt -lpthread
>>
>>  # these are all "safe" tests that don't modify
>>  # system time or require escalated privileges
>>
>


Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 17:20, Shuah Khan  wrote:
> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>> timers test fails to build due to undefined reference:
>>
>>  aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>  -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>  -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>  posix_timers.c
>>  -o 
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>  /tmp/cc1FTZzT.o: In function `check_timer_create':
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>  undefined reference to `timer_create'
>>  
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>  undefined reference to `timer_settime'
>>  collect2: error: ld returned 1 exit status
>>
>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>> this build issue.
>>
>> Signed-off-by: Denys Dmytriyenko 
>> Signed-off-by: Fathi Boudra 
>
> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 
> speocific
> problem? Please try this on linux-kselftest latest.

yes, I tried linux-kselftest next and can reproduce.
Maybe related to native build vs cross-build?
I don't think it's arm64 specific.

> thanks,
> -- Shuah
>
>> ---
>>  tools/testing/selftests/timers/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/timers/Makefile 
>> b/tools/testing/selftests/timers/Makefile
>> index 5fa1d7e9a915..f48d7ca9d9b1 100644
>> --- a/tools/testing/selftests/timers/Makefile
>> +++ b/tools/testing/selftests/timers/Makefile
>> @@ -1,6 +1,6 @@
>>  BUILD_FLAGS = -DKTEST
>>  CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
>> -LDFLAGS += -lrt -lpthread
>> +LDLIBS += -lrt -lpthread
>>
>>  # these are all "safe" tests that don't modify
>>  # system time or require escalated privileges
>>
>


Re: [PATCH] selftests: net: use LDLIBS instead of LDFLAGS to link against libnuma

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 17:19, Shuah Khan <sh...@kernel.org> wrote:
> On 06/28/2017 05:19 AM, Fathi Boudra wrote:
>> reuseport_bpf_numa fails to build with undefined reference:
>>
>>  aarch64-linaro-linux-gcc
>>  --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
>>  -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
>>  -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
>>  -o
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
>>  /tmp/ccfUuExT.o: In function `send_from_node':
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
>>  undefined reference to `numa_run_on_node'
>>  /tmp/ccfUuExT.o: In function `main':
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
>>  undefined reference to `numa_available'
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
>>  undefined reference to `numa_max_node'
>>
>> Use LDLIBS instead of LDFLAGS to properly link against libnuma.
>>
>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
>
> Did you try this on linux-ksefltest next? It has the fix for this.

yes, I tried linux-ksefltest next and can reproduce.

> thanks,
> -- Shuah
>> ---
>>  tools/testing/selftests/net/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/net/Makefile 
>> b/tools/testing/selftests/net/Makefile
>> index 35cbb4cba410..17c732a19c4c 100644
>> --- a/tools/testing/selftests/net/Makefile
>> +++ b/tools/testing/selftests/net/Makefile
>> @@ -3,7 +3,7 @@
>>  CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
>>  CFLAGS += -I../../../../usr/include/
>>
>> -reuseport_bpf_numa: LDFLAGS += -lnuma
>> +reuseport_bpf_numa: LDLIBS += -lnuma
>>
>>  TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
>>  TEST_GEN_FILES =  socket


Re: [PATCH] selftests: net: use LDLIBS instead of LDFLAGS to link against libnuma

2017-06-28 Thread Fathi Boudra
On 28 June 2017 at 17:19, Shuah Khan  wrote:
> On 06/28/2017 05:19 AM, Fathi Boudra wrote:
>> reuseport_bpf_numa fails to build with undefined reference:
>>
>>  aarch64-linaro-linux-gcc
>>  --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
>>  -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
>>  -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
>>  -o
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
>>  /tmp/ccfUuExT.o: In function `send_from_node':
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
>>  undefined reference to `numa_run_on_node'
>>  /tmp/ccfUuExT.o: In function `main':
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
>>  undefined reference to `numa_available'
>>  
>> /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
>>  undefined reference to `numa_max_node'
>>
>> Use LDLIBS instead of LDFLAGS to properly link against libnuma.
>>
>> Signed-off-by: Fathi Boudra 
>
> Did you try this on linux-ksefltest next? It has the fix for this.

yes, I tried linux-ksefltest next and can reproduce.

> thanks,
> -- Shuah
>> ---
>>  tools/testing/selftests/net/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/net/Makefile 
>> b/tools/testing/selftests/net/Makefile
>> index 35cbb4cba410..17c732a19c4c 100644
>> --- a/tools/testing/selftests/net/Makefile
>> +++ b/tools/testing/selftests/net/Makefile
>> @@ -3,7 +3,7 @@
>>  CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
>>  CFLAGS += -I../../../../usr/include/
>>
>> -reuseport_bpf_numa: LDFLAGS += -lnuma
>> +reuseport_bpf_numa: LDLIBS += -lnuma
>>
>>  TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
>>  TEST_GEN_FILES =  socket


[PATCH] selftests: net: use LDLIBS instead of LDFLAGS to link against libnuma

2017-06-28 Thread Fathi Boudra
reuseport_bpf_numa fails to build with undefined reference:

 aarch64-linaro-linux-gcc
 --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
 -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
 -o
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
 /tmp/ccfUuExT.o: In function `send_from_node':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
 undefined reference to `numa_run_on_node'
 /tmp/ccfUuExT.o: In function `main':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
 undefined reference to `numa_available'
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
 undefined reference to `numa_max_node'

Use LDLIBS instead of LDFLAGS to properly link against libnuma.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/net/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index 35cbb4cba410..17c732a19c4c 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -3,7 +3,7 @@
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/
 
-reuseport_bpf_numa: LDFLAGS += -lnuma
+reuseport_bpf_numa: LDLIBS += -lnuma
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
 TEST_GEN_FILES =  socket
-- 
2.13.0



[PATCH] selftests: net: use LDLIBS instead of LDFLAGS to link against libnuma

2017-06-28 Thread Fathi Boudra
reuseport_bpf_numa fails to build with undefined reference:

 aarch64-linaro-linux-gcc
 --sysroot=/build/tmp-rpb-glibc/sysroots/hikey -Wall
 -Wl,--no-as-needed -O2 -g -I../../../../usr/include/  -Wl,-O1
 -Wl,--hash-style=gnu -Wl,--as-needed -lnuma  reuseport_bpf_numa.c
 -o
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa
 /tmp/ccfUuExT.o: In function `send_from_node':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:138:
 undefined reference to `numa_run_on_node'
 /tmp/ccfUuExT.o: In function `main':
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:230:
 undefined reference to `numa_available'
 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/net/reuseport_bpf_numa.c:233:
 undefined reference to `numa_max_node'

Use LDLIBS instead of LDFLAGS to properly link against libnuma.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/net/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/Makefile 
b/tools/testing/selftests/net/Makefile
index 35cbb4cba410..17c732a19c4c 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -3,7 +3,7 @@
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/
 
-reuseport_bpf_numa: LDFLAGS += -lnuma
+reuseport_bpf_numa: LDLIBS += -lnuma
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
 TEST_GEN_FILES =  socket
-- 
2.13.0



[PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
timers test fails to build due to undefined reference:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
this build issue.

Signed-off-by: Denys Dmytriyenko <de...@ti.com>
Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/timers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privileges
-- 
2.13.0



[PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread

2017-06-28 Thread Fathi Boudra
timers test fails to build due to undefined reference:

 aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
 -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
 -DKTEST  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
 posix_timers.c
 -o 
/build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
 /tmp/cc1FTZzT.o: In function `check_timer_create':
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
 undefined reference to `timer_create'
 
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
 undefined reference to `timer_settime'
 collect2: error: ld returned 1 exit status

Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
this build issue.

Signed-off-by: Denys Dmytriyenko 
Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/timers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privileges
-- 
2.13.0



Re: [PATCH 2/3] selftests/gpio: fix build error

2017-06-28 Thread Fathi Boudra
On 23 June 2017 at 13:37, Marcin Nowakowski
<marcin.nowakow...@imgtec.com> wrote:
> While building selftests/gpio, gpio-utils from linux/tools/gpio as built
> in the process as well. However, the OUTPUT make variable usage in
> selftests breaks the build system in linux/tools/gpio resulting in its
> output files placed in the selftests folder (due to lack of trailing
> slash in the path, the files are placed directly in selftests):
>
> make -f linux/tools/build/Makefile.build dir=. obj=lsgpio
> make[3]: Entering directory '/mnt/ssd/MIPS/linux-next/tools/gpio'
> CClinux/tools/testing/selftests/gpiolsgpio.o
> CClinux/tools/testing/selftests/gpiogpio-utils.o
> LDlinux/tools/testing/selftests/gpiolsgpio-in.o
>
> This pollutes the selftests directory and, most importantly, makes it
> impossible for selftests/gpio to find the object file it's looking for
> to link the test:
>
> cc -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
> gpio-mockup-chardev.c ../../../gpio/gpio-utils.o
> ../../../../usr/include/linux/gpio.h  -lmount -I/usr/include/libmount -o
> gpio-mockup-chardev
> gcc: error: ../../../gpio/gpio-utils.o: No such file or directory
>
> Fix this by clearing the OUTPUT variable when invoking linux/tools/gpio
> make to ensure it's built where expected.
>
> Note, that this solution is not ideal as the output is placed in
> linux/tools/gpio rather than a location relative to OUTPUT, but this at
> least ensures the build succeeds.
> Due to differences and complexities of selftests and linux/tools build
> systems, it's not trivial to ensure linux/tools get built properly when
> invoked recursively from selftests build and this is left as a future
> task to resolve properly.
>
> Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')
>
> Signed-off-by: Marcin Nowakowski <marcin.nowakow...@imgtec.com>

FWIW, I've tested the patch and it fixes the issue mentioned.

Tested-by: Fathi Boudra <fathi.bou...@linaro.org>

> ---
>  tools/testing/selftests/gpio/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/gpio/Makefile 
> b/tools/testing/selftests/gpio/Makefile
> index 298929d..950956e 100644
> --- a/tools/testing/selftests/gpio/Makefile
> +++ b/tools/testing/selftests/gpio/Makefile
> @@ -23,7 +23,7 @@ LDLIBS += -lmount -I/usr/include/libmount
>  $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
>
>  ../../../gpio/gpio-utils.o:
> -   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
> +   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio 
> OUTPUT=
>
>  ../../../../usr/include/linux/gpio.h:
> make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
> pwd)/../../../../usr/
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] selftests/gpio: fix build error

2017-06-28 Thread Fathi Boudra
On 23 June 2017 at 13:37, Marcin Nowakowski
 wrote:
> While building selftests/gpio, gpio-utils from linux/tools/gpio as built
> in the process as well. However, the OUTPUT make variable usage in
> selftests breaks the build system in linux/tools/gpio resulting in its
> output files placed in the selftests folder (due to lack of trailing
> slash in the path, the files are placed directly in selftests):
>
> make -f linux/tools/build/Makefile.build dir=. obj=lsgpio
> make[3]: Entering directory '/mnt/ssd/MIPS/linux-next/tools/gpio'
> CClinux/tools/testing/selftests/gpiolsgpio.o
> CClinux/tools/testing/selftests/gpiogpio-utils.o
> LDlinux/tools/testing/selftests/gpiolsgpio-in.o
>
> This pollutes the selftests directory and, most importantly, makes it
> impossible for selftests/gpio to find the object file it's looking for
> to link the test:
>
> cc -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
> gpio-mockup-chardev.c ../../../gpio/gpio-utils.o
> ../../../../usr/include/linux/gpio.h  -lmount -I/usr/include/libmount -o
> gpio-mockup-chardev
> gcc: error: ../../../gpio/gpio-utils.o: No such file or directory
>
> Fix this by clearing the OUTPUT variable when invoking linux/tools/gpio
> make to ensure it's built where expected.
>
> Note, that this solution is not ideal as the output is placed in
> linux/tools/gpio rather than a location relative to OUTPUT, but this at
> least ensures the build succeeds.
> Due to differences and complexities of selftests and linux/tools build
> systems, it's not trivial to ensure linux/tools get built properly when
> invoked recursively from selftests build and this is left as a future
> task to resolve properly.
>
> Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')
>
> Signed-off-by: Marcin Nowakowski 

FWIW, I've tested the patch and it fixes the issue mentioned.

Tested-by: Fathi Boudra 

> ---
>  tools/testing/selftests/gpio/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/gpio/Makefile 
> b/tools/testing/selftests/gpio/Makefile
> index 298929d..950956e 100644
> --- a/tools/testing/selftests/gpio/Makefile
> +++ b/tools/testing/selftests/gpio/Makefile
> @@ -23,7 +23,7 @@ LDLIBS += -lmount -I/usr/include/libmount
>  $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
>
>  ../../../gpio/gpio-utils.o:
> -   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
> +   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio 
> OUTPUT=
>
>  ../../../../usr/include/linux/gpio.h:
> make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
> pwd)/../../../../usr/
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] kselftest build errors

2017-06-28 Thread Fathi Boudra
On 23 June 2017 at 22:44, Shuah Khan  wrote:
> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>> This patch series fixes build errors observed when building net, memfd, gpio 
>> and intel_pstate tests
>>
>> Marcin Nowakowski (3):
>>   selftests/{net,memfd}: fix undefined references to external libraries
>>   selftests/gpio: fix build error
>>   selftests/intel_pstate: fix undefined reference when building
>>
>>  tools/testing/selftests/gpio/Makefile | 2 +-
>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>  tools/testing/selftests/memfd/Makefile| 4 ++--
>>  tools/testing/selftests/net/Makefile  | 2 +-
>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>
>
> Hi Marcin,
>
> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
> last week. I pulled those in already.
>
> The gpio fix is something I need to look at closely to see if this is
> the way to go. I will get back to you on that.

Any updates on the gpio fix? I've tested it and it works for me.

> thanks,
> -- Shuah
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] kselftest build errors

2017-06-28 Thread Fathi Boudra
On 23 June 2017 at 22:44, Shuah Khan  wrote:
> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>> This patch series fixes build errors observed when building net, memfd, gpio 
>> and intel_pstate tests
>>
>> Marcin Nowakowski (3):
>>   selftests/{net,memfd}: fix undefined references to external libraries
>>   selftests/gpio: fix build error
>>   selftests/intel_pstate: fix undefined reference when building
>>
>>  tools/testing/selftests/gpio/Makefile | 2 +-
>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>  tools/testing/selftests/memfd/Makefile| 4 ++--
>>  tools/testing/selftests/net/Makefile  | 2 +-
>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>
>
> Hi Marcin,
>
> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
> last week. I pulled those in already.
>
> The gpio fix is something I need to look at closely to see if this is
> the way to go. I will get back to you on that.

Any updates on the gpio fix? I've tested it and it works for me.

> thanks,
> -- Shuah
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: sync: add config fragment for testing sync framework

2017-05-11 Thread Fathi Boudra
On 11 May 2017 at 07:52, Michael Ellerman <m...@ellerman.id.au> wrote:
> Fathi Boudra <fathi.bou...@linaro.org> writes:
>
>> Unless the software synchronization objects (CONFIG_SW_SYNC) is enabled,
>> the sync test will fail:
>>
>> Additional Information:
>> Running tests in sync
>> 
>> [RUN]   Testing sync framework
>> [RUN]   Executing test_alloc_timeline
>> [ERROR] Failure allocating timeline
>
> It would be better if the test just detected that the kernel didn't
> support the API.

It makes sense to me. The sync framework has been introduced from 4.8 kernel.
It resolves the case where we run an older kernel like 4.4 LTS with a
recent kselftest.

> It seems to rely on /sys/kernel/debug/sync/sw_sync existing.
>
> How about this?

fwiw, looks good to me. I think we still need the config fragment to
leverage kselftest-merge.

> diff --git a/tools/testing/selftests/sync/sync_test.c 
> b/tools/testing/selftests/sync/sync_test.c
> index 9ea08d9f0b13..62fa666e501a 100644
> --- a/tools/testing/selftests/sync/sync_test.c
> +++ b/tools/testing/selftests/sync/sync_test.c
> @@ -29,6 +29,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include "synctest.h"
> @@ -52,10 +53,22 @@ static int run_test(int (*test)(void), char *name)
> exit(test());
>  }
>
> +static int sync_api_supported(void)
> +{
> +   struct stat sbuf;
> +
> +   return 0 == stat("/sys/kernel/debug/sync/sw_sync", );
> +}
> +
>  int main(void)
>  {
> int err = 0;
>
> +   if (!sync_api_supported()) {
> +   printf("SKIP: Sync framework not supported by kernel\n");
> +   return 0;
> +   }
> +
> printf("[RUN]\tTesting sync framework\n");
>
> err += RUN_TEST(test_alloc_timeline);
>
>
> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] selftests: sync: add config fragment for testing sync framework

2017-05-11 Thread Fathi Boudra
On 11 May 2017 at 07:52, Michael Ellerman  wrote:
> Fathi Boudra  writes:
>
>> Unless the software synchronization objects (CONFIG_SW_SYNC) is enabled,
>> the sync test will fail:
>>
>> Additional Information:
>> Running tests in sync
>> 
>> [RUN]   Testing sync framework
>> [RUN]   Executing test_alloc_timeline
>> [ERROR] Failure allocating timeline
>
> It would be better if the test just detected that the kernel didn't
> support the API.

It makes sense to me. The sync framework has been introduced from 4.8 kernel.
It resolves the case where we run an older kernel like 4.4 LTS with a
recent kselftest.

> It seems to rely on /sys/kernel/debug/sync/sw_sync existing.
>
> How about this?

fwiw, looks good to me. I think we still need the config fragment to
leverage kselftest-merge.

> diff --git a/tools/testing/selftests/sync/sync_test.c 
> b/tools/testing/selftests/sync/sync_test.c
> index 9ea08d9f0b13..62fa666e501a 100644
> --- a/tools/testing/selftests/sync/sync_test.c
> +++ b/tools/testing/selftests/sync/sync_test.c
> @@ -29,6 +29,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #include "synctest.h"
> @@ -52,10 +53,22 @@ static int run_test(int (*test)(void), char *name)
> exit(test());
>  }
>
> +static int sync_api_supported(void)
> +{
> +   struct stat sbuf;
> +
> +   return 0 == stat("/sys/kernel/debug/sync/sw_sync", );
> +}
> +
>  int main(void)
>  {
> int err = 0;
>
> +   if (!sync_api_supported()) {
> +   printf("SKIP: Sync framework not supported by kernel\n");
> +   return 0;
> +   }
> +
> printf("[RUN]\tTesting sync framework\n");
>
> err += RUN_TEST(test_alloc_timeline);
>
>
> cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] selftests: sync: add config fragment for testing sync framework

2017-05-04 Thread Fathi Boudra
Unless the software synchronization objects (CONFIG_SW_SYNC) is enabled,
the sync test will fail:

Additional Information:
Running tests in sync

[RUN]   Testing sync framework
[RUN]   Executing test_alloc_timeline
[ERROR] Failure allocating timeline
[RUN]   Executing test_alloc_fence
[ERROR] Failure allocating timeline
[RUN]   Executing test_alloc_fence_negative
[ERROR] Failure allocating timeline
[RUN]   Executing test_fence_one_timeline_wait
[ERROR] Failure allocating timeline
[RUN]   Executing test_fence_one_timeline_merge
[ERROR] Failure allocating fences
[RUN]   Executing test_fence_merge_same_fence
[ERROR] Failure allocating timeline
[RUN]   Executing test_fence_multi_timeline_wait
[ERROR] Failure merging fence from various timelines
[RUN]   Executing test_stress_two_threads_shared_timeline
[ERROR] Failure allocating timeline
[RUN]   Executing test_consumer_stress_multi_producer_single_consumer
[ERROR] Failure merging fences
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[RUN]   Executing test_merge_stress_random_merge
[ERROR] Failure creating fence
[FAIL]  sync errors: 10
selftests: sync_test [FAIL]

Add a config fragment with the relevant configuration required in order to
run the sync test.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/sync/config | 4 
 1 file changed, 4 insertions(+)
 create mode 100644 tools/testing/selftests/sync/config

diff --git a/tools/testing/selftests/sync/config 
b/tools/testing/selftests/sync/config
new file mode 100644
index ..1ab7e8130db2
--- /dev/null
+++ b/tools/testing/selftests/sync/config
@@ -0,0 +1,4 @@
+CONFIG_STAGING=y
+CONFIG_ANDROID=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
-- 
2.11.0



[PATCH 1/1] selftests: sync: add config fragment for testing sync framework

2017-05-04 Thread Fathi Boudra
Unless the software synchronization objects (CONFIG_SW_SYNC) is enabled,
the sync test will fail:

Additional Information:
Running tests in sync

[RUN]   Testing sync framework
[RUN]   Executing test_alloc_timeline
[ERROR] Failure allocating timeline
[RUN]   Executing test_alloc_fence
[ERROR] Failure allocating timeline
[RUN]   Executing test_alloc_fence_negative
[ERROR] Failure allocating timeline
[RUN]   Executing test_fence_one_timeline_wait
[ERROR] Failure allocating timeline
[RUN]   Executing test_fence_one_timeline_merge
[ERROR] Failure allocating fences
[RUN]   Executing test_fence_merge_same_fence
[ERROR] Failure allocating timeline
[RUN]   Executing test_fence_multi_timeline_wait
[ERROR] Failure merging fence from various timelines
[RUN]   Executing test_stress_two_threads_shared_timeline
[ERROR] Failure allocating timeline
[RUN]   Executing test_consumer_stress_multi_producer_single_consumer
[ERROR] Failure merging fences
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[ERROR] Failure creating fence
[RUN]   Executing test_merge_stress_random_merge
[ERROR] Failure creating fence
[FAIL]  sync errors: 10
selftests: sync_test [FAIL]

Add a config fragment with the relevant configuration required in order to
run the sync test.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/sync/config | 4 
 1 file changed, 4 insertions(+)
 create mode 100644 tools/testing/selftests/sync/config

diff --git a/tools/testing/selftests/sync/config 
b/tools/testing/selftests/sync/config
new file mode 100644
index ..1ab7e8130db2
--- /dev/null
+++ b/tools/testing/selftests/sync/config
@@ -0,0 +1,4 @@
+CONFIG_STAGING=y
+CONFIG_ANDROID=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
-- 
2.11.0



Re: [PATCH v2] selftests: gpio: add config fragment for gpio-mockup

2017-04-19 Thread Fathi Boudra
gentle ping

On 4 April 2017 at 03:52, Bamvor Zhang Jian <bamvor.zhangj...@linaro.org> wrote:
> Hi,
>
> On 31 March 2017 at 16:41, Fathi Boudra <fathi.bou...@linaro.org> wrote:
>> The gpio test requires to insert the gpio mockup module (CONFIG_GPIO_MOCKUP).
>> The gpio mockup driver depends on gpiolib (CONFIG_GPIOLIB).
>> CONFIG_GPIO_SYSFS is selected automatically by the gpio mockup driver.
>>
>> Tested on x86_64 and arm64 with defconfig and kselftest-merge.
>>
>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
> Reviewed-by: Bamvor Jian Zhang <bamvor.zhangj...@linaro.org>
>> ---
>>
>> Changes in v2:
>>  * Per Bamvor Zhang Jian review, add gpiolib dependency (CONFIG_GPIOLIB).
>>Skipped CONFIG_DEBUG_GPIO as it isn't necessary, and CONFIG_GPIO_SYSFS
>>as it's selected automatically by the gpio mockup driver.
>>
>>  tools/testing/selftests/gpio/config | 2 ++
>>  1 file changed, 2 insertions(+)
>>  create mode 100644 tools/testing/selftests/gpio/config
>>
>> diff --git a/tools/testing/selftests/gpio/config 
>> b/tools/testing/selftests/gpio/config
>> new file mode 100644
>> index ..abaa6902b7b6
>> --- /dev/null
>> +++ b/tools/testing/selftests/gpio/config
>> @@ -0,0 +1,2 @@
>> +CONFIG_GPIOLIB=y
>> +CONFIG_GPIO_MOCKUP=m
>> --
>> 2.11.0


Re: [PATCH v2] selftests: gpio: add config fragment for gpio-mockup

2017-04-19 Thread Fathi Boudra
gentle ping

On 4 April 2017 at 03:52, Bamvor Zhang Jian  wrote:
> Hi,
>
> On 31 March 2017 at 16:41, Fathi Boudra  wrote:
>> The gpio test requires to insert the gpio mockup module (CONFIG_GPIO_MOCKUP).
>> The gpio mockup driver depends on gpiolib (CONFIG_GPIOLIB).
>> CONFIG_GPIO_SYSFS is selected automatically by the gpio mockup driver.
>>
>> Tested on x86_64 and arm64 with defconfig and kselftest-merge.
>>
>> Signed-off-by: Fathi Boudra 
> Reviewed-by: Bamvor Jian Zhang 
>> ---
>>
>> Changes in v2:
>>  * Per Bamvor Zhang Jian review, add gpiolib dependency (CONFIG_GPIOLIB).
>>Skipped CONFIG_DEBUG_GPIO as it isn't necessary, and CONFIG_GPIO_SYSFS
>>as it's selected automatically by the gpio mockup driver.
>>
>>  tools/testing/selftests/gpio/config | 2 ++
>>  1 file changed, 2 insertions(+)
>>  create mode 100644 tools/testing/selftests/gpio/config
>>
>> diff --git a/tools/testing/selftests/gpio/config 
>> b/tools/testing/selftests/gpio/config
>> new file mode 100644
>> index ..abaa6902b7b6
>> --- /dev/null
>> +++ b/tools/testing/selftests/gpio/config
>> @@ -0,0 +1,2 @@
>> +CONFIG_GPIOLIB=y
>> +CONFIG_GPIO_MOCKUP=m
>> --
>> 2.11.0


Re: [PATCH 1/1] selftests: breakpoints: allow to cross-compile for aarch64/arm64

2017-04-19 Thread Fathi Boudra
gentle ping

On 22 March 2017 at 20:04, Fathi Boudra <fathi.bou...@linaro.org> wrote:
> To build breakpoint_test_arm64, ARCH value is only tested for "aarch64".
> It covers only the native build because it's computed from uname -m output.
> For cross-compilation, ARCH is set to arm64 and prevent to cross-compile
> the test.
> Fix the test to allow both native and cross-compilation of the test.
>
> Note: glibc is missing several of the TRAP_* constants in the userspace
>   definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT.
>   See https://sourceware.org/bugzilla/show_bug.cgi?id=21286
>
> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
> ---
>  tools/testing/selftests/breakpoints/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/breakpoints/Makefile 
> b/tools/testing/selftests/breakpoints/Makefile
> index 72aa103e4141..6b214b7b10fb 100644
> --- a/tools/testing/selftests/breakpoints/Makefile
> +++ b/tools/testing/selftests/breakpoints/Makefile
> @@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e 
> s/x86_64/x86/)
>  ifeq ($(ARCH),x86)
>  TEST_GEN_PROGS := breakpoint_test
>  endif
> -ifeq ($(ARCH),aarch64)
> +ifneq (,$(filter $(ARCH),aarch64 arm64))
>  TEST_GEN_PROGS := breakpoint_test_arm64
>  endif
>
> --
> 2.11.0
>


Re: [PATCH 1/1] selftests: breakpoints: allow to cross-compile for aarch64/arm64

2017-04-19 Thread Fathi Boudra
gentle ping

On 22 March 2017 at 20:04, Fathi Boudra  wrote:
> To build breakpoint_test_arm64, ARCH value is only tested for "aarch64".
> It covers only the native build because it's computed from uname -m output.
> For cross-compilation, ARCH is set to arm64 and prevent to cross-compile
> the test.
> Fix the test to allow both native and cross-compilation of the test.
>
> Note: glibc is missing several of the TRAP_* constants in the userspace
>   definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT.
>   See https://sourceware.org/bugzilla/show_bug.cgi?id=21286
>
> Signed-off-by: Fathi Boudra 
> ---
>  tools/testing/selftests/breakpoints/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/breakpoints/Makefile 
> b/tools/testing/selftests/breakpoints/Makefile
> index 72aa103e4141..6b214b7b10fb 100644
> --- a/tools/testing/selftests/breakpoints/Makefile
> +++ b/tools/testing/selftests/breakpoints/Makefile
> @@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e 
> s/x86_64/x86/)
>  ifeq ($(ARCH),x86)
>  TEST_GEN_PROGS := breakpoint_test
>  endif
> -ifeq ($(ARCH),aarch64)
> +ifneq (,$(filter $(ARCH),aarch64 arm64))
>  TEST_GEN_PROGS := breakpoint_test_arm64
>  endif
>
> --
> 2.11.0
>


Re: [PATCH v2] selftests: gpio: fix Makefile

2017-03-31 Thread Fathi Boudra
On 30 March 2017 at 16:14, Bamvor Zhang Jian
<bamvor.zhangj...@linaro.org> wrote:
> Hi, Fathi
>
> Thanks for your patch.
>
> On 28 March 2017 at 13:36, Fathi Boudra <fathi.bou...@linaro.org> wrote:
>> * Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>>   figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>>   Note: if pkg-config is missing (command not found), it will fail to
>>   build because headers can't be found or libmount library can't be
>>   linked.
>>
>> * Fix the clean target to clean up also gpio-utils.
>>
>> * Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
>>   instead of BINARIES which is not supported by the top-level lib.mk.
>>
>> * Get rid of INSTALL_HDR_PATH. We don't need it since make -C is putting
>>   us in the right location.
>>
>> * Improve readibility:
>>   - introduce GPIODIR/GPIOOBJ/GPIOINC variables
>>   - split CFLAGS on multiple lines
>>
>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
>> ---
>>
>> in v2:
>>  * per Michael Ellerman request, revert to use exported headers instead of 
>> uapi.
>>
>>  tools/testing/selftests/gpio/Makefile | 31 ++-
>>  1 file changed, 18 insertions(+), 13 deletions(-)
>>
>> diff --git a/tools/testing/selftests/gpio/Makefile 
>> b/tools/testing/selftests/gpio/Makefile
>> index 205e4d10e085..41826897af35 100644
>> --- a/tools/testing/selftests/gpio/Makefile
>> +++ b/tools/testing/selftests/gpio/Makefile
>> @@ -1,23 +1,28 @@
>> +CFLAGS += -O2 -g -std=gnu99 -Wall
>> +CFLAGS += -I../../../../usr/include/
>> +CFLAGS += $(shell pkg-config --cflags mount)
>> +LDLIBS += $(shell pkg-config --libs mount)
>>
>>  TEST_PROGS := gpio-mockup.sh
>> -TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
>> -BINARIES := gpio-mockup-chardev
>> +TEST_PROGS_EXTENDED := gpio-mockup-chardev
>> +TEST_FILES := gpio-mockup-sysfs.sh
>> +
>> +GPIODIR := ../../../gpio
>> +GPIOOBJ := gpio-utils.o
>> +GPIOINC := gpio.h
>>
>>  include ../lib.mk
>>
>> -all: $(BINARIES)
>> +all: $(GPIOINC) $(TEST_PROGS_EXTENDED)
> All the TEST_PROGS_EXTENDED should be TEST_GEN_FILES which will output to
> KBUILD_OUTPUT/O directory when it enabled.
>>
>>  clean:
>> -   $(RM) $(BINARIES)
>> -
>> -CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
>> -LDLIBS += -lmount -I/usr/include/libmount
>> -
>> -$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
>> +   $(RM) $(TEST_PROGS_EXTENDED)
>> +   $(MAKE) -C $(GPIODIR) clean
> When I enable KBUILD_OUTPUT, it will affect the output directory in
> tools/gpio and
> output to wired directory:
>
> $ make KBUILD_OUTPUT=$PWD/2001 -C tools/testing/selftests/ TARGETS=gpio
> make: Entering directory
> `/home/bamvor/works/source/kernel/linux/tools/testing/selftests'
> for TARGET in gpio; do \
> BUILD_TARGET=$BUILD/$TARGET; \
> mkdir $BUILD_TARGET -p; \
> make OUTPUT=$BUILD_TARGET -C $TARGET;\
> done;
> make[1]: Entering directory
> `/home/bamvor/works/source/kernel/linux/tools/testing/selftests/gpio'
> Makefile:19: warning: overriding commands for target `clean'
> ../lib.mk:55: warning: ignoring old commands for target `clean'
> make -C ../../../gpio
> make[2]: Entering directory 
> `/home/bamvor/works/source/kernel/linux/tools/gpio'
> mkdir -p /home/bamvor/works/source/kernel/linux/2001/gpioinclude/linux
> 2>&1 || true
> ln -sf 
> /home/bamvor/works/source/kernel/linux/tools/gpio/../../include/uapi/linux/gpio.h
> /home/bamvor/works/source/kernel/linux/2001/gpioinclude/linux/gpio.h
> make -f /home/bamvor/works/source/kernel/linux/tools/build/Makefile.build
> dir=. obj=lsgpio
> make[3]: Entering directory 
> `/home/bamvor/works/source/kernel/linux/tools/gpio'
> CC /home/bamvor/works/source/kernel/linux/2001/gpiolsgpio.o
> CC /home/bamvor/works/source/kernel/linux/2001/gpiogpio-utils.o
> LD /home/bamvor/works/source/kernel/linux/2001/gpiolsgpio-in.o
>
> It could be fixed by building the tools/gpio manually or passing the
> correct absolute path:
> $(MAKE) OUTPUT=$(realpath $(GPIODIR))/ -C $(GPIODIR) clean
>
> I looked for a bettter fix. But no progress so far. Loop Amaldo, hope could
> get some input.

Thanks for the review. I'll see if I can come with something better.
Otherwise, I prefer passing the correct absolute path over building
tools/gpio manually.

>>
>> -../../../gpio/gpio-utils.o:
>> -   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
>> +$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
>>
>> -../../../../usr/include/linux/gpio.h:
>> -   make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
>> pwd)/../../../../usr/
>> +$(GPIODIR)/$(GPIOOBJ):
>> +   $(MAKE) -C $(GPIODIR)
> Similiar to the above clean target.

ack, will fix in v3.

> Regards
>
> Bamvor
>>
>> +$(GPIOINC):
>> +   $(MAKE) -C ../../../.. headers_install
>> --
>> 2.11.0


Re: [PATCH v2] selftests: gpio: fix Makefile

2017-03-31 Thread Fathi Boudra
On 30 March 2017 at 16:14, Bamvor Zhang Jian
 wrote:
> Hi, Fathi
>
> Thanks for your patch.
>
> On 28 March 2017 at 13:36, Fathi Boudra  wrote:
>> * Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
>>   figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
>>   Note: if pkg-config is missing (command not found), it will fail to
>>   build because headers can't be found or libmount library can't be
>>   linked.
>>
>> * Fix the clean target to clean up also gpio-utils.
>>
>> * Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
>>   instead of BINARIES which is not supported by the top-level lib.mk.
>>
>> * Get rid of INSTALL_HDR_PATH. We don't need it since make -C is putting
>>   us in the right location.
>>
>> * Improve readibility:
>>   - introduce GPIODIR/GPIOOBJ/GPIOINC variables
>>   - split CFLAGS on multiple lines
>>
>> Signed-off-by: Fathi Boudra 
>> ---
>>
>> in v2:
>>  * per Michael Ellerman request, revert to use exported headers instead of 
>> uapi.
>>
>>  tools/testing/selftests/gpio/Makefile | 31 ++-
>>  1 file changed, 18 insertions(+), 13 deletions(-)
>>
>> diff --git a/tools/testing/selftests/gpio/Makefile 
>> b/tools/testing/selftests/gpio/Makefile
>> index 205e4d10e085..41826897af35 100644
>> --- a/tools/testing/selftests/gpio/Makefile
>> +++ b/tools/testing/selftests/gpio/Makefile
>> @@ -1,23 +1,28 @@
>> +CFLAGS += -O2 -g -std=gnu99 -Wall
>> +CFLAGS += -I../../../../usr/include/
>> +CFLAGS += $(shell pkg-config --cflags mount)
>> +LDLIBS += $(shell pkg-config --libs mount)
>>
>>  TEST_PROGS := gpio-mockup.sh
>> -TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
>> -BINARIES := gpio-mockup-chardev
>> +TEST_PROGS_EXTENDED := gpio-mockup-chardev
>> +TEST_FILES := gpio-mockup-sysfs.sh
>> +
>> +GPIODIR := ../../../gpio
>> +GPIOOBJ := gpio-utils.o
>> +GPIOINC := gpio.h
>>
>>  include ../lib.mk
>>
>> -all: $(BINARIES)
>> +all: $(GPIOINC) $(TEST_PROGS_EXTENDED)
> All the TEST_PROGS_EXTENDED should be TEST_GEN_FILES which will output to
> KBUILD_OUTPUT/O directory when it enabled.
>>
>>  clean:
>> -   $(RM) $(BINARIES)
>> -
>> -CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
>> -LDLIBS += -lmount -I/usr/include/libmount
>> -
>> -$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
>> +   $(RM) $(TEST_PROGS_EXTENDED)
>> +   $(MAKE) -C $(GPIODIR) clean
> When I enable KBUILD_OUTPUT, it will affect the output directory in
> tools/gpio and
> output to wired directory:
>
> $ make KBUILD_OUTPUT=$PWD/2001 -C tools/testing/selftests/ TARGETS=gpio
> make: Entering directory
> `/home/bamvor/works/source/kernel/linux/tools/testing/selftests'
> for TARGET in gpio; do \
> BUILD_TARGET=$BUILD/$TARGET; \
> mkdir $BUILD_TARGET -p; \
> make OUTPUT=$BUILD_TARGET -C $TARGET;\
> done;
> make[1]: Entering directory
> `/home/bamvor/works/source/kernel/linux/tools/testing/selftests/gpio'
> Makefile:19: warning: overriding commands for target `clean'
> ../lib.mk:55: warning: ignoring old commands for target `clean'
> make -C ../../../gpio
> make[2]: Entering directory 
> `/home/bamvor/works/source/kernel/linux/tools/gpio'
> mkdir -p /home/bamvor/works/source/kernel/linux/2001/gpioinclude/linux
> 2>&1 || true
> ln -sf 
> /home/bamvor/works/source/kernel/linux/tools/gpio/../../include/uapi/linux/gpio.h
> /home/bamvor/works/source/kernel/linux/2001/gpioinclude/linux/gpio.h
> make -f /home/bamvor/works/source/kernel/linux/tools/build/Makefile.build
> dir=. obj=lsgpio
> make[3]: Entering directory 
> `/home/bamvor/works/source/kernel/linux/tools/gpio'
> CC /home/bamvor/works/source/kernel/linux/2001/gpiolsgpio.o
> CC /home/bamvor/works/source/kernel/linux/2001/gpiogpio-utils.o
> LD /home/bamvor/works/source/kernel/linux/2001/gpiolsgpio-in.o
>
> It could be fixed by building the tools/gpio manually or passing the
> correct absolute path:
> $(MAKE) OUTPUT=$(realpath $(GPIODIR))/ -C $(GPIODIR) clean
>
> I looked for a bettter fix. But no progress so far. Loop Amaldo, hope could
> get some input.

Thanks for the review. I'll see if I can come with something better.
Otherwise, I prefer passing the correct absolute path over building
tools/gpio manually.

>>
>> -../../../gpio/gpio-utils.o:
>> -   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
>> +$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
>>
>> -../../../../usr/include/linux/gpio.h:
>> -   make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
>> pwd)/../../../../usr/
>> +$(GPIODIR)/$(GPIOOBJ):
>> +   $(MAKE) -C $(GPIODIR)
> Similiar to the above clean target.

ack, will fix in v3.

> Regards
>
> Bamvor
>>
>> +$(GPIOINC):
>> +   $(MAKE) -C ../../../.. headers_install
>> --
>> 2.11.0


[PATCH v2] selftests: gpio: add config fragment for gpio-mockup

2017-03-31 Thread Fathi Boudra
The gpio test requires to insert the gpio mockup module (CONFIG_GPIO_MOCKUP).
The gpio mockup driver depends on gpiolib (CONFIG_GPIOLIB).
CONFIG_GPIO_SYSFS is selected automatically by the gpio mockup driver.

Tested on x86_64 and arm64 with defconfig and kselftest-merge.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---

Changes in v2:
 * Per Bamvor Zhang Jian review, add gpiolib dependency (CONFIG_GPIOLIB).
   Skipped CONFIG_DEBUG_GPIO as it isn't necessary, and CONFIG_GPIO_SYSFS
   as it's selected automatically by the gpio mockup driver.

 tools/testing/selftests/gpio/config | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/testing/selftests/gpio/config

diff --git a/tools/testing/selftests/gpio/config 
b/tools/testing/selftests/gpio/config
new file mode 100644
index ..abaa6902b7b6
--- /dev/null
+++ b/tools/testing/selftests/gpio/config
@@ -0,0 +1,2 @@
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_MOCKUP=m
-- 
2.11.0


[PATCH v2] selftests: gpio: add config fragment for gpio-mockup

2017-03-31 Thread Fathi Boudra
The gpio test requires to insert the gpio mockup module (CONFIG_GPIO_MOCKUP).
The gpio mockup driver depends on gpiolib (CONFIG_GPIOLIB).
CONFIG_GPIO_SYSFS is selected automatically by the gpio mockup driver.

Tested on x86_64 and arm64 with defconfig and kselftest-merge.

Signed-off-by: Fathi Boudra 
---

Changes in v2:
 * Per Bamvor Zhang Jian review, add gpiolib dependency (CONFIG_GPIOLIB).
   Skipped CONFIG_DEBUG_GPIO as it isn't necessary, and CONFIG_GPIO_SYSFS
   as it's selected automatically by the gpio mockup driver.

 tools/testing/selftests/gpio/config | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/testing/selftests/gpio/config

diff --git a/tools/testing/selftests/gpio/config 
b/tools/testing/selftests/gpio/config
new file mode 100644
index ..abaa6902b7b6
--- /dev/null
+++ b/tools/testing/selftests/gpio/config
@@ -0,0 +1,2 @@
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_MOCKUP=m
-- 
2.11.0


[PATCH] selftests: gpio: add config fragment for gpio-mockup

2017-03-28 Thread Fathi Boudra
The gpio test requires to insert gpio-mockup module.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/gpio/config | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/gpio/config

diff --git a/tools/testing/selftests/gpio/config 
b/tools/testing/selftests/gpio/config
new file mode 100644
index ..ae160d924d22
--- /dev/null
+++ b/tools/testing/selftests/gpio/config
@@ -0,0 +1 @@
+CONFIG_GPIO_MOCKUP=m
-- 
2.11.0



[PATCH] selftests: gpio: add config fragment for gpio-mockup

2017-03-28 Thread Fathi Boudra
The gpio test requires to insert gpio-mockup module.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/gpio/config | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/gpio/config

diff --git a/tools/testing/selftests/gpio/config 
b/tools/testing/selftests/gpio/config
new file mode 100644
index ..ae160d924d22
--- /dev/null
+++ b/tools/testing/selftests/gpio/config
@@ -0,0 +1 @@
+CONFIG_GPIO_MOCKUP=m
-- 
2.11.0



[PATCH v2] selftests: gpio: fix Makefile

2017-03-27 Thread Fathi Boudra
* Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
  figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
  Note: if pkg-config is missing (command not found), it will fail to
  build because headers can't be found or libmount library can't be
  linked.

* Fix the clean target to clean up also gpio-utils.

* Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
  instead of BINARIES which is not supported by the top-level lib.mk.

* Get rid of INSTALL_HDR_PATH. We don't need it since make -C is putting
  us in the right location.

* Improve readibility:
  - introduce GPIODIR/GPIOOBJ/GPIOINC variables
  - split CFLAGS on multiple lines

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---

in v2:
 * per Michael Ellerman request, revert to use exported headers instead of uapi.

 tools/testing/selftests/gpio/Makefile | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 205e4d10e085..41826897af35 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,23 +1,28 @@
+CFLAGS += -O2 -g -std=gnu99 -Wall
+CFLAGS += -I../../../../usr/include/
+CFLAGS += $(shell pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 TEST_PROGS := gpio-mockup.sh
-TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
-BINARIES := gpio-mockup-chardev
+TEST_PROGS_EXTENDED := gpio-mockup-chardev
+TEST_FILES := gpio-mockup-sysfs.sh
+
+GPIODIR := ../../../gpio
+GPIOOBJ := gpio-utils.o
+GPIOINC := gpio.h
 
 include ../lib.mk
 
-all: $(BINARIES)
+all: $(GPIOINC) $(TEST_PROGS_EXTENDED)
 
 clean:
-   $(RM) $(BINARIES)
-
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
-
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
+   $(RM) $(TEST_PROGS_EXTENDED)
+   $(MAKE) -C $(GPIODIR) clean
 
-../../../gpio/gpio-utils.o:
-   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
 
-../../../../usr/include/linux/gpio.h:
-   make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
pwd)/../../../../usr/
+$(GPIODIR)/$(GPIOOBJ):
+   $(MAKE) -C $(GPIODIR)
 
+$(GPIOINC):
+   $(MAKE) -C ../../../.. headers_install
-- 
2.11.0


[PATCH v2] selftests: gpio: fix Makefile

2017-03-27 Thread Fathi Boudra
* Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
  figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.
  Note: if pkg-config is missing (command not found), it will fail to
  build because headers can't be found or libmount library can't be
  linked.

* Fix the clean target to clean up also gpio-utils.

* Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
  instead of BINARIES which is not supported by the top-level lib.mk.

* Get rid of INSTALL_HDR_PATH. We don't need it since make -C is putting
  us in the right location.

* Improve readibility:
  - introduce GPIODIR/GPIOOBJ/GPIOINC variables
  - split CFLAGS on multiple lines

Signed-off-by: Fathi Boudra 
---

in v2:
 * per Michael Ellerman request, revert to use exported headers instead of uapi.

 tools/testing/selftests/gpio/Makefile | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 205e4d10e085..41826897af35 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,23 +1,28 @@
+CFLAGS += -O2 -g -std=gnu99 -Wall
+CFLAGS += -I../../../../usr/include/
+CFLAGS += $(shell pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 TEST_PROGS := gpio-mockup.sh
-TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
-BINARIES := gpio-mockup-chardev
+TEST_PROGS_EXTENDED := gpio-mockup-chardev
+TEST_FILES := gpio-mockup-sysfs.sh
+
+GPIODIR := ../../../gpio
+GPIOOBJ := gpio-utils.o
+GPIOINC := gpio.h
 
 include ../lib.mk
 
-all: $(BINARIES)
+all: $(GPIOINC) $(TEST_PROGS_EXTENDED)
 
 clean:
-   $(RM) $(BINARIES)
-
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
-
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
+   $(RM) $(TEST_PROGS_EXTENDED)
+   $(MAKE) -C $(GPIODIR) clean
 
-../../../gpio/gpio-utils.o:
-   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
 
-../../../../usr/include/linux/gpio.h:
-   make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
pwd)/../../../../usr/
+$(GPIODIR)/$(GPIOOBJ):
+   $(MAKE) -C $(GPIODIR)
 
+$(GPIOINC):
+   $(MAKE) -C ../../../.. headers_install
-- 
2.11.0


Re: [PATCH] selftests: gpio: fix Makefile

2017-03-27 Thread Fathi Boudra
On 28 March 2017 at 06:00, Michael Ellerman <m...@ellerman.id.au> wrote:
> Fathi Boudra <fathi.bou...@linaro.org> writes:
>> diff --git a/tools/testing/selftests/gpio/Makefile 
>> b/tools/testing/selftests/gpio/Makefile
>> index 205e4d10e085..714f1f7df04d 100644
>> --- a/tools/testing/selftests/gpio/Makefile
>> +++ b/tools/testing/selftests/gpio/Makefile
>> @@ -1,23 +1,24 @@
>> +CFLAGS += -O2 -g -std=gnu99 -Wall
>> +CFLAGS += -I../../../../include/uapi/ -I../../../../include/
>
> Those are kernel headers, they *might* work in userspace but they're not
> designed to.

except some tests are using uapi and some others are using the
generated headers inconsistently, so it looks like using uapi directly
is allowed. Do you suggest to fix the tests to only use the exported
headers consistently across selftests and add the dependency to
headers_install when necessary?

> Use the exported headers:
>
> CFLAGS += -I../../../../usr/include
>
>
> If they're not there, then the user can install them, or fall back to
> the system headers.
>
>> +CFLAGS += $(shell pkg-config --cflags mount)
>> +LDLIBS += $(shell pkg-config --libs mount)
>
> What if pkg-config isn't installed?

it gives an error (command not found) and gpio test will fail to build
because it won't be able to find the headers or link to libmount
library.

> cheers


Re: [PATCH] selftests: gpio: fix Makefile

2017-03-27 Thread Fathi Boudra
On 28 March 2017 at 06:00, Michael Ellerman  wrote:
> Fathi Boudra  writes:
>> diff --git a/tools/testing/selftests/gpio/Makefile 
>> b/tools/testing/selftests/gpio/Makefile
>> index 205e4d10e085..714f1f7df04d 100644
>> --- a/tools/testing/selftests/gpio/Makefile
>> +++ b/tools/testing/selftests/gpio/Makefile
>> @@ -1,23 +1,24 @@
>> +CFLAGS += -O2 -g -std=gnu99 -Wall
>> +CFLAGS += -I../../../../include/uapi/ -I../../../../include/
>
> Those are kernel headers, they *might* work in userspace but they're not
> designed to.

except some tests are using uapi and some others are using the
generated headers inconsistently, so it looks like using uapi directly
is allowed. Do you suggest to fix the tests to only use the exported
headers consistently across selftests and add the dependency to
headers_install when necessary?

> Use the exported headers:
>
> CFLAGS += -I../../../../usr/include
>
>
> If they're not there, then the user can install them, or fall back to
> the system headers.
>
>> +CFLAGS += $(shell pkg-config --cflags mount)
>> +LDLIBS += $(shell pkg-config --libs mount)
>
> What if pkg-config isn't installed?

it gives an error (command not found) and gpio test will fail to build
because it won't be able to find the headers or link to libmount
library.

> cheers


[PATCH] selftests: gpio: fix Makefile

2017-03-24 Thread Fathi Boudra
* Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
  figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.

* Fix the clean target to clean up also gpio-utils.

* Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
  instead of BINARIES which is not supported by the top-level lib.mk.

* Remove dependency to headers_install as we can simply use gpio.h from
  user space API directly.

* Improve readibility:
  - introduce GPIODIR/GPIOOBJ variables
  - split CFLAGS on multiple lines

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/gpio/Makefile | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 205e4d10e085..714f1f7df04d 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,23 +1,24 @@
+CFLAGS += -O2 -g -std=gnu99 -Wall
+CFLAGS += -I../../../../include/uapi/ -I../../../../include/
+CFLAGS += $(shell pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 TEST_PROGS := gpio-mockup.sh
-TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
-BINARIES := gpio-mockup-chardev
+TEST_PROGS_EXTENDED := gpio-mockup-chardev
+TEST_FILES := gpio-mockup-sysfs.sh
+
+GPIODIR := ../../../gpio
+GPIOOBJ := gpio-utils.o
 
 include ../lib.mk
 
-all: $(BINARIES)
+all: $(TEST_PROGS_EXTENDED)
 
 clean:
-   $(RM) $(BINARIES)
-
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
-
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
-
-../../../gpio/gpio-utils.o:
-   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+   $(RM) $(TEST_PROGS_EXTENDED)
+   $(MAKE) -C $(GPIODIR) clean
 
-../../../../usr/include/linux/gpio.h:
-   make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
pwd)/../../../../usr/
+$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
 
+$(GPIODIR)/$(GPIOOBJ):
+   $(MAKE) -C $(GPIODIR)
-- 
2.11.0



[PATCH] selftests: gpio: fix Makefile

2017-03-24 Thread Fathi Boudra
* Fix hardcoded and misplaced libmount headers. Use pkg-config instead to
  figure out CFLAGS/LDLIBS, fixing also their value for cross-compilation.

* Fix the clean target to clean up also gpio-utils.

* Fix gpio-mockup-chardev installation by using TEST_PROGS_EXTENDED
  instead of BINARIES which is not supported by the top-level lib.mk.

* Remove dependency to headers_install as we can simply use gpio.h from
  user space API directly.

* Improve readibility:
  - introduce GPIODIR/GPIOOBJ variables
  - split CFLAGS on multiple lines

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/gpio/Makefile | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 205e4d10e085..714f1f7df04d 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,23 +1,24 @@
+CFLAGS += -O2 -g -std=gnu99 -Wall
+CFLAGS += -I../../../../include/uapi/ -I../../../../include/
+CFLAGS += $(shell pkg-config --cflags mount)
+LDLIBS += $(shell pkg-config --libs mount)
 
 TEST_PROGS := gpio-mockup.sh
-TEST_FILES := gpio-mockup-sysfs.sh $(BINARIES)
-BINARIES := gpio-mockup-chardev
+TEST_PROGS_EXTENDED := gpio-mockup-chardev
+TEST_FILES := gpio-mockup-sysfs.sh
+
+GPIODIR := ../../../gpio
+GPIOOBJ := gpio-utils.o
 
 include ../lib.mk
 
-all: $(BINARIES)
+all: $(TEST_PROGS_EXTENDED)
 
 clean:
-   $(RM) $(BINARIES)
-
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
-LDLIBS += -lmount -I/usr/include/libmount
-
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
-
-../../../gpio/gpio-utils.o:
-   make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+   $(RM) $(TEST_PROGS_EXTENDED)
+   $(MAKE) -C $(GPIODIR) clean
 
-../../../../usr/include/linux/gpio.h:
-   make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell 
pwd)/../../../../usr/
+$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
 
+$(GPIODIR)/$(GPIOOBJ):
+   $(MAKE) -C $(GPIODIR)
-- 
2.11.0



[PATCH 1/1] selftests: breakpoints: allow to cross-compile for aarch64/arm64

2017-03-22 Thread Fathi Boudra
To build breakpoint_test_arm64, ARCH value is only tested for "aarch64".
It covers only the native build because it's computed from uname -m output.
For cross-compilation, ARCH is set to arm64 and prevent to cross-compile
the test.
Fix the test to allow both native and cross-compilation of the test.

Note: glibc is missing several of the TRAP_* constants in the userspace
  definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT.
  See https://sourceware.org/bugzilla/show_bug.cgi?id=21286

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/breakpoints/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/breakpoints/Makefile 
b/tools/testing/selftests/breakpoints/Makefile
index 72aa103e4141..6b214b7b10fb 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e 
s/x86_64/x86/)
 ifeq ($(ARCH),x86)
 TEST_GEN_PROGS := breakpoint_test
 endif
-ifeq ($(ARCH),aarch64)
+ifneq (,$(filter $(ARCH),aarch64 arm64))
 TEST_GEN_PROGS := breakpoint_test_arm64
 endif
 
-- 
2.11.0



[PATCH 1/1] selftests: breakpoints: allow to cross-compile for aarch64/arm64

2017-03-22 Thread Fathi Boudra
To build breakpoint_test_arm64, ARCH value is only tested for "aarch64".
It covers only the native build because it's computed from uname -m output.
For cross-compilation, ARCH is set to arm64 and prevent to cross-compile
the test.
Fix the test to allow both native and cross-compilation of the test.

Note: glibc is missing several of the TRAP_* constants in the userspace
  definitions. Specifically TRAP_BRANCH and TRAP_HWBKPT.
  See https://sourceware.org/bugzilla/show_bug.cgi?id=21286

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/breakpoints/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/breakpoints/Makefile 
b/tools/testing/selftests/breakpoints/Makefile
index 72aa103e4141..6b214b7b10fb 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -5,7 +5,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e 
s/x86_64/x86/)
 ifeq ($(ARCH),x86)
 TEST_GEN_PROGS := breakpoint_test
 endif
-ifeq ($(ARCH),aarch64)
+ifneq (,$(filter $(ARCH),aarch64 arm64))
 TEST_GEN_PROGS := breakpoint_test_arm64
 endif
 
-- 
2.11.0



[PATCH 1/3] selftests: lib: add config fragment for bitmap, printf and prime numbers tests

2017-03-20 Thread Fathi Boudra
test_bitmap, test_printf and prime_numbers are expected to be built as
modules.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/lib/config | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 tools/testing/selftests/lib/config

diff --git a/tools/testing/selftests/lib/config 
b/tools/testing/selftests/lib/config
new file mode 100644
index ..126933bcc950
--- /dev/null
+++ b/tools/testing/selftests/lib/config
@@ -0,0 +1,3 @@
+CONFIG_TEST_PRINTF=m
+CONFIG_TEST_BITMAP=m
+CONFIG_PRIME_NUMBERS=m
-- 
2.11.0



[PATCH 2/3] selftests: ftrace: add CONFIG_KPROBES=y to the config fragment

2017-03-20 Thread Fathi Boudra
ftrace/kprobe tests require kprobes events. Enable kprobes to run these
tests.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/ftrace/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/ftrace/config 
b/tools/testing/selftests/ftrace/config
index ef8214661612..8a1c9f949fe0 100644
--- a/tools/testing/selftests/ftrace/config
+++ b/tools/testing/selftests/ftrace/config
@@ -1 +1,2 @@
+CONFIG_KPROBES=y
 CONFIG_FTRACE=y
-- 
2.11.0



[PATCH 1/3] selftests: lib: add config fragment for bitmap, printf and prime numbers tests

2017-03-20 Thread Fathi Boudra
test_bitmap, test_printf and prime_numbers are expected to be built as
modules.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/lib/config | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 tools/testing/selftests/lib/config

diff --git a/tools/testing/selftests/lib/config 
b/tools/testing/selftests/lib/config
new file mode 100644
index ..126933bcc950
--- /dev/null
+++ b/tools/testing/selftests/lib/config
@@ -0,0 +1,3 @@
+CONFIG_TEST_PRINTF=m
+CONFIG_TEST_BITMAP=m
+CONFIG_PRIME_NUMBERS=m
-- 
2.11.0



[PATCH 2/3] selftests: ftrace: add CONFIG_KPROBES=y to the config fragment

2017-03-20 Thread Fathi Boudra
ftrace/kprobe tests require kprobes events. Enable kprobes to run these
tests.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/ftrace/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/ftrace/config 
b/tools/testing/selftests/ftrace/config
index ef8214661612..8a1c9f949fe0 100644
--- a/tools/testing/selftests/ftrace/config
+++ b/tools/testing/selftests/ftrace/config
@@ -1 +1,2 @@
+CONFIG_KPROBES=y
 CONFIG_FTRACE=y
-- 
2.11.0



[PATCH 3/3] selftests: vm: add CONFIG_SYSVIPC=y to the config fragment

2017-03-20 Thread Fathi Boudra
vm tests rely on shared memory settings. Enable system V IPC to run these
tests.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/vm/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/vm/config 
b/tools/testing/selftests/vm/config
index 698c7ed28a26..1c0d76cb5adf 100644
--- a/tools/testing/selftests/vm/config
+++ b/tools/testing/selftests/vm/config
@@ -1 +1,2 @@
+CONFIG_SYSVIPC=y
 CONFIG_USERFAULTFD=y
-- 
2.11.0



[PATCH 3/3] selftests: vm: add CONFIG_SYSVIPC=y to the config fragment

2017-03-20 Thread Fathi Boudra
vm tests rely on shared memory settings. Enable system V IPC to run these
tests.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/vm/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/vm/config 
b/tools/testing/selftests/vm/config
index 698c7ed28a26..1c0d76cb5adf 100644
--- a/tools/testing/selftests/vm/config
+++ b/tools/testing/selftests/vm/config
@@ -1 +1,2 @@
+CONFIG_SYSVIPC=y
 CONFIG_USERFAULTFD=y
-- 
2.11.0



[PATCH 0/3] selftests: config fragments update

2017-03-20 Thread Fathi Boudra
kselftest-merge target allows to enable the dependencies of kernel config
for kselftest testcases. Add config dependencies to run ftrace, lib and vm
tests.

Fathi Boudra (3):
  selftests: lib: add config fragment for bitmap, printf and prime
numbers tests
  selftests: ftrace: add CONFIG_KPROBES=y to the config fragment
  selftests: vm: add CONFIG_SYSVIPC=y to the config fragment

 tools/testing/selftests/ftrace/config | 1 +
 tools/testing/selftests/lib/config| 3 +++
 tools/testing/selftests/vm/config | 1 +
 3 files changed, 5 insertions(+)
 create mode 100644 tools/testing/selftests/lib/config

-- 
2.11.0



[PATCH 0/3] selftests: config fragments update

2017-03-20 Thread Fathi Boudra
kselftest-merge target allows to enable the dependencies of kernel config
for kselftest testcases. Add config dependencies to run ftrace, lib and vm
tests.

Fathi Boudra (3):
  selftests: lib: add config fragment for bitmap, printf and prime
numbers tests
  selftests: ftrace: add CONFIG_KPROBES=y to the config fragment
  selftests: vm: add CONFIG_SYSVIPC=y to the config fragment

 tools/testing/selftests/ftrace/config | 1 +
 tools/testing/selftests/lib/config| 3 +++
 tools/testing/selftests/vm/config | 1 +
 3 files changed, 5 insertions(+)
 create mode 100644 tools/testing/selftests/lib/config

-- 
2.11.0



Re: [PATCH 1/2] selftests: keep consistency for uname -m usage

2017-03-17 Thread Fathi Boudra
On 15 March 2017 at 17:56, Shuah Khan <sh...@kernel.org> wrote:
> Hi Fathi,
>
> On 03/15/2017 07:15 AM, Fathi Boudra wrote:
>> powerpc selftests allow to override ARCH for cross-compilation by making
>> the first ARCH assignment weak.
>> Use the same approach in breakpoints, ipc and prctl tests to:
>>  - keep uname usage consistent across selftests
>>  - make it easier to cross-compile
>
> How does it make it easier to cross-compile? Could you please
> elaborate on what this patch is fixing?

Nevermind, ARCH was already a weak assignment. My patches changed the behavior.
I've been confused by the different approach used by powerpc vs
breakpoints/ipc/prctl tests.

> Also I would like to see 3 separate patches one for each
> of the tests?

Will you accept a patch to get rid on uname_M variable, keep ARCH
usage consistent across selftests?
In other words, align with the way it's done in powerpc test.
It won't fix any cross-compilation issues but improve consistency in the code.

> thanks,
> -- Shuah
>
>>
>> Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
>> ---
>>  tools/testing/selftests/breakpoints/Makefile | 4 ++--
>>  tools/testing/selftests/ipc/Makefile | 4 ++--
>>  tools/testing/selftests/powerpc/Makefile | 2 +-
>>  tools/testing/selftests/prctl/Makefile   | 4 ++--
>>  4 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/tools/testing/selftests/breakpoints/Makefile 
>> b/tools/testing/selftests/breakpoints/Makefile
>> index 72aa103e4141..9d5a1af4b5c9 100644
>> --- a/tools/testing/selftests/breakpoints/Makefile
>> +++ b/tools/testing/selftests/breakpoints/Makefile
>> @@ -1,6 +1,6 @@
>>  # Taken from perf makefile
>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>> +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>
>
>
>>
>>  ifeq ($(ARCH),x86)
>>  TEST_GEN_PROGS := breakpoint_test
>> diff --git a/tools/testing/selftests/ipc/Makefile 
>> b/tools/testing/selftests/ipc/Makefile
>> index 30ef4c7f53ea..7e5a459842bb 100644
>> --- a/tools/testing/selftests/ipc/Makefile
>> +++ b/tools/testing/selftests/ipc/Makefile
>> @@ -1,5 +1,5 @@
>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>> +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/)
>>  ifeq ($(ARCH),i386)
>>  ARCH := x86
>>   CFLAGS := -DCONFIG_X86_32 -D__i386__
>> diff --git a/tools/testing/selftests/powerpc/Makefile 
>> b/tools/testing/selftests/powerpc/Makefile
>> index 1c5d0575802e..731e015d170d 100644
>> --- a/tools/testing/selftests/powerpc/Makefile
>> +++ b/tools/testing/selftests/powerpc/Makefile
>> @@ -1,7 +1,7 @@
>>  # Makefile for powerpc selftests
>>
>>  # ARCH can be overridden by the user for cross compiling
>> -ARCH ?= $(shell uname -m)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>>  ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
>>
>>  ifeq ($(ARCH),powerpc)
>> diff --git a/tools/testing/selftests/prctl/Makefile 
>> b/tools/testing/selftests/prctl/Makefile
>> index 35aa1c8f2df2..08aeb8721ce6 100644
>> --- a/tools/testing/selftests/prctl/Makefile
>> +++ b/tools/testing/selftests/prctl/Makefile
>> @@ -1,6 +1,6 @@
>>  ifndef CROSS_COMPILE
>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>> +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>>
>>  ifeq ($(ARCH),x86)
>>  TEST_PROGS := disable-tsc-ctxt-sw-stress-test 
>> disable-tsc-on-off-stress-test \
>>
>


Re: [PATCH 1/2] selftests: keep consistency for uname -m usage

2017-03-17 Thread Fathi Boudra
On 15 March 2017 at 17:56, Shuah Khan  wrote:
> Hi Fathi,
>
> On 03/15/2017 07:15 AM, Fathi Boudra wrote:
>> powerpc selftests allow to override ARCH for cross-compilation by making
>> the first ARCH assignment weak.
>> Use the same approach in breakpoints, ipc and prctl tests to:
>>  - keep uname usage consistent across selftests
>>  - make it easier to cross-compile
>
> How does it make it easier to cross-compile? Could you please
> elaborate on what this patch is fixing?

Nevermind, ARCH was already a weak assignment. My patches changed the behavior.
I've been confused by the different approach used by powerpc vs
breakpoints/ipc/prctl tests.

> Also I would like to see 3 separate patches one for each
> of the tests?

Will you accept a patch to get rid on uname_M variable, keep ARCH
usage consistent across selftests?
In other words, align with the way it's done in powerpc test.
It won't fix any cross-compilation issues but improve consistency in the code.

> thanks,
> -- Shuah
>
>>
>> Signed-off-by: Fathi Boudra 
>> ---
>>  tools/testing/selftests/breakpoints/Makefile | 4 ++--
>>  tools/testing/selftests/ipc/Makefile | 4 ++--
>>  tools/testing/selftests/powerpc/Makefile | 2 +-
>>  tools/testing/selftests/prctl/Makefile   | 4 ++--
>>  4 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/tools/testing/selftests/breakpoints/Makefile 
>> b/tools/testing/selftests/breakpoints/Makefile
>> index 72aa103e4141..9d5a1af4b5c9 100644
>> --- a/tools/testing/selftests/breakpoints/Makefile
>> +++ b/tools/testing/selftests/breakpoints/Makefile
>> @@ -1,6 +1,6 @@
>>  # Taken from perf makefile
>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>> +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>
>
>
>>
>>  ifeq ($(ARCH),x86)
>>  TEST_GEN_PROGS := breakpoint_test
>> diff --git a/tools/testing/selftests/ipc/Makefile 
>> b/tools/testing/selftests/ipc/Makefile
>> index 30ef4c7f53ea..7e5a459842bb 100644
>> --- a/tools/testing/selftests/ipc/Makefile
>> +++ b/tools/testing/selftests/ipc/Makefile
>> @@ -1,5 +1,5 @@
>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>> +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/)
>>  ifeq ($(ARCH),i386)
>>  ARCH := x86
>>   CFLAGS := -DCONFIG_X86_32 -D__i386__
>> diff --git a/tools/testing/selftests/powerpc/Makefile 
>> b/tools/testing/selftests/powerpc/Makefile
>> index 1c5d0575802e..731e015d170d 100644
>> --- a/tools/testing/selftests/powerpc/Makefile
>> +++ b/tools/testing/selftests/powerpc/Makefile
>> @@ -1,7 +1,7 @@
>>  # Makefile for powerpc selftests
>>
>>  # ARCH can be overridden by the user for cross compiling
>> -ARCH ?= $(shell uname -m)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>>  ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
>>
>>  ifeq ($(ARCH),powerpc)
>> diff --git a/tools/testing/selftests/prctl/Makefile 
>> b/tools/testing/selftests/prctl/Makefile
>> index 35aa1c8f2df2..08aeb8721ce6 100644
>> --- a/tools/testing/selftests/prctl/Makefile
>> +++ b/tools/testing/selftests/prctl/Makefile
>> @@ -1,6 +1,6 @@
>>  ifndef CROSS_COMPILE
>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
>> +ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
>>
>>  ifeq ($(ARCH),x86)
>>  TEST_PROGS := disable-tsc-ctxt-sw-stress-test 
>> disable-tsc-on-off-stress-test \
>>
>


[PATCH 2/2] selftests: lib: add config fragment for bitmap, printf and prime numbers tests

2017-03-15 Thread Fathi Boudra
test_bitmap, test_printf and prime_numbers are expected to be built as modules.

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/lib/config | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 tools/testing/selftests/lib/config

diff --git a/tools/testing/selftests/lib/config 
b/tools/testing/selftests/lib/config
new file mode 100644
index ..7fe4d7c3c947
--- /dev/null
+++ b/tools/testing/selftests/lib/config
@@ -0,0 +1,3 @@
+CONFIG_PRIME_NUMBERS=m
+CONFIG_TEST_BITMAP=m
+CONFIG_TEST_PRINTF=m
-- 
2.11.0



[PATCH 2/2] selftests: lib: add config fragment for bitmap, printf and prime numbers tests

2017-03-15 Thread Fathi Boudra
test_bitmap, test_printf and prime_numbers are expected to be built as modules.

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/lib/config | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 tools/testing/selftests/lib/config

diff --git a/tools/testing/selftests/lib/config 
b/tools/testing/selftests/lib/config
new file mode 100644
index ..7fe4d7c3c947
--- /dev/null
+++ b/tools/testing/selftests/lib/config
@@ -0,0 +1,3 @@
+CONFIG_PRIME_NUMBERS=m
+CONFIG_TEST_BITMAP=m
+CONFIG_TEST_PRINTF=m
-- 
2.11.0



[PATCH 1/2] selftests: keep consistency for uname -m usage

2017-03-15 Thread Fathi Boudra
powerpc selftests allow to override ARCH for cross-compilation by making
the first ARCH assignment weak.
Use the same approach in breakpoints, ipc and prctl tests to:
 - keep uname usage consistent across selftests
 - make it easier to cross-compile

Signed-off-by: Fathi Boudra <fathi.bou...@linaro.org>
---
 tools/testing/selftests/breakpoints/Makefile | 4 ++--
 tools/testing/selftests/ipc/Makefile | 4 ++--
 tools/testing/selftests/powerpc/Makefile | 2 +-
 tools/testing/selftests/prctl/Makefile   | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/breakpoints/Makefile 
b/tools/testing/selftests/breakpoints/Makefile
index 72aa103e4141..9d5a1af4b5c9 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -1,6 +1,6 @@
 # Taken from perf makefile
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
 
 ifeq ($(ARCH),x86)
 TEST_GEN_PROGS := breakpoint_test
diff --git a/tools/testing/selftests/ipc/Makefile 
b/tools/testing/selftests/ipc/Makefile
index 30ef4c7f53ea..7e5a459842bb 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,5 +1,5 @@
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
 ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
diff --git a/tools/testing/selftests/powerpc/Makefile 
b/tools/testing/selftests/powerpc/Makefile
index 1c5d0575802e..731e015d170d 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -1,7 +1,7 @@
 # Makefile for powerpc selftests
 
 # ARCH can be overridden by the user for cross compiling
-ARCH ?= $(shell uname -m)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
 ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
 
 ifeq ($(ARCH),powerpc)
diff --git a/tools/testing/selftests/prctl/Makefile 
b/tools/testing/selftests/prctl/Makefile
index 35aa1c8f2df2..08aeb8721ce6 100644
--- a/tools/testing/selftests/prctl/Makefile
+++ b/tools/testing/selftests/prctl/Makefile
@@ -1,6 +1,6 @@
 ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
 
 ifeq ($(ARCH),x86)
 TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
-- 
2.11.0



[PATCH 1/2] selftests: keep consistency for uname -m usage

2017-03-15 Thread Fathi Boudra
powerpc selftests allow to override ARCH for cross-compilation by making
the first ARCH assignment weak.
Use the same approach in breakpoints, ipc and prctl tests to:
 - keep uname usage consistent across selftests
 - make it easier to cross-compile

Signed-off-by: Fathi Boudra 
---
 tools/testing/selftests/breakpoints/Makefile | 4 ++--
 tools/testing/selftests/ipc/Makefile | 4 ++--
 tools/testing/selftests/powerpc/Makefile | 2 +-
 tools/testing/selftests/prctl/Makefile   | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/breakpoints/Makefile 
b/tools/testing/selftests/breakpoints/Makefile
index 72aa103e4141..9d5a1af4b5c9 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -1,6 +1,6 @@
 # Taken from perf makefile
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
 
 ifeq ($(ARCH),x86)
 TEST_GEN_PROGS := breakpoint_test
diff --git a/tools/testing/selftests/ipc/Makefile 
b/tools/testing/selftests/ipc/Makefile
index 30ef4c7f53ea..7e5a459842bb 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,5 +1,5 @@
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/)
 ifeq ($(ARCH),i386)
 ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
diff --git a/tools/testing/selftests/powerpc/Makefile 
b/tools/testing/selftests/powerpc/Makefile
index 1c5d0575802e..731e015d170d 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -1,7 +1,7 @@
 # Makefile for powerpc selftests
 
 # ARCH can be overridden by the user for cross compiling
-ARCH ?= $(shell uname -m)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
 ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
 
 ifeq ($(ARCH),powerpc)
diff --git a/tools/testing/selftests/prctl/Makefile 
b/tools/testing/selftests/prctl/Makefile
index 35aa1c8f2df2..08aeb8721ce6 100644
--- a/tools/testing/selftests/prctl/Makefile
+++ b/tools/testing/selftests/prctl/Makefile
@@ -1,6 +1,6 @@
 ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
 
 ifeq ($(ARCH),x86)
 TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
-- 
2.11.0



[PATCH 1/1] tools/perf: add missing include debug.h for arm/arm64

2014-09-22 Thread Fathi Boudra
Fix perf build failure on arm/arm64 architectures introduced by 
commit 84f5d36f4 (move pr_* debug macros into debug object):

 arch/arm/util/unwind-libunwind.c: In function 'libunwind__arch_reg_id':
 arch/arm/util/unwind-libunwind.c:43:3: error: implicit declaration
 of function 'pr_err' [-Werror=implicit-function-declaration]
   pr_err("unwind: invalid reg id %d\n", regnum);
   ^
 arch/arm/util/unwind-libunwind.c:43:3: error: nested extern declaration
 of 'pr_err' [-Werror=nested-externs]
 cc1: all warnings being treated as errors
 make[2]: *** [arch/arm/util/unwind-libunwind.o] Error 1
 arch/arm/tests/dwarf-unwind.c: In function 'sample_ustack':
 arch/arm/tests/dwarf-unwind.c:20:3: error: implicit declaration
 of function 'pr_debug' [-Werror=implicit-function-declaration]
   pr_debug("failed to allocate sample uregs data\n");
   ^
 arch/arm/tests/dwarf-unwind.c:20:3: error: nested extern declaration
 of 'pr_debug' [-Werror=nested-externs]
 cc1: all warnings being treated as errors
 make[2]: *** [arch/arm/tests/dwarf-unwind.o] Error 1

Signed-off-by: Fathi Boudra 
---
 tools/perf/arch/arm/tests/dwarf-unwind.c  | 1 +
 tools/perf/arch/arm/util/unwind-libunwind.c   | 1 +
 tools/perf/arch/arm64/util/unwind-libunwind.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c 
b/tools/perf/arch/arm/tests/dwarf-unwind.c
index 9f870d2..62eff84 100644
--- a/tools/perf/arch/arm/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm/tests/dwarf-unwind.c
@@ -3,6 +3,7 @@
 #include "thread.h"
 #include "map.h"
 #include "event.h"
+#include "debug.h"
 #include "tests/tests.h"
 
 #define STACK_SIZE 8192
diff --git a/tools/perf/arch/arm/util/unwind-libunwind.c 
b/tools/perf/arch/arm/util/unwind-libunwind.c
index 729ed69..62c397e 100644
--- a/tools/perf/arch/arm/util/unwind-libunwind.c
+++ b/tools/perf/arch/arm/util/unwind-libunwind.c
@@ -3,6 +3,7 @@
 #include 
 #include "perf_regs.h"
 #include "../../util/unwind.h"
+#include "../../util/debug.h"
 
 int libunwind__arch_reg_id(int regnum)
 {
diff --git a/tools/perf/arch/arm64/util/unwind-libunwind.c 
b/tools/perf/arch/arm64/util/unwind-libunwind.c
index 436ee43..a87afa9 100644
--- a/tools/perf/arch/arm64/util/unwind-libunwind.c
+++ b/tools/perf/arch/arm64/util/unwind-libunwind.c
@@ -3,6 +3,7 @@
 #include 
 #include "perf_regs.h"
 #include "../../util/unwind.h"
+#include "../../util/debug.h"
 
 int libunwind__arch_reg_id(int regnum)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] tools/perf: add missing include debug.h for arm/arm64

2014-09-22 Thread Fathi Boudra
Fix perf build failure on arm/arm64 architectures introduced by 
commit 84f5d36f4 (move pr_* debug macros into debug object):

 arch/arm/util/unwind-libunwind.c: In function 'libunwind__arch_reg_id':
 arch/arm/util/unwind-libunwind.c:43:3: error: implicit declaration
 of function 'pr_err' [-Werror=implicit-function-declaration]
   pr_err(unwind: invalid reg id %d\n, regnum);
   ^
 arch/arm/util/unwind-libunwind.c:43:3: error: nested extern declaration
 of 'pr_err' [-Werror=nested-externs]
 cc1: all warnings being treated as errors
 make[2]: *** [arch/arm/util/unwind-libunwind.o] Error 1
 arch/arm/tests/dwarf-unwind.c: In function 'sample_ustack':
 arch/arm/tests/dwarf-unwind.c:20:3: error: implicit declaration
 of function 'pr_debug' [-Werror=implicit-function-declaration]
   pr_debug(failed to allocate sample uregs data\n);
   ^
 arch/arm/tests/dwarf-unwind.c:20:3: error: nested extern declaration
 of 'pr_debug' [-Werror=nested-externs]
 cc1: all warnings being treated as errors
 make[2]: *** [arch/arm/tests/dwarf-unwind.o] Error 1

Signed-off-by: Fathi Boudra fathi.bou...@linaro.org
---
 tools/perf/arch/arm/tests/dwarf-unwind.c  | 1 +
 tools/perf/arch/arm/util/unwind-libunwind.c   | 1 +
 tools/perf/arch/arm64/util/unwind-libunwind.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c 
b/tools/perf/arch/arm/tests/dwarf-unwind.c
index 9f870d2..62eff84 100644
--- a/tools/perf/arch/arm/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm/tests/dwarf-unwind.c
@@ -3,6 +3,7 @@
 #include thread.h
 #include map.h
 #include event.h
+#include debug.h
 #include tests/tests.h
 
 #define STACK_SIZE 8192
diff --git a/tools/perf/arch/arm/util/unwind-libunwind.c 
b/tools/perf/arch/arm/util/unwind-libunwind.c
index 729ed69..62c397e 100644
--- a/tools/perf/arch/arm/util/unwind-libunwind.c
+++ b/tools/perf/arch/arm/util/unwind-libunwind.c
@@ -3,6 +3,7 @@
 #include libunwind.h
 #include perf_regs.h
 #include ../../util/unwind.h
+#include ../../util/debug.h
 
 int libunwind__arch_reg_id(int regnum)
 {
diff --git a/tools/perf/arch/arm64/util/unwind-libunwind.c 
b/tools/perf/arch/arm64/util/unwind-libunwind.c
index 436ee43..a87afa9 100644
--- a/tools/perf/arch/arm64/util/unwind-libunwind.c
+++ b/tools/perf/arch/arm64/util/unwind-libunwind.c
@@ -3,6 +3,7 @@
 #include libunwind.h
 #include perf_regs.h
 #include ../../util/unwind.h
+#include ../../util/debug.h
 
 int libunwind__arch_reg_id(int regnum)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Linaro-QA-Service] [linux-next] Snowball build broken

2013-05-17 Thread Fathi Boudra
Hi Samuel,

On 16 May 2013 12:52, Samuel Ortiz  wrote:
> Hi Maresh,
>
> On Wed, May 01, 2013 at 03:15:26PM +0530, Naresh Kamboju wrote:
>> Ping.
>>
>> On 17 April 2013 21:16, Linus Walleij  wrote:
>> > On Tue, Apr 16, 2013 at 3:48 PM, Naresh Kamboju
>> >  wrote:
>> >> On 12 April 2013 04:07, Linus Walleij  wrote:
>> >>> Hey it works. Didn't see this before I fixed it tho :-)
>> >>> http://marc.info/?l=linux-kernel=136567139910888=2
> marc.info seems to be down for me at the moment. Could you please re-send me
> this patch ?

marc.info is back. Just in case:
https://lkml.org/lkml/2013/4/11/101
https://patchwork.kernel.org/patch/2426831/

Cheers,
Fathi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Linaro-QA-Service] [linux-next] Snowball build broken

2013-05-17 Thread Fathi Boudra
Hi Samuel,

On 16 May 2013 12:52, Samuel Ortiz sa...@linux.intel.com wrote:
 Hi Maresh,

 On Wed, May 01, 2013 at 03:15:26PM +0530, Naresh Kamboju wrote:
 Ping.

 On 17 April 2013 21:16, Linus Walleij linus.wall...@linaro.org wrote:
  On Tue, Apr 16, 2013 at 3:48 PM, Naresh Kamboju
  naresh.kamb...@linaro.org wrote:
  On 12 April 2013 04:07, Linus Walleij linus.wall...@linaro.org wrote:
  Hey it works. Didn't see this before I fixed it tho :-)
  http://marc.info/?l=linux-kernelm=136567139910888w=2
 marc.info seems to be down for me at the moment. Could you please re-send me
 this patch ?

marc.info is back. Just in case:
https://lkml.org/lkml/2013/4/11/101
https://patchwork.kernel.org/patch/2426831/

Cheers,
Fathi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/