2015-04-01 23:20:31

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 0/6] selftests: improve cross compilation support

This patch set improves cross building functionality by resovling hard coded
assumptions about the compiler used. With this patch set, all but mqueue,
and kdbus cross build successfully as they must link against a native
libraries. The hope is tha the above issues can be resolved in future patch
sets. I have tested this series by building selftests for x86_64, arm and
arm64 targets.

This motivation behind this series is to enable the kernelci.org service to
easily build, deploy, and execute selftests on many different processor
architectures without natively compiling them. With the hope of quickly
providing these test results back to the community.

This series is based on next-20150401.

Tyler Baker (6):
selftest/memfd: enable cross compilation
selftest/kdbus: enable cross compilation
selftest/mount: enable cross compilation
selftest/memfd: include default header install path
selftest/ipc: enable cross compilation
selftest/mqueue: enable cross compilation

tools/testing/selftests/ipc/Makefile | 6 +-----
tools/testing/selftests/kdbus/Makefile | 4 ++--
tools/testing/selftests/memfd/Makefile | 8 +++++---
tools/testing/selftests/mount/Makefile | 5 +++--
tools/testing/selftests/mqueue/Makefile | 6 ++++--
5 files changed, 15 insertions(+), 14 deletions(-)

--
2.1.4


2015-04-01 23:20:36

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 1/6] selftest/memfd: enable cross compilation

Use the CC variable instead of hard coding gcc. Also clean up the compiler
options by creating a CFLAGS variable.

Signed-off-by: Tyler Baker <[email protected]>
---
tools/testing/selftests/memfd/Makefile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 191dee9..69f08ab 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -1,17 +1,18 @@
+CC = $(CROSS_COMPILE)gcc
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I../../../../include/uapi/
CFLAGS += -I../../../../include/

all:
- gcc $(CFLAGS) memfd_test.c -o memfd_test
+ $(CC) $(CFLAGS) memfd_test.c -o memfd_test

TEST_PROGS := memfd_test

include ../lib.mk

build_fuse:
- gcc $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt
- gcc $(CFLAGS) fuse_test.c -o fuse_test
+ $(CC) $(CFLAGS) fuse_mnt.c `pkg-config fuse --cflags --libs` -o fuse_mnt
+ $(CC) $(CFLAGS) fuse_test.c -o fuse_test

run_fuse: build_fuse
@./run_fuse_test.sh || echo "fuse_test: [FAIL]"
--
2.1.4

2015-04-01 23:20:40

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 2/6] selftest/kdbus: enable cross compilation

Use the CC variable instead of hard coding gcc and include lib.mk.

Signed-off-by: Tyler Baker <[email protected]>
---
tools/testing/selftests/kdbus/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kdbus/Makefile b/tools/testing/selftests/kdbus/Makefile
index f6cfab2..de8242f 100644
--- a/tools/testing/selftests/kdbus/Makefile
+++ b/tools/testing/selftests/kdbus/Makefile
@@ -33,11 +33,13 @@ OBJS= \

all: kdbus-test

+include ../lib.mk
+
%.o: %.c
- gcc $(CFLAGS) -c $< -o $@
+ $(CC) $(CFLAGS) -c $< -o $@

kdbus-test: $(OBJS)
- gcc $(CFLAGS) $^ $(LDLIBS) -o $@
+ $(CC) $(CFLAGS) $^ $(LDLIBS) -o $@

run_tests:
./kdbus-test --tap
--
2.1.4

2015-04-01 23:21:37

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 3/6] selftest/mount: enable cross compilation

Use the CC variable instead of hard coding gcc. Also clean up the compiler
options by creating a CFLAGS variable.

Signed-off-by: Tyler Baker <[email protected]>
---
tools/testing/selftests/mount/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/mount/Makefile b/tools/testing/selftests/mount/Makefile
index a5b367f..95580a9 100644
--- a/tools/testing/selftests/mount/Makefile
+++ b/tools/testing/selftests/mount/Makefile
@@ -1,9 +1,10 @@
# Makefile for mount selftests.
-
+CFLAGS = -Wall \
+ -O2
all: unprivileged-remount-test

unprivileged-remount-test: unprivileged-remount-test.c
- gcc -Wall -O2 unprivileged-remount-test.c -o unprivileged-remount-test
+ $(CC) $(CFLAGS) unprivileged-remount-test.c -o unprivileged-remount-test

include ../lib.mk

--
2.1.4

2015-04-01 23:20:47

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 4/6] selftest/memfd: include default header install path

Include the default path for INSTALL_HDR_PATH to make it less intrusive when
cross building.

Signed-off-by: Tyler Baker <[email protected]>
---
tools/testing/selftests/memfd/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 69f08ab..3e7eb79 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -2,6 +2,7 @@ CC = $(CROSS_COMPILE)gcc
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I../../../../include/uapi/
CFLAGS += -I../../../../include/
+CFLAGS += -I../../../../usr/include/

all:
$(CC) $(CFLAGS) memfd_test.c -o memfd_test
--
2.1.4

2015-04-01 23:20:52

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 5/6] selftest/ipc: enable cross compilation

Use the CC variable instead of hard coding gcc.

Signed-off-by: Tyler Baker <[email protected]>
---
tools/testing/selftests/ipc/Makefile | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile
index 3b6013d..25d2e70 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -12,11 +12,7 @@ endif
CFLAGS += -I../../../../usr/include/

all:
-ifeq ($(ARCH),x86)
- gcc $(CFLAGS) msgque.c -o msgque_test
-else
- echo "Not an x86 target, can't build msgque selftest"
-endif
+ $(CC) $(CFLAGS) msgque.c -o msgque_test

TEST_PROGS := msgque_test

--
2.1.4

2015-04-01 23:20:54

by Tyler Baker

[permalink] [raw]
Subject: [PATCH 6/6] selftest/mqueue: enable cross compilation

Use the CC variable instead of hard coding gcc. Also clean up the compiler
options by creating a CFLAGS variable.

Signed-off-by: Tyler Baker <[email protected]>
---
tools/testing/selftests/mqueue/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile
index 6ca7261..0e3b41e 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -1,6 +1,8 @@
+CFLAGS = -O2
+
all:
- gcc -O2 mq_open_tests.c -o mq_open_tests -lrt
- gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt
+ $(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt
+ $(CC) $(CFLAGS) -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt

include ../lib.mk

--
2.1.4

2015-04-02 13:53:16

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 0/6] selftests: improve cross compilation support

On 04/01/2015 05:20 PM, Tyler Baker wrote:
> This patch set improves cross building functionality by resovling hard coded
> assumptions about the compiler used. With this patch set, all but mqueue,
> and kdbus cross build successfully as they must link against a native
> libraries. The hope is tha the above issues can be resolved in future patch
> sets. I have tested this series by building selftests for x86_64, arm and
> arm64 targets.
>
> This motivation behind this series is to enable the kernelci.org service to
> easily build, deploy, and execute selftests on many different processor
> architectures without natively compiling them. With the hope of quickly
> providing these test results back to the community.
>
> This series is based on next-20150401.
>
> Tyler Baker (6):
> selftest/memfd: enable cross compilation
> selftest/kdbus: enable cross compilation
> selftest/mount: enable cross compilation
> selftest/memfd: include default header install path
> selftest/ipc: enable cross compilation
> selftest/mqueue: enable cross compilation
>
> tools/testing/selftests/ipc/Makefile | 6 +-----
> tools/testing/selftests/kdbus/Makefile | 4 ++--
> tools/testing/selftests/memfd/Makefile | 8 +++++---
> tools/testing/selftests/mount/Makefile | 5 +++--
> tools/testing/selftests/mqueue/Makefile | 6 ++++--
> 5 files changed, 15 insertions(+), 14 deletions(-)
>


Tyler,

Thanks for getting this work done. It is a bit late for
4.1 and I plan to get these into 4.2.

thanks,
-- Shuah

--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978

2015-04-02 17:19:45

by Tyler Baker

[permalink] [raw]
Subject: Re: [PATCH 0/6] selftests: improve cross compilation support

Hi Shuah,

On 2 April 2015 at 06:53, Shuah Khan <[email protected]> wrote:
> On 04/01/2015 05:20 PM, Tyler Baker wrote:
>> This patch set improves cross building functionality by resovling hard coded
>> assumptions about the compiler used. With this patch set, all but mqueue,
>> and kdbus cross build successfully as they must link against a native
>> libraries. The hope is tha the above issues can be resolved in future patch
>> sets. I have tested this series by building selftests for x86_64, arm and
>> arm64 targets.
>>
>> This motivation behind this series is to enable the kernelci.org service to
>> easily build, deploy, and execute selftests on many different processor
>> architectures without natively compiling them. With the hope of quickly
>> providing these test results back to the community.
>>
>> This series is based on next-20150401.
>>
>> Tyler Baker (6):
>> selftest/memfd: enable cross compilation
>> selftest/kdbus: enable cross compilation
>> selftest/mount: enable cross compilation
>> selftest/memfd: include default header install path
>> selftest/ipc: enable cross compilation
>> selftest/mqueue: enable cross compilation
>>
>> tools/testing/selftests/ipc/Makefile | 6 +-----
>> tools/testing/selftests/kdbus/Makefile | 4 ++--
>> tools/testing/selftests/memfd/Makefile | 8 +++++---
>> tools/testing/selftests/mount/Makefile | 5 +++--
>> tools/testing/selftests/mqueue/Makefile | 6 ++++--
>> 5 files changed, 15 insertions(+), 14 deletions(-)
>>
>
>
> Tyler,
>
> Thanks for getting this work done. It is a bit late for
> 4.1 and I plan to get these into 4.2.

Thank you for your consideration, apologies for sending this series
late in the merge window. Having these patches included in 4.2 sounds
fine to me.

>
> thanks,
> -- Shuah
>
> --
> Shuah Khan
> Sr. Linux Kernel Developer
> Open Source Innovation Group
> Samsung Research America (Silicon Valley)
> [email protected] | (970) 217-8978

Cheers,

Tyler

2015-04-02 17:24:05

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 0/6] selftests: improve cross compilation support

On 04/02/2015 07:53 AM, Shuah Khan wrote:
> On 04/01/2015 05:20 PM, Tyler Baker wrote:
>> This patch set improves cross building functionality by resovling hard coded
>> assumptions about the compiler used. With this patch set, all but mqueue,
>> and kdbus cross build successfully as they must link against a native
>> libraries. The hope is tha the above issues can be resolved in future patch
>> sets. I have tested this series by building selftests for x86_64, arm and
>> arm64 targets.
>>
>> This motivation behind this series is to enable the kernelci.org service to
>> easily build, deploy, and execute selftests on many different processor
>> architectures without natively compiling them. With the hope of quickly
>> providing these test results back to the community.
>>
>> This series is based on next-20150401.
>>
>> Tyler Baker (6):
>> selftest/memfd: enable cross compilation
>> selftest/kdbus: enable cross compilation
>> selftest/mount: enable cross compilation
>> selftest/memfd: include default header install path
>> selftest/ipc: enable cross compilation
>> selftest/mqueue: enable cross compilation
>>
>> tools/testing/selftests/ipc/Makefile | 6 +-----
>> tools/testing/selftests/kdbus/Makefile | 4 ++--
>> tools/testing/selftests/memfd/Makefile | 8 +++++---
>> tools/testing/selftests/mount/Makefile | 5 +++--
>> tools/testing/selftests/mqueue/Makefile | 6 ++++--
>> 5 files changed, 15 insertions(+), 14 deletions(-)
>>
>
>
> Tyler,
>
> Thanks for getting this work done. It is a bit late for
> 4.1 and I plan to get these into 4.2.
>

After taking a second look at the patches, I want to get
these into 4.1. It will be nice to enable cross compile
as well in this release.

The one patch I won't be able to take it through kselftest
tree is kdbus for logistical reasons. kdbus is going through
Greg's tree - one of his many trees :)

Greg!

Will you be able to include this kdbus patch in this series
in your pull request for kdbus. I will reply to the kdbus
patch in this series and cc you on that. If this doesn't
work, could you suggest an alternative.

thanks,
-- Shuah


--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978

2015-04-02 17:28:26

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 2/6] selftest/kdbus: enable cross compilation

On 04/01/2015 05:20 PM, Tyler Baker wrote:
> Use the CC variable instead of hard coding gcc and include lib.mk.
>
> Signed-off-by: Tyler Baker <[email protected]>

Greg,

Will you be able to take this patch in with the other
kdbus sleftest patches?

Acked-by: Shuah Khan <[email protected]>

thanks,
-- Shuah

> ---
> tools/testing/selftests/kdbus/Makefile | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/kdbus/Makefile b/tools/testing/selftests/kdbus/Makefile
> index f6cfab2..de8242f 100644
> --- a/tools/testing/selftests/kdbus/Makefile
> +++ b/tools/testing/selftests/kdbus/Makefile
> @@ -33,11 +33,13 @@ OBJS= \
>
> all: kdbus-test
>
> +include ../lib.mk
> +
> %.o: %.c
> - gcc $(CFLAGS) -c $< -o $@
> + $(CC) $(CFLAGS) -c $< -o $@
>
> kdbus-test: $(OBJS)
> - gcc $(CFLAGS) $^ $(LDLIBS) -o $@
> + $(CC) $(CFLAGS) $^ $(LDLIBS) -o $@
>
> run_tests:
> ./kdbus-test --tap
>


--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978

2015-04-02 18:48:08

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 0/6] selftests: improve cross compilation support

On 04/02/2015 11:23 AM, Shuah Khan wrote:
> On 04/02/2015 07:53 AM, Shuah Khan wrote:
>> On 04/01/2015 05:20 PM, Tyler Baker wrote:
>>> This patch set improves cross building functionality by resovling hard coded
>>> assumptions about the compiler used. With this patch set, all but mqueue,
>>> and kdbus cross build successfully as they must link against a native
>>> libraries. The hope is tha the above issues can be resolved in future patch
>>> sets. I have tested this series by building selftests for x86_64, arm and
>>> arm64 targets.
>>>
>>> This motivation behind this series is to enable the kernelci.org service to
>>> easily build, deploy, and execute selftests on many different processor
>>> architectures without natively compiling them. With the hope of quickly
>>> providing these test results back to the community.
>>>
>>> This series is based on next-20150401.
>>>
>>> Tyler Baker (6):
>>> selftest/memfd: enable cross compilation
>>> selftest/kdbus: enable cross compilation
>>> selftest/mount: enable cross compilation
>>> selftest/memfd: include default header install path
>>> selftest/ipc: enable cross compilation
>>> selftest/mqueue: enable cross compilation
>>>
>>> tools/testing/selftests/ipc/Makefile | 6 +-----
>>> tools/testing/selftests/kdbus/Makefile | 4 ++--
>>> tools/testing/selftests/memfd/Makefile | 8 +++++---
>>> tools/testing/selftests/mount/Makefile | 5 +++--
>>> tools/testing/selftests/mqueue/Makefile | 6 ++++--
>>> 5 files changed, 15 insertions(+), 14 deletions(-)
>>>
>>
>>
>> Tyler,
>>
>> Thanks for getting this work done. It is a bit late for
>> 4.1 and I plan to get these into 4.2.
>>
>
> After taking a second look at the patches, I want to get
> these into 4.1. It will be nice to enable cross compile
> as well in this release.
>
> The one patch I won't be able to take it through kselftest
> tree is kdbus for logistical reasons. kdbus is going through
> Greg's tree - one of his many trees :)
>
> Greg!
>
> Will you be able to include this kdbus patch in this series
> in your pull request for kdbus. I will reply to the kdbus
> patch in this series and cc you on that. If this doesn't
> work, could you suggest an alternative.
>

All patches except the kdbus patch are now in linux-kselftest next
for 4.1

thanks,
-- Shuah


--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978

2015-04-02 22:04:17

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/6] selftest/kdbus: enable cross compilation

On Thu, Apr 02, 2015 at 11:28:23AM -0600, Shuah Khan wrote:
> On 04/01/2015 05:20 PM, Tyler Baker wrote:
> > Use the CC variable instead of hard coding gcc and include lib.mk.
> >
> > Signed-off-by: Tyler Baker <[email protected]>
>
> Greg,
>
> Will you be able to take this patch in with the other
> kdbus sleftest patches?
>
> Acked-by: Shuah Khan <[email protected]>

Thanks, I'll pick this up through my tree.

greg k-h

2015-04-03 14:29:10

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/6] selftest/kdbus: enable cross compilation

On Wed, Apr 01, 2015 at 04:20:16PM -0700, Tyler Baker wrote:
> Use the CC variable instead of hard coding gcc and include lib.mk.
>
> Signed-off-by: Tyler Baker <[email protected]>
> Acked-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/kdbus/Makefile | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)

Applied to my kdbus branch, thanks.

greg k-h