2017-04-21 23:15:02

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 0/8] Fix clean target warnings

This patch series consists of changes to lib.mk to allow overriding
common clean target from Makefiles. This fixes warnings when clean
overriding and ignoring warnings. Also fixes splice clean target
removing a script that runs the test from its clean target.

Shuah Khan (8):
selftests: splice: fix clean target to not remove
default_file_splice_read.sh
selftests: lib.mk: define CLEAN macro to allow Makefiles to override
clean
selftests: futex: override clean in lib.mk to fix warnings
selftests: gpio: override clean in lib.mk to fix warnings
selftests: powerpc: override clean in lib.mk to fix warnings
selftests: splice: override clean in lib.mk to fix warnings
selftests: sync: override clean in lib.mk to fix warnings
selftests: x86: override clean in lib.mk to fix warnings

tools/testing/selftests/futex/Makefile | 3 ++-
tools/testing/selftests/gpio/Makefile | 3 ++-
tools/testing/selftests/lib.mk | 6 +++++-
tools/testing/selftests/powerpc/Makefile | 3 ++-
tools/testing/selftests/splice/Makefile | 5 +++--
tools/testing/selftests/sync/Makefile | 3 ++-
tools/testing/selftests/x86/Makefile | 3 ++-
7 files changed, 18 insertions(+), 8 deletions(-)

--
2.9.3


2017-04-21 23:15:05

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 3/8] selftests: futex: override clean in lib.mk to fix warnings

Add override for lib.mk clean to fix the following warnings from clean
target run.

Makefile:36: warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/futex/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
index c8095e6..e2fbb89 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -32,9 +32,10 @@ override define EMIT_TESTS
echo "./run.sh"
endef

-clean:
+override define CLEAN
for DIR in $(SUBDIRS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
mkdir $$BUILD_TARGET -p; \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
done
+endef
--
2.9.3

2017-04-21 23:15:12

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 5/8] selftests: powerpc: override clean in lib.mk to fix warnings

Add override for lib.mk clean to fix the following warnings from clean
target run.

Makefile:63: warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/powerpc/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
index 1c5d057..8d9fc64 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -59,12 +59,13 @@ override define EMIT_TESTS
done;
endef

-clean:
+override define CLEAN
@for TARGET in $(SUB_DIRS); do \
BUILD_TARGET=$$OUTPUT/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
done;
rm -f tags
+endef

tags:
find . -name '*.c' -o -name '*.h' | xargs ctags
--
2.9.3

2017-04-21 23:15:22

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 6/8] selftests: splice: override clean in lib.mk to fix warnings

Add override for lib.mk clean to fix the following warnings from clean
target run.

Makefile:8: warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/splice/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile
index 559512c..3f967ba 100644
--- a/tools/testing/selftests/splice/Makefile
+++ b/tools/testing/selftests/splice/Makefile
@@ -4,5 +4,6 @@ all: $(TEST_PROGS) $(EXTRA)

include ../lib.mk

-clean:
+override define CLEAN
rm -fr $(EXTRA)
+endef
--
2.9.3

2017-04-21 23:15:25

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings

Add override for lib.mk clean to fix the following warnings from clean
target run.

Makefile:44: warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/x86/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 38e0a9c..4d27550 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -40,8 +40,9 @@ all_32: $(BINARIES_32)

all_64: $(BINARIES_64)

-clean:
+override define CLEAN
$(RM) $(BINARIES_32) $(BINARIES_64)
+endef

$(BINARIES_32): $(OUTPUT)/%_32: %.c
$(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm
--
2.9.3

2017-04-21 23:15:49

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 7/8] selftests: sync: override clean in lib.mk to fix warnings

Add override for lib.mk clean to fix the following warnings from clean
target run.

Makefile:24: warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/sync/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile
index 87ac400..f7d250d 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -20,5 +20,6 @@ TESTS += sync_stress_merge.o

sync_test: $(OBJS) $(TESTS)

-clean:
+override define CLEAN
$(RM) sync_test $(OBJS) $(TESTS)
+endef
--
2.9.3

2017-04-21 23:16:18

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

Define CLEAN macro to allow Makefiles to override common clean target
in lib.mk. This will help fix the following failures:

warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/lib.mk | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 775c589..959273c 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -51,8 +51,12 @@ endef
emit_tests:
$(EMIT_TESTS)

-clean:
+define CLEAN
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
+endef
+
+clean:
+ $(CLEAN)

$(OUTPUT)/%:%.c
$(LINK.c) $^ $(LDLIBS) -o $@
--
2.9.3

2017-04-21 23:16:15

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 4/8] selftests: gpio: override clean in lib.mk to fix warnings

Add override for lib.mk clean to fix the following warnings from clean
target run.

Makefile:11: warning: overriding recipe for target 'clean'
../lib.mk:55: warning: ignoring old recipe for target 'clean'

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/gpio/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 205e4d1..4f6d9e0 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -7,8 +7,9 @@ include ../lib.mk

all: $(BINARIES)

-clean:
+override define CLEAN
$(RM) $(BINARIES)
+endef

CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
LDLIBS += -lmount -I/usr/include/libmount
--
2.9.3

2017-04-21 23:16:52

by Shuah Khan

[permalink] [raw]
Subject: [PATCH 1/8] selftests: splice: fix clean target to not remove default_file_splice_read.sh

splice clean target removes the shell script default_file_splice_read.sh
that runs the splice test. Fix it to not remove this file.

Signed-off-by: Shuah Khan <[email protected]>
---
tools/testing/selftests/splice/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile
index de51f43..559512c 100644
--- a/tools/testing/selftests/splice/Makefile
+++ b/tools/testing/selftests/splice/Makefile
@@ -5,4 +5,4 @@ all: $(TEST_PROGS) $(EXTRA)
include ../lib.mk

clean:
- rm -fr $(TEST_PROGS) $(EXTRA)
+ rm -fr $(EXTRA)
--
2.9.3

2017-04-22 05:38:51

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

Shuah Khan <[email protected]> writes:

> Define CLEAN macro to allow Makefiles to override common clean target
> in lib.mk. This will help fix the following failures:
>
> warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>

Should probably have:

Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target")


In hindsight I'm not sure moving the clean target into lib.mk was
the best idea, but anyway it's a bit late to change our mind on that.

This patch is a good solution to fix the warnings.

Acked-by: Michael Ellerman <[email protected]>

cheers

2017-04-22 05:40:09

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 4/8] selftests: gpio: override clean in lib.mk to fix warnings

Shuah Khan <[email protected]> writes:

> Add override for lib.mk clean to fix the following warnings from clean
> target run.
>
> Makefile:11: warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/gpio/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
> index 205e4d1..4f6d9e0 100644
> --- a/tools/testing/selftests/gpio/Makefile
> +++ b/tools/testing/selftests/gpio/Makefile
> @@ -7,8 +7,9 @@ include ../lib.mk
>
> all: $(BINARIES)
>
> -clean:
> +override define CLEAN
> $(RM) $(BINARIES)
> +endef

This could be achieved more simply with:

EXTRA_CLEAN := $(BINARIES)

cheers

2017-04-22 05:40:38

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 6/8] selftests: splice: override clean in lib.mk to fix warnings

Shuah Khan <[email protected]> writes:

> Add override for lib.mk clean to fix the following warnings from clean
> target run.
>
> Makefile:8: warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/splice/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile
> index 559512c..3f967ba 100644
> --- a/tools/testing/selftests/splice/Makefile
> +++ b/tools/testing/selftests/splice/Makefile
> @@ -4,5 +4,6 @@ all: $(TEST_PROGS) $(EXTRA)
>
> include ../lib.mk
>
> -clean:
> +override define CLEAN
> rm -fr $(EXTRA)
> +endef

Could just be:

EXTRA_CLEAN := $(EXTRA)

cheers

2017-04-22 05:41:08

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 7/8] selftests: sync: override clean in lib.mk to fix warnings

Shuah Khan <[email protected]> writes:

> Add override for lib.mk clean to fix the following warnings from clean
> target run.
>
> Makefile:24: warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/sync/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile
> index 87ac400..f7d250d 100644
> --- a/tools/testing/selftests/sync/Makefile
> +++ b/tools/testing/selftests/sync/Makefile
> @@ -20,5 +20,6 @@ TESTS += sync_stress_merge.o
>
> sync_test: $(OBJS) $(TESTS)
>
> -clean:
> +override define CLEAN
> $(RM) sync_test $(OBJS) $(TESTS)
> +endef

EXTRA_CLEAN := sync_test $(OBJS) $(TESTS)

cheers

2017-04-22 05:41:33

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings

Shuah Khan <[email protected]> writes:

> Add override for lib.mk clean to fix the following warnings from clean
> target run.
>
> Makefile:44: warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/x86/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
> index 38e0a9c..4d27550 100644
> --- a/tools/testing/selftests/x86/Makefile
> +++ b/tools/testing/selftests/x86/Makefile
> @@ -40,8 +40,9 @@ all_32: $(BINARIES_32)
>
> all_64: $(BINARIES_64)
>
> -clean:
> +override define CLEAN
> $(RM) $(BINARIES_32) $(BINARIES_64)
> +endef

Simpler as:

EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64)

cheers

2017-04-24 15:47:30

by David Laight

[permalink] [raw]
Subject: RE: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

From: Shuah Khan
> Sent: 22 April 2017 00:15
> Define CLEAN macro to allow Makefiles to override common clean target
> in lib.mk. This will help fix the following failures:
>
> warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/lib.mk | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 775c589..959273c 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -51,8 +51,12 @@ endef
> emit_tests:
> $(EMIT_TESTS)
>
> -clean:
> +define CLEAN
> $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
> +endef
> +
> +clean:
> + $(CLEAN)

If might be easier to do something like:

ifneq($(NO_CLEAN),y)
clean:
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
endif

David

2017-04-24 15:58:02

by David Laight

[permalink] [raw]
Subject: RE: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings

From: Linuxppc-dev Michael Ellerman
> Shuah Khan <[email protected]> writes:
>
> > Add override for lib.mk clean to fix the following warnings from clean
> > target run.
> >
> > Makefile:44: warning: overriding recipe for target 'clean'
> > ../lib.mk:55: warning: ignoring old recipe for target 'clean'
> >
> > Signed-off-by: Shuah Khan <[email protected]>
> > ---
> > tools/testing/selftests/x86/Makefile | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
> > index 38e0a9c..4d27550 100644
> > --- a/tools/testing/selftests/x86/Makefile
> > +++ b/tools/testing/selftests/x86/Makefile
> > @@ -40,8 +40,9 @@ all_32: $(BINARIES_32)
> >
> > all_64: $(BINARIES_64)
> >
> > -clean:
> > +override define CLEAN
> > $(RM) $(BINARIES_32) $(BINARIES_64)
> > +endef
>
> Simpler as:
>
> EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64)

Actually for builds that insist on crapping all over the source tree I've used:

clean:
rm -rf `cat .cvsignore 2>/dev/null`

David

2017-04-24 19:46:36

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

On 04/24/2017 09:45 AM, David Laight wrote:
> From: Shuah Khan
>> Sent: 22 April 2017 00:15
>> Define CLEAN macro to allow Makefiles to override common clean target
>> in lib.mk. This will help fix the following failures:
>>
>> warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>> ---
>> tools/testing/selftests/lib.mk | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
>> index 775c589..959273c 100644
>> --- a/tools/testing/selftests/lib.mk
>> +++ b/tools/testing/selftests/lib.mk
>> @@ -51,8 +51,12 @@ endef
>> emit_tests:
>> $(EMIT_TESTS)
>>
>> -clean:
>> +define CLEAN
>> $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
>> +endef
>> +
>> +clean:
>> + $(CLEAN)
>
> If might be easier to do something like:
>
> ifneq($(NO_CLEAN),y)
> clean:
> $(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
> endif
>
> David
>

I am not sure that it is easier. Defining a macro would work well
in this case to override and also works well with what we are doing
for other overrides we already have such as EMIT_TESTS.

thanks,
-- Shuah

2017-04-24 19:48:56

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings

On 04/24/2017 09:57 AM, David Laight wrote:
> From: Linuxppc-dev Michael Ellerman
>> Shuah Khan <[email protected]> writes:
>>
>>> Add override for lib.mk clean to fix the following warnings from clean
>>> target run.
>>>
>>> Makefile:44: warning: overriding recipe for target 'clean'
>>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>>
>>> Signed-off-by: Shuah Khan <[email protected]>
>>> ---
>>> tools/testing/selftests/x86/Makefile | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
>>> index 38e0a9c..4d27550 100644
>>> --- a/tools/testing/selftests/x86/Makefile
>>> +++ b/tools/testing/selftests/x86/Makefile
>>> @@ -40,8 +40,9 @@ all_32: $(BINARIES_32)
>>>
>>> all_64: $(BINARIES_64)
>>>
>>> -clean:
>>> +override define CLEAN
>>> $(RM) $(BINARIES_32) $(BINARIES_64)
>>> +endef
>>
>> Simpler as:
>>
>> EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64)
>
> Actually for builds that insist on crapping all over the source tree I've used:
>
> clean:
> rm -rf `cat .cvsignore 2>/dev/null`
>
> David

This will have to be done as a separate change. The warnings I am fixing
are related to common clean target in lib.mk and the need to override.

thanks,
-- Shuah

2017-04-25 13:36:59

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

On 04/21/2017 11:38 PM, Michael Ellerman wrote:
> Shuah Khan <[email protected]> writes:
>
>> Define CLEAN macro to allow Makefiles to override common clean target
>> in lib.mk. This will help fix the following failures:
>>
>> warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>
> Should probably have:
>
> Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target")

Amended the change log to add the above.

>
>
> In hindsight I'm not sure moving the clean target into lib.mk was
> the best idea, but anyway it's a bit late to change our mind on that.

Yeah. Moving clean target to lib.mk ended up to be problematic. However,
there are some advantages as well. It will simplify some Makefiles. One
thing that was missed was that not finding the Makefiles that require
overrides. Anyway live and learn.

>
> This patch is a good solution to fix the warnings.
>
> Acked-by: Michael Ellerman <[email protected]>
>

Thanks. I plan to apply the patch with the amended changelog and your
Ack. Please let me know if you want to see v2 with the change sent out.

thanks,
-- Shuah

2017-04-25 15:02:20

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 4/8] selftests: gpio: override clean in lib.mk to fix warnings

On 04/21/2017 11:40 PM, Michael Ellerman wrote:
> Shuah Khan <[email protected]> writes:
>
>> Add override for lib.mk clean to fix the following warnings from clean
>> target run.
>>
>> Makefile:11: warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>> ---
>> tools/testing/selftests/gpio/Makefile | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
>> index 205e4d1..4f6d9e0 100644
>> --- a/tools/testing/selftests/gpio/Makefile
>> +++ b/tools/testing/selftests/gpio/Makefile
>> @@ -7,8 +7,9 @@ include ../lib.mk
>>
>> all: $(BINARIES)
>>
>> -clean:
>> +override define CLEAN
>> $(RM) $(BINARIES)
>> +endef
>
> This could be achieved more simply with:
>
> EXTRA_CLEAN := $(BINARIES)
>

gpio clean requires special handling. I have one more patch
I sent out that handles that. So I am going to leave this
patch the way with override.

thanks,
-- Shuah


2017-04-25 15:03:16

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 6/8] selftests: splice: override clean in lib.mk to fix warnings

On 04/21/2017 11:40 PM, Michael Ellerman wrote:
> Shuah Khan <[email protected]> writes:
>
>> Add override for lib.mk clean to fix the following warnings from clean
>> target run.
>>
>> Makefile:8: warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>> ---
>> tools/testing/selftests/splice/Makefile | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/splice/Makefile b/tools/testing/selftests/splice/Makefile
>> index 559512c..3f967ba 100644
>> --- a/tools/testing/selftests/splice/Makefile
>> +++ b/tools/testing/selftests/splice/Makefile
>> @@ -4,5 +4,6 @@ all: $(TEST_PROGS) $(EXTRA)
>>
>> include ../lib.mk
>>
>> -clean:
>> +override define CLEAN
>> rm -fr $(EXTRA)
>> +endef
>
> Could just be:
>
> EXTRA_CLEAN := $(EXTRA)
>

Will send v2 with this change.

-- Shuah

2017-04-25 15:03:36

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 7/8] selftests: sync: override clean in lib.mk to fix warnings

On 04/21/2017 11:41 PM, Michael Ellerman wrote:
> Shuah Khan <[email protected]> writes:
>
>> Add override for lib.mk clean to fix the following warnings from clean
>> target run.
>>
>> Makefile:24: warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>> ---
>> tools/testing/selftests/sync/Makefile | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile
>> index 87ac400..f7d250d 100644
>> --- a/tools/testing/selftests/sync/Makefile
>> +++ b/tools/testing/selftests/sync/Makefile
>> @@ -20,5 +20,6 @@ TESTS += sync_stress_merge.o
>>
>> sync_test: $(OBJS) $(TESTS)
>>
>> -clean:
>> +override define CLEAN
>> $(RM) sync_test $(OBJS) $(TESTS)
>> +endef
>
> EXTRA_CLEAN := sync_test $(OBJS) $(TESTS)
>

Will send v2 with this change.

-- Shuah

2017-04-25 15:04:01

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 8/8] selftests: x86: override clean in lib.mk to fix warnings

On 04/21/2017 11:41 PM, Michael Ellerman wrote:
> Shuah Khan <[email protected]> writes:
>
>> Add override for lib.mk clean to fix the following warnings from clean
>> target run.
>>
>> Makefile:44: warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>> ---
>> tools/testing/selftests/x86/Makefile | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
>> index 38e0a9c..4d27550 100644
>> --- a/tools/testing/selftests/x86/Makefile
>> +++ b/tools/testing/selftests/x86/Makefile
>> @@ -40,8 +40,9 @@ all_32: $(BINARIES_32)
>>
>> all_64: $(BINARIES_64)
>>
>> -clean:
>> +override define CLEAN
>> $(RM) $(BINARIES_32) $(BINARIES_64)
>> +endef
>
> Simpler as:
>
> EXTRA_CLEAN := $(BINARIES_32) $(BINARIES_64)
>

Will send v2 with this change.

thanks,
-- Shuah

2017-04-26 10:55:28

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 2/8] selftests: lib.mk: define CLEAN macro to allow Makefiles to override clean

Shuah Khan <[email protected]> writes:
> On 04/21/2017 11:38 PM, Michael Ellerman wrote:
>> Shuah Khan <[email protected]> writes:

>> This patch is a good solution to fix the warnings.
>>
>> Acked-by: Michael Ellerman <[email protected]>
>
> Thanks. I plan to apply the patch with the amended changelog and your
> Ack. Please let me know if you want to see v2 with the change sent out.

I don't really mind if you send it or not.

cheers

2017-04-27 21:55:11

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 3/8] selftests: futex: override clean in lib.mk to fix warnings

On Fri, Apr 21, 2017 at 05:14:45PM -0600, Shuah Khan wrote:
> Add override for lib.mk clean to fix the following warnings from clean
> target run.
>
> Makefile:36: warning: overriding recipe for target 'clean'
> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>
> Signed-off-by: Shuah Khan <[email protected]>
> ---
> tools/testing/selftests/futex/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
> index c8095e6..e2fbb89 100644
> --- a/tools/testing/selftests/futex/Makefile
> +++ b/tools/testing/selftests/futex/Makefile
> @@ -32,9 +32,10 @@ override define EMIT_TESTS
> echo "./run.sh"
> endef
>
> -clean:
> +override define CLEAN
> for DIR in $(SUBDIRS); do \
> BUILD_TARGET=$(OUTPUT)/$$DIR; \
> mkdir $$BUILD_TARGET -p; \
> make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
> done
> +endef

Taking the move of clean into lib.mk as a given,

Acked-by: Darren Hart (VMware) <[email protected]>

--
Darren Hart
VMware Open Source Technology Center

2017-04-27 21:57:27

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 3/8] selftests: futex: override clean in lib.mk to fix warnings

On 04/27/2017 03:54 PM, Darren Hart wrote:
> On Fri, Apr 21, 2017 at 05:14:45PM -0600, Shuah Khan wrote:
>> Add override for lib.mk clean to fix the following warnings from clean
>> target run.
>>
>> Makefile:36: warning: overriding recipe for target 'clean'
>> ../lib.mk:55: warning: ignoring old recipe for target 'clean'
>>
>> Signed-off-by: Shuah Khan <[email protected]>
>> ---
>> tools/testing/selftests/futex/Makefile | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/futex/Makefile b/tools/testing/selftests/futex/Makefile
>> index c8095e6..e2fbb89 100644
>> --- a/tools/testing/selftests/futex/Makefile
>> +++ b/tools/testing/selftests/futex/Makefile
>> @@ -32,9 +32,10 @@ override define EMIT_TESTS
>> echo "./run.sh"
>> endef
>>
>> -clean:
>> +override define CLEAN
>> for DIR in $(SUBDIRS); do \
>> BUILD_TARGET=$(OUTPUT)/$$DIR; \
>> mkdir $$BUILD_TARGET -p; \
>> make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
>> done
>> +endef
>
> Taking the move of clean into lib.mk as a given,

Yeah I considered undoing that, and chose to fix the missed
issues instead.
>
> Acked-by: Darren Hart (VMware) <[email protected]>
>

thanks,
-- Shuah

2017-04-27 22:02:43

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 0/8] Fix clean target warnings

On 04/21/2017 05:14 PM, Shuah Khan wrote:
> This patch series consists of changes to lib.mk to allow overriding
> common clean target from Makefiles. This fixes warnings when clean
> overriding and ignoring warnings. Also fixes splice clean target
> removing a script that runs the test from its clean target.
>
> Shuah Khan (8):
> selftests: splice: fix clean target to not remove
> default_file_splice_read.sh
> selftests: lib.mk: define CLEAN macro to allow Makefiles to override
> clean

Applied with amended change log and Michael's ack to linux-kselftest next

> selftests: futex: override clean in lib.mk to fix warnings
> selftests: gpio: override clean in lib.mk to fix warnings
> selftests: powerpc: override clean in lib.mk to fix warnings

Applied all of the above to linux-kseltftest next

> selftests: splice: override clean in lib.mk to fix warnings
> selftests: sync: override clean in lib.mk to fix warnings
> selftests: x86: override clean in lib.mk to fix warnings

Applied v2s addressing Michael's comments to linux-kselftest next
x86 fix also addresses not being able to build ldt_gdt

make -C tools/testing/selftests/x86 ldt_gdt


thanks,
-- Shuah