linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] selftests/vm: fix some minor aggravating factors in the Makefile
@ 2020-09-15  1:28 John Hubbard
  2020-09-15  1:29 ` [PATCH 1/2] selftests/vm: fix false build success on the second and later attempts John Hubbard
  2020-09-15  1:29 ` [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases John Hubbard
  0 siblings, 2 replies; 4+ messages in thread
From: John Hubbard @ 2020-09-15  1:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Shuah Khan, LKML, linux-mm, linux-kselftest, John Hubbard

Hi,

This fixes a couple of minor aggravating factors that I ran across while
trying to do some changes in selftests/vm. These are simple things, but
like most things with GNU Make, it's rarely obvious what's wrong until
you understand *the entire Makefile and all of its includes*.

So while there is, of course, joy in learning those details, I thought I'd
fix these little things, so as to allow others to skip out on the Joy if
they so choose. :)

First of all, if you have an item (let's choose userfaultfd for an
example) that fails to build, you might do this:

$ make -j32

    # ...you observe a failed item in the threaded output

# OK, let's get a closer look

$ make
    # ...but now the build quietly "succeeds".

That's what Patch 0001 fixes.

Second, if you instead attempt this approach for your closer look (a casual
mistake, as it's not supported):

$ make userfaultfd

    # ...userfaultfd fails to link, due to incomplete LDLIBS

That's what Patch 0002 fixes.

John Hubbard (2):
  selftests/vm: fix false build success on the second and later attempts
  selftests/vm: fix incorrect gcc invocation in some cases

 tools/testing/selftests/vm/Makefile | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
2.28.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] selftests/vm: fix false build success on the second and later attempts
  2020-09-15  1:28 [PATCH 0/2] selftests/vm: fix some minor aggravating factors in the Makefile John Hubbard
@ 2020-09-15  1:29 ` John Hubbard
  2020-09-15  1:29 ` [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases John Hubbard
  1 sibling, 0 replies; 4+ messages in thread
From: John Hubbard @ 2020-09-15  1:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Shuah Khan, LKML, linux-mm, linux-kselftest, John Hubbard

If one or more of these selftest fail to build, then after the first
failure, subsequent invocations of "make" will make it appear that there
are no build failures, after all.

That's because the failed build products remain, with up-to-date
timestamps, thus tricking Make (and you!) into believing that there's
nothing else to build.

Fix this by telling Make to delete targets that didn't completely
succeed.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 tools/testing/selftests/vm/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index a9026706d597..9f2625bebf07 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -3,6 +3,11 @@
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 MACHINE ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/')
 
+# Without this, failed build products remain, with up-to-date timestamps,
+# thus tricking Make (and you!) into believing that All Is Well, in subsequent
+# make invocations:
+.DELETE_ON_ERROR:
+
 CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
 LDLIBS = -lrt
 TEST_GEN_FILES = compaction_test
-- 
2.28.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases
  2020-09-15  1:28 [PATCH 0/2] selftests/vm: fix some minor aggravating factors in the Makefile John Hubbard
  2020-09-15  1:29 ` [PATCH 1/2] selftests/vm: fix false build success on the second and later attempts John Hubbard
@ 2020-09-15  1:29 ` John Hubbard
  2020-09-15 17:25   ` Jason Gunthorpe
  1 sibling, 1 reply; 4+ messages in thread
From: John Hubbard @ 2020-09-15  1:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Shuah Khan, LKML, linux-mm, linux-kselftest, John Hubbard

Avoid accidental wrong builds, due to built-in rules working just a
little bit too well--but not quite as well as required for our situation
here.

In other words, "make userfaultfd" (for example) is supposed to fail to
build at all, because this Makefile only supports either "make" (all),
or "make /full/path". However,  the built-in rules, if not suppressed,
will pick up CFLAGS and the initial LDLIBS (but not the target-specific
LDLIBS, because those are only set for the full path target!). This
causes it to get pretty far into building things despite using incorrect
values such as an *occasionally* incomplete LDLIBS value.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 tools/testing/selftests/vm/Makefile | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 9f2625bebf07..30873b19d04b 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -8,6 +8,18 @@ MACHINE ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/')
 # make invocations:
 .DELETE_ON_ERROR:
 
+# Avoid accidental wrong builds, due to built-in rules working just a little
+# bit too well--but not quite as well as required for our situation here.
+#
+# In other words, "make userfaultfd" is supposed to fail to build at all,
+# because this Makefile only supports either "make" (all), or "make /full/path".
+# However,  the built-in rules, if not suppressed, will pick up CFLAGS and the
+# initial LDLIBS (but not the target-specific LDLIBS, because those are only
+# set for the full path target!). This causes it to get pretty far into building
+# things despite using incorrect values such as an *occasionally* incomplete
+# LDLIBS.
+MAKEFLAGS += --no-builtin-rules
+
 CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
 LDLIBS = -lrt
 TEST_GEN_FILES = compaction_test
-- 
2.28.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases
  2020-09-15  1:29 ` [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases John Hubbard
@ 2020-09-15 17:25   ` Jason Gunthorpe
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2020-09-15 17:25 UTC (permalink / raw)
  To: John Hubbard; +Cc: Andrew Morton, Shuah Khan, LKML, linux-mm, linux-kselftest

On Mon, Sep 14, 2020 at 06:29:01PM -0700, John Hubbard wrote:
> Avoid accidental wrong builds, due to built-in rules working just a
> little bit too well--but not quite as well as required for our situation
> here.
> 
> In other words, "make userfaultfd" (for example) is supposed to fail to
> build at all, because this Makefile only supports either "make" (all),
> or "make /full/path". However,  the built-in rules, if not suppressed,
> will pick up CFLAGS and the initial LDLIBS (but not the target-specific
> LDLIBS, because those are only set for the full path target!). This
> causes it to get pretty far into building things despite using incorrect
> values such as an *occasionally* incomplete LDLIBS value.
> 
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
>  tools/testing/selftests/vm/Makefile | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

I hit this too when fiddling with the hmm tests! Would be happy to see
better errors

Jason


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-15 17:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15  1:28 [PATCH 0/2] selftests/vm: fix some minor aggravating factors in the Makefile John Hubbard
2020-09-15  1:29 ` [PATCH 1/2] selftests/vm: fix false build success on the second and later attempts John Hubbard
2020-09-15  1:29 ` [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases John Hubbard
2020-09-15 17:25   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).