Re: [PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-17 Thread Shuah Khan
On 06/09/2015 10:23 AM, Davidlohr Bueso wrote:
> On Tue, 2015-06-09 at 06:55 -0600, Shuah Khan wrote
>>> diff --git a/tools/testing/selftests/ipc/.gitignore 
>>> b/tools/testing/selftests/ipc/.gitignore
>>> new file mode 100644
>>> index 000..3d8a449
>>> --- /dev/null
>>> +++ b/tools/testing/selftests/ipc/.gitignore
>>> @@ -0,0 +1,3 @@
>>> +mqueue/mq_open_tests
>>> +mqueue/mq_perf_tests
>>> +msg/msgque_test
>>> diff --git a/tools/testing/selftests/ipc/Makefile 
>>> b/tools/testing/selftests/ipc/Makefile
>>> index 25d2e70..8686551 100644
>>> --- a/tools/testing/selftests/ipc/Makefile
>>> +++ b/tools/testing/selftests/ipc/Makefile
>>> @@ -1,22 +1,22 @@
>>> -uname_M := $(shell uname -m 2>/dev/null || echo not)
>>> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
>>> -ifeq ($(ARCH),i386)
>>> -ARCH := x86
>>> -   CFLAGS := -DCONFIG_X86_32 -D__i386__
>>> -endif
>>> -ifeq ($(ARCH),x86_64)
>>> -   ARCH := x86
>>> -   CFLAGS := -DCONFIG_X86_64 -D__x86_64__
>>> -endif
>>> -
>>> -CFLAGS += -I../../../../usr/include/
>>
>> Hmm. This looks like more than a moving code and cleanup change.
>> The above is removing special handling for x86 and x86_64.
>>
>> I would like to see this as a separate patch and not combined
>> with the moving code.
> 
> No, this is merely being moved to msg/Makefile, see below:
> 

I was just about to queue this patch up for 4.2. However, with this
patch mqueue test no longer builds and runs. This is because of the
consolidation. If you intend to continue to run, you will have to
add ipc to the selftests Makefile TARGETS instead of mqueue, provided
you would want ipc to be part of the run-tests target.

Build phase:
make[2]: Entering directory
'/mnt/data/lkml/linux-kselftest/tools/testing/selftests/mqueue'
make[2]: *** No rule to make target 'run_tests'.  Stop

run-tests phase:
make[2]: Entering directory
'/mnt/data/lkml/linux-kselftest/tools/testing/selftests/mqueue'
make[2]: *** No rule to make target 'run_tests'.  Stop.
make[2]: Leaving directory
'/mnt/data/lkml/linux-kselftest/tools/testing/selftests/mqueue'

Also install won't install any ipc binaries since ipc isn't in the
TARGETS.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
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: [PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-17 Thread Shuah Khan
On 06/09/2015 10:23 AM, Davidlohr Bueso wrote:
 On Tue, 2015-06-09 at 06:55 -0600, Shuah Khan wrote
 diff --git a/tools/testing/selftests/ipc/.gitignore 
 b/tools/testing/selftests/ipc/.gitignore
 new file mode 100644
 index 000..3d8a449
 --- /dev/null
 +++ b/tools/testing/selftests/ipc/.gitignore
 @@ -0,0 +1,3 @@
 +mqueue/mq_open_tests
 +mqueue/mq_perf_tests
 +msg/msgque_test
 diff --git a/tools/testing/selftests/ipc/Makefile 
 b/tools/testing/selftests/ipc/Makefile
 index 25d2e70..8686551 100644
 --- a/tools/testing/selftests/ipc/Makefile
 +++ b/tools/testing/selftests/ipc/Makefile
 @@ -1,22 +1,22 @@
 -uname_M := $(shell uname -m 2/dev/null || echo not)
 -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 -ifeq ($(ARCH),i386)
 -ARCH := x86
 -   CFLAGS := -DCONFIG_X86_32 -D__i386__
 -endif
 -ifeq ($(ARCH),x86_64)
 -   ARCH := x86
 -   CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 -endif
 -
 -CFLAGS += -I../../../../usr/include/

 Hmm. This looks like more than a moving code and cleanup change.
 The above is removing special handling for x86 and x86_64.

 I would like to see this as a separate patch and not combined
 with the moving code.
 
 No, this is merely being moved to msg/Makefile, see below:
 

I was just about to queue this patch up for 4.2. However, with this
patch mqueue test no longer builds and runs. This is because of the
consolidation. If you intend to continue to run, you will have to
add ipc to the selftests Makefile TARGETS instead of mqueue, provided
you would want ipc to be part of the run-tests target.

Build phase:
make[2]: Entering directory
'/mnt/data/lkml/linux-kselftest/tools/testing/selftests/mqueue'
make[2]: *** No rule to make target 'run_tests'.  Stop

run-tests phase:
make[2]: Entering directory
'/mnt/data/lkml/linux-kselftest/tools/testing/selftests/mqueue'
make[2]: *** No rule to make target 'run_tests'.  Stop.
make[2]: Leaving directory
'/mnt/data/lkml/linux-kselftest/tools/testing/selftests/mqueue'

Also install won't install any ipc binaries since ipc isn't in the
TARGETS.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
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: [PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-09 Thread Davidlohr Bueso
On Tue, 2015-06-09 at 06:55 -0600, Shuah Khan wrote
> > diff --git a/tools/testing/selftests/ipc/.gitignore 
> > b/tools/testing/selftests/ipc/.gitignore
> > new file mode 100644
> > index 000..3d8a449
> > --- /dev/null
> > +++ b/tools/testing/selftests/ipc/.gitignore
> > @@ -0,0 +1,3 @@
> > +mqueue/mq_open_tests
> > +mqueue/mq_perf_tests
> > +msg/msgque_test
> > diff --git a/tools/testing/selftests/ipc/Makefile 
> > b/tools/testing/selftests/ipc/Makefile
> > index 25d2e70..8686551 100644
> > --- a/tools/testing/selftests/ipc/Makefile
> > +++ b/tools/testing/selftests/ipc/Makefile
> > @@ -1,22 +1,22 @@
> > -uname_M := $(shell uname -m 2>/dev/null || echo not)
> > -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
> > -ifeq ($(ARCH),i386)
> > -ARCH := x86
> > -   CFLAGS := -DCONFIG_X86_32 -D__i386__
> > -endif
> > -ifeq ($(ARCH),x86_64)
> > -   ARCH := x86
> > -   CFLAGS := -DCONFIG_X86_64 -D__x86_64__
> > -endif
> > -
> > -CFLAGS += -I../../../../usr/include/
> 
> Hmm. This looks like more than a moving code and cleanup change.
> The above is removing special handling for x86 and x86_64.
> 
> I would like to see this as a separate patch and not combined
> with the moving code.

No, this is merely being moved to msg/Makefile, see below:

> diff --git a/tools/testing/selftests/ipc/msg/Makefile 
> b/tools/testing/selftests/ipc/msg/Makefile
> new file mode 100644
> index 000..777ca76
> --- /dev/null
> +++ b/tools/testing/selftests/ipc/msg/Makefile
> @@ -0,0 +1,22 @@
> +uname_M := $(shell uname -m 2>/dev/null || echo not)
> +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
> +ifeq ($(ARCH),i386)
> +ARCH := x86
> + CFLAGS := -DCONFIG_X86_32 -D__i386__
> +endif
> +ifeq ($(ARCH),x86_64)
> + ARCH := x86
> + CFLAGS := -DCONFIG_X86_64 -D__x86_64__
> +endif

Thanks,
Davidlohr

--
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: [PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-09 Thread Shuah Khan
On 06/08/2015 05:51 PM, Davidlohr Bueso wrote:
> Move them both in the their own directory, under selftests/ipc/.
> As with the actual code, all forms of ipc tend to reside in the
> same directory, so apply this to selftests.
> 
> Keep the Makefiles (at least for now), with some minor path
> hierarchy tweaks, for both msg and mqueue. Add a trivial
> ipc/Makefile that simply passes the building to the individual
> subdirectory.
> 
> Signed-off-by: Davidlohr Bueso 

Looks good in general. Please see comments below.

> ---
>  tools/testing/selftests/ipc/.gitignore |   3 +
>  tools/testing/selftests/ipc/Makefile   |  32 +-
>  tools/testing/selftests/ipc/mqueue/Makefile|  22 +
>  tools/testing/selftests/ipc/mqueue/mq_open_tests.c | 500 ++
>  tools/testing/selftests/ipc/mqueue/mq_perf_tests.c | 742 
> +
>  tools/testing/selftests/ipc/msg/Makefile   |  22 +
>  tools/testing/selftests/ipc/msg/msgque.c   | 254 +++
>  tools/testing/selftests/ipc/msgque.c   | 254 ---
>  tools/testing/selftests/mqueue/.gitignore  |   2 -
>  tools/testing/selftests/mqueue/Makefile|  22 -
>  tools/testing/selftests/mqueue/mq_open_tests.c | 500 --
>  tools/testing/selftests/mqueue/mq_perf_tests.c | 742 
> -
>  12 files changed, 1559 insertions(+), 1536 deletions(-)
>  create mode 100644 tools/testing/selftests/ipc/.gitignore
>  create mode 100644 tools/testing/selftests/ipc/mqueue/Makefile
>  create mode 100644 tools/testing/selftests/ipc/mqueue/mq_open_tests.c
>  create mode 100644 tools/testing/selftests/ipc/mqueue/mq_perf_tests.c
>  create mode 100644 tools/testing/selftests/ipc/msg/Makefile
>  create mode 100644 tools/testing/selftests/ipc/msg/msgque.c
>  delete mode 100644 tools/testing/selftests/ipc/msgque.c
>  delete mode 100644 tools/testing/selftests/mqueue/.gitignore
>  delete mode 100644 tools/testing/selftests/mqueue/Makefile
>  delete mode 100644 tools/testing/selftests/mqueue/mq_open_tests.c
>  delete mode 100644 tools/testing/selftests/mqueue/mq_perf_tests.c
> 
> diff --git a/tools/testing/selftests/ipc/.gitignore 
> b/tools/testing/selftests/ipc/.gitignore
> new file mode 100644
> index 000..3d8a449
> --- /dev/null
> +++ b/tools/testing/selftests/ipc/.gitignore
> @@ -0,0 +1,3 @@
> +mqueue/mq_open_tests
> +mqueue/mq_perf_tests
> +msg/msgque_test
> diff --git a/tools/testing/selftests/ipc/Makefile 
> b/tools/testing/selftests/ipc/Makefile
> index 25d2e70..8686551 100644
> --- a/tools/testing/selftests/ipc/Makefile
> +++ b/tools/testing/selftests/ipc/Makefile
> @@ -1,22 +1,22 @@
> -uname_M := $(shell uname -m 2>/dev/null || echo not)
> -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
> -ifeq ($(ARCH),i386)
> -ARCH := x86
> - CFLAGS := -DCONFIG_X86_32 -D__i386__
> -endif
> -ifeq ($(ARCH),x86_64)
> - ARCH := x86
> - CFLAGS := -DCONFIG_X86_64 -D__x86_64__
> -endif
> -
> -CFLAGS += -I../../../../usr/include/

Hmm. This looks like more than a moving code and cleanup change.
The above is removing special handling for x86 and x86_64.

I would like to see this as a separate patch and not combined
with the moving code.

> +SUBDIRS := msg
> +SUBDIRS += mqueue
>  
> +.PHONY: all clean
>  all:
> - $(CC) $(CFLAGS) msgque.c -o msgque_test
> -
> -TEST_PROGS := msgque_test
> + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
>  
>  include ../lib.mk
> +override define RUN_TESTS
> + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
> +endef
> +
> +override define INSTALL_RULE
> + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
> +endef
> +
> +override define EMIT_TESTS
> + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
> +endef
>  
>  clean:
> - rm -fr ./msgque_test
> + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
> diff --git a/tools/testing/selftests/ipc/mqueue/Makefile 
> b/tools/testing/selftests/ipc/mqueue/Makefile
> new file mode 100644
> index 000..1fa56ea
> --- /dev/null
> +++ b/tools/testing/selftests/ipc/mqueue/Makefile
> @@ -0,0 +1,22 @@
> +CFLAGS = -O2
> +
> +all:
> + $(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
> +
> +override define RUN_TESTS
> + @./mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
> + @./mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
> +endef
> +
> +TEST_PROGS := mq_open_tests mq_perf_tests
> +
> +override define EMIT_TESTS
> + echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests 
> [FAIL]\""
> + echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
> +endef
> +
> +clean:
> + rm -f mq_open_tests mq_perf_tests
> diff --git a/tools/testing/selftests/ipc/mqueue/mq_open_tests.c 
> b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
> new file mode 100644
> index 000..9c1a5d35
> --- 

Re: [PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-09 Thread Davidlohr Bueso
On Tue, 2015-06-09 at 06:55 -0600, Shuah Khan wrote
  diff --git a/tools/testing/selftests/ipc/.gitignore 
  b/tools/testing/selftests/ipc/.gitignore
  new file mode 100644
  index 000..3d8a449
  --- /dev/null
  +++ b/tools/testing/selftests/ipc/.gitignore
  @@ -0,0 +1,3 @@
  +mqueue/mq_open_tests
  +mqueue/mq_perf_tests
  +msg/msgque_test
  diff --git a/tools/testing/selftests/ipc/Makefile 
  b/tools/testing/selftests/ipc/Makefile
  index 25d2e70..8686551 100644
  --- a/tools/testing/selftests/ipc/Makefile
  +++ b/tools/testing/selftests/ipc/Makefile
  @@ -1,22 +1,22 @@
  -uname_M := $(shell uname -m 2/dev/null || echo not)
  -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
  -ifeq ($(ARCH),i386)
  -ARCH := x86
  -   CFLAGS := -DCONFIG_X86_32 -D__i386__
  -endif
  -ifeq ($(ARCH),x86_64)
  -   ARCH := x86
  -   CFLAGS := -DCONFIG_X86_64 -D__x86_64__
  -endif
  -
  -CFLAGS += -I../../../../usr/include/
 
 Hmm. This looks like more than a moving code and cleanup change.
 The above is removing special handling for x86 and x86_64.
 
 I would like to see this as a separate patch and not combined
 with the moving code.

No, this is merely being moved to msg/Makefile, see below:

 diff --git a/tools/testing/selftests/ipc/msg/Makefile 
 b/tools/testing/selftests/ipc/msg/Makefile
 new file mode 100644
 index 000..777ca76
 --- /dev/null
 +++ b/tools/testing/selftests/ipc/msg/Makefile
 @@ -0,0 +1,22 @@
 +uname_M := $(shell uname -m 2/dev/null || echo not)
 +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 +ifeq ($(ARCH),i386)
 +ARCH := x86
 + CFLAGS := -DCONFIG_X86_32 -D__i386__
 +endif
 +ifeq ($(ARCH),x86_64)
 + ARCH := x86
 + CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 +endif

Thanks,
Davidlohr

--
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: [PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-09 Thread Shuah Khan
On 06/08/2015 05:51 PM, Davidlohr Bueso wrote:
 Move them both in the their own directory, under selftests/ipc/.
 As with the actual code, all forms of ipc tend to reside in the
 same directory, so apply this to selftests.
 
 Keep the Makefiles (at least for now), with some minor path
 hierarchy tweaks, for both msg and mqueue. Add a trivial
 ipc/Makefile that simply passes the building to the individual
 subdirectory.
 
 Signed-off-by: Davidlohr Bueso dbu...@suse.de

Looks good in general. Please see comments below.

 ---
  tools/testing/selftests/ipc/.gitignore |   3 +
  tools/testing/selftests/ipc/Makefile   |  32 +-
  tools/testing/selftests/ipc/mqueue/Makefile|  22 +
  tools/testing/selftests/ipc/mqueue/mq_open_tests.c | 500 ++
  tools/testing/selftests/ipc/mqueue/mq_perf_tests.c | 742 
 +
  tools/testing/selftests/ipc/msg/Makefile   |  22 +
  tools/testing/selftests/ipc/msg/msgque.c   | 254 +++
  tools/testing/selftests/ipc/msgque.c   | 254 ---
  tools/testing/selftests/mqueue/.gitignore  |   2 -
  tools/testing/selftests/mqueue/Makefile|  22 -
  tools/testing/selftests/mqueue/mq_open_tests.c | 500 --
  tools/testing/selftests/mqueue/mq_perf_tests.c | 742 
 -
  12 files changed, 1559 insertions(+), 1536 deletions(-)
  create mode 100644 tools/testing/selftests/ipc/.gitignore
  create mode 100644 tools/testing/selftests/ipc/mqueue/Makefile
  create mode 100644 tools/testing/selftests/ipc/mqueue/mq_open_tests.c
  create mode 100644 tools/testing/selftests/ipc/mqueue/mq_perf_tests.c
  create mode 100644 tools/testing/selftests/ipc/msg/Makefile
  create mode 100644 tools/testing/selftests/ipc/msg/msgque.c
  delete mode 100644 tools/testing/selftests/ipc/msgque.c
  delete mode 100644 tools/testing/selftests/mqueue/.gitignore
  delete mode 100644 tools/testing/selftests/mqueue/Makefile
  delete mode 100644 tools/testing/selftests/mqueue/mq_open_tests.c
  delete mode 100644 tools/testing/selftests/mqueue/mq_perf_tests.c
 
 diff --git a/tools/testing/selftests/ipc/.gitignore 
 b/tools/testing/selftests/ipc/.gitignore
 new file mode 100644
 index 000..3d8a449
 --- /dev/null
 +++ b/tools/testing/selftests/ipc/.gitignore
 @@ -0,0 +1,3 @@
 +mqueue/mq_open_tests
 +mqueue/mq_perf_tests
 +msg/msgque_test
 diff --git a/tools/testing/selftests/ipc/Makefile 
 b/tools/testing/selftests/ipc/Makefile
 index 25d2e70..8686551 100644
 --- a/tools/testing/selftests/ipc/Makefile
 +++ b/tools/testing/selftests/ipc/Makefile
 @@ -1,22 +1,22 @@
 -uname_M := $(shell uname -m 2/dev/null || echo not)
 -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
 -ifeq ($(ARCH),i386)
 -ARCH := x86
 - CFLAGS := -DCONFIG_X86_32 -D__i386__
 -endif
 -ifeq ($(ARCH),x86_64)
 - ARCH := x86
 - CFLAGS := -DCONFIG_X86_64 -D__x86_64__
 -endif
 -
 -CFLAGS += -I../../../../usr/include/

Hmm. This looks like more than a moving code and cleanup change.
The above is removing special handling for x86 and x86_64.

I would like to see this as a separate patch and not combined
with the moving code.

 +SUBDIRS := msg
 +SUBDIRS += mqueue
  
 +.PHONY: all clean
  all:
 - $(CC) $(CFLAGS) msgque.c -o msgque_test
 -
 -TEST_PROGS := msgque_test
 + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
  
  include ../lib.mk
 +override define RUN_TESTS
 + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 +endef
 +
 +override define INSTALL_RULE
 + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 +endef
 +
 +override define EMIT_TESTS
 + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 +endef
  
  clean:
 - rm -fr ./msgque_test
 + for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 diff --git a/tools/testing/selftests/ipc/mqueue/Makefile 
 b/tools/testing/selftests/ipc/mqueue/Makefile
 new file mode 100644
 index 000..1fa56ea
 --- /dev/null
 +++ b/tools/testing/selftests/ipc/mqueue/Makefile
 @@ -0,0 +1,22 @@
 +CFLAGS = -O2
 +
 +all:
 + $(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
 +
 +override define RUN_TESTS
 + @./mq_open_tests /test1 || echo selftests: mq_open_tests [FAIL]
 + @./mq_perf_tests || echo selftests: mq_perf_tests [FAIL]
 +endef
 +
 +TEST_PROGS := mq_open_tests mq_perf_tests
 +
 +override define EMIT_TESTS
 + echo ./mq_open_tests /test1 || echo \selftests: mq_open_tests 
 [FAIL]\
 + echo ./mq_perf_tests || echo \selftests: mq_perf_tests [FAIL]\
 +endef
 +
 +clean:
 + rm -f mq_open_tests mq_perf_tests
 diff --git a/tools/testing/selftests/ipc/mqueue/mq_open_tests.c 
 b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
 new file mode 100644
 index 000..9c1a5d35
 --- /dev/null
 +++ b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
 @@ -0,0 +1,500 @@
 +/*
 + * This application is 

[PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-08 Thread Davidlohr Bueso
Move them both in the their own directory, under selftests/ipc/.
As with the actual code, all forms of ipc tend to reside in the
same directory, so apply this to selftests.

Keep the Makefiles (at least for now), with some minor path
hierarchy tweaks, for both msg and mqueue. Add a trivial
ipc/Makefile that simply passes the building to the individual
subdirectory.

Signed-off-by: Davidlohr Bueso 
---
 tools/testing/selftests/ipc/.gitignore |   3 +
 tools/testing/selftests/ipc/Makefile   |  32 +-
 tools/testing/selftests/ipc/mqueue/Makefile|  22 +
 tools/testing/selftests/ipc/mqueue/mq_open_tests.c | 500 ++
 tools/testing/selftests/ipc/mqueue/mq_perf_tests.c | 742 +
 tools/testing/selftests/ipc/msg/Makefile   |  22 +
 tools/testing/selftests/ipc/msg/msgque.c   | 254 +++
 tools/testing/selftests/ipc/msgque.c   | 254 ---
 tools/testing/selftests/mqueue/.gitignore  |   2 -
 tools/testing/selftests/mqueue/Makefile|  22 -
 tools/testing/selftests/mqueue/mq_open_tests.c | 500 --
 tools/testing/selftests/mqueue/mq_perf_tests.c | 742 -
 12 files changed, 1559 insertions(+), 1536 deletions(-)
 create mode 100644 tools/testing/selftests/ipc/.gitignore
 create mode 100644 tools/testing/selftests/ipc/mqueue/Makefile
 create mode 100644 tools/testing/selftests/ipc/mqueue/mq_open_tests.c
 create mode 100644 tools/testing/selftests/ipc/mqueue/mq_perf_tests.c
 create mode 100644 tools/testing/selftests/ipc/msg/Makefile
 create mode 100644 tools/testing/selftests/ipc/msg/msgque.c
 delete mode 100644 tools/testing/selftests/ipc/msgque.c
 delete mode 100644 tools/testing/selftests/mqueue/.gitignore
 delete mode 100644 tools/testing/selftests/mqueue/Makefile
 delete mode 100644 tools/testing/selftests/mqueue/mq_open_tests.c
 delete mode 100644 tools/testing/selftests/mqueue/mq_perf_tests.c

diff --git a/tools/testing/selftests/ipc/.gitignore 
b/tools/testing/selftests/ipc/.gitignore
new file mode 100644
index 000..3d8a449
--- /dev/null
+++ b/tools/testing/selftests/ipc/.gitignore
@@ -0,0 +1,3 @@
+mqueue/mq_open_tests
+mqueue/mq_perf_tests
+msg/msgque_test
diff --git a/tools/testing/selftests/ipc/Makefile 
b/tools/testing/selftests/ipc/Makefile
index 25d2e70..8686551 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,22 +1,22 @@
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
-ifeq ($(ARCH),i386)
-ARCH := x86
-   CFLAGS := -DCONFIG_X86_32 -D__i386__
-endif
-ifeq ($(ARCH),x86_64)
-   ARCH := x86
-   CFLAGS := -DCONFIG_X86_64 -D__x86_64__
-endif
-
-CFLAGS += -I../../../../usr/include/
+SUBDIRS := msg
+SUBDIRS += mqueue
 
+.PHONY: all clean
 all:
-   $(CC) $(CFLAGS) msgque.c -o msgque_test
-
-TEST_PROGS := msgque_test
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 
 include ../lib.mk
+override define RUN_TESTS
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+endef
+
+override define INSTALL_RULE
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+endef
+
+override define EMIT_TESTS
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+endef
 
 clean:
-   rm -fr ./msgque_test
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
diff --git a/tools/testing/selftests/ipc/mqueue/Makefile 
b/tools/testing/selftests/ipc/mqueue/Makefile
new file mode 100644
index 000..1fa56ea
--- /dev/null
+++ b/tools/testing/selftests/ipc/mqueue/Makefile
@@ -0,0 +1,22 @@
+CFLAGS = -O2
+
+all:
+   $(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
+
+override define RUN_TESTS
+   @./mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
+   @./mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
+endef
+
+TEST_PROGS := mq_open_tests mq_perf_tests
+
+override define EMIT_TESTS
+   echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests 
[FAIL]\""
+   echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
+endef
+
+clean:
+   rm -f mq_open_tests mq_perf_tests
diff --git a/tools/testing/selftests/ipc/mqueue/mq_open_tests.c 
b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
new file mode 100644
index 000..9c1a5d35
--- /dev/null
+++ b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
@@ -0,0 +1,500 @@
+/*
+ * This application is Copyright 2012 Red Hat, Inc.
+ * Doug Ledford 
+ *
+ * mq_open_tests is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * mq_open_tests is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS 

[PATCH -next] selftests/ipc: Consolidate posix and sysv msg queue tests

2015-06-08 Thread Davidlohr Bueso
Move them both in the their own directory, under selftests/ipc/.
As with the actual code, all forms of ipc tend to reside in the
same directory, so apply this to selftests.

Keep the Makefiles (at least for now), with some minor path
hierarchy tweaks, for both msg and mqueue. Add a trivial
ipc/Makefile that simply passes the building to the individual
subdirectory.

Signed-off-by: Davidlohr Bueso dbu...@suse.de
---
 tools/testing/selftests/ipc/.gitignore |   3 +
 tools/testing/selftests/ipc/Makefile   |  32 +-
 tools/testing/selftests/ipc/mqueue/Makefile|  22 +
 tools/testing/selftests/ipc/mqueue/mq_open_tests.c | 500 ++
 tools/testing/selftests/ipc/mqueue/mq_perf_tests.c | 742 +
 tools/testing/selftests/ipc/msg/Makefile   |  22 +
 tools/testing/selftests/ipc/msg/msgque.c   | 254 +++
 tools/testing/selftests/ipc/msgque.c   | 254 ---
 tools/testing/selftests/mqueue/.gitignore  |   2 -
 tools/testing/selftests/mqueue/Makefile|  22 -
 tools/testing/selftests/mqueue/mq_open_tests.c | 500 --
 tools/testing/selftests/mqueue/mq_perf_tests.c | 742 -
 12 files changed, 1559 insertions(+), 1536 deletions(-)
 create mode 100644 tools/testing/selftests/ipc/.gitignore
 create mode 100644 tools/testing/selftests/ipc/mqueue/Makefile
 create mode 100644 tools/testing/selftests/ipc/mqueue/mq_open_tests.c
 create mode 100644 tools/testing/selftests/ipc/mqueue/mq_perf_tests.c
 create mode 100644 tools/testing/selftests/ipc/msg/Makefile
 create mode 100644 tools/testing/selftests/ipc/msg/msgque.c
 delete mode 100644 tools/testing/selftests/ipc/msgque.c
 delete mode 100644 tools/testing/selftests/mqueue/.gitignore
 delete mode 100644 tools/testing/selftests/mqueue/Makefile
 delete mode 100644 tools/testing/selftests/mqueue/mq_open_tests.c
 delete mode 100644 tools/testing/selftests/mqueue/mq_perf_tests.c

diff --git a/tools/testing/selftests/ipc/.gitignore 
b/tools/testing/selftests/ipc/.gitignore
new file mode 100644
index 000..3d8a449
--- /dev/null
+++ b/tools/testing/selftests/ipc/.gitignore
@@ -0,0 +1,3 @@
+mqueue/mq_open_tests
+mqueue/mq_perf_tests
+msg/msgque_test
diff --git a/tools/testing/selftests/ipc/Makefile 
b/tools/testing/selftests/ipc/Makefile
index 25d2e70..8686551 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,22 +1,22 @@
-uname_M := $(shell uname -m 2/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
-ifeq ($(ARCH),i386)
-ARCH := x86
-   CFLAGS := -DCONFIG_X86_32 -D__i386__
-endif
-ifeq ($(ARCH),x86_64)
-   ARCH := x86
-   CFLAGS := -DCONFIG_X86_64 -D__x86_64__
-endif
-
-CFLAGS += -I../../../../usr/include/
+SUBDIRS := msg
+SUBDIRS += mqueue
 
+.PHONY: all clean
 all:
-   $(CC) $(CFLAGS) msgque.c -o msgque_test
-
-TEST_PROGS := msgque_test
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
 
 include ../lib.mk
+override define RUN_TESTS
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+endef
+
+override define INSTALL_RULE
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+endef
+
+override define EMIT_TESTS
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
+endef
 
 clean:
-   rm -fr ./msgque_test
+   for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR $@ ; done
diff --git a/tools/testing/selftests/ipc/mqueue/Makefile 
b/tools/testing/selftests/ipc/mqueue/Makefile
new file mode 100644
index 000..1fa56ea
--- /dev/null
+++ b/tools/testing/selftests/ipc/mqueue/Makefile
@@ -0,0 +1,22 @@
+CFLAGS = -O2
+
+all:
+   $(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
+
+override define RUN_TESTS
+   @./mq_open_tests /test1 || echo selftests: mq_open_tests [FAIL]
+   @./mq_perf_tests || echo selftests: mq_perf_tests [FAIL]
+endef
+
+TEST_PROGS := mq_open_tests mq_perf_tests
+
+override define EMIT_TESTS
+   echo ./mq_open_tests /test1 || echo \selftests: mq_open_tests 
[FAIL]\
+   echo ./mq_perf_tests || echo \selftests: mq_perf_tests [FAIL]\
+endef
+
+clean:
+   rm -f mq_open_tests mq_perf_tests
diff --git a/tools/testing/selftests/ipc/mqueue/mq_open_tests.c 
b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
new file mode 100644
index 000..9c1a5d35
--- /dev/null
+++ b/tools/testing/selftests/ipc/mqueue/mq_open_tests.c
@@ -0,0 +1,500 @@
+/*
+ * This application is Copyright 2012 Red Hat, Inc.
+ * Doug Ledford dledf...@redhat.com
+ *
+ * mq_open_tests is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * mq_open_tests is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *