Skip to contentSkip to conversation

selftests: ptrace, kcmp, efivars build failure fixes

PATCH Superseded Shuah Khan 3 participants 10 messages Mar 10, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

cover selftests: ptrace, kcmp, efivars build failure fixes

ptrace, efivars, and kcmp Makefiles don't have explicit build rule. As a result, build fails when make is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Fxing the problems by adding an explicit build rule to fix the problem.

Shuah Khan (3):
selftests: ptrace build fails when invoked from kselftest target
selftests: efivars build fails when invoked from kselftest target
selftests: kcmp build fails when invoked from kselftest target

 tools/testing/selftests/efivarfs/Makefile | 2 ++
 tools/testing/selftests/kcmp/Makefile     | 5 +++--
 tools/testing/selftests/ptrace/Makefile   | 5 +++--
 3 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.1.0
author
#1 lore raw

PATCH 1/3 selftests: ptrace build fails when invoked from kselftest target

ptrace Makefile doesn't have an explicit build rule. As a result, ptrace build fails, when it is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Add an explicit build rule to fix the problem.

---
 tools/testing/selftests/ptrace/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/ptrace/Makefile +3 -2
index 47ae2d3..9067567 100644
@@ -1,7 +1,8 @@
+CC := $(CROSS_COMPILE)$(CC)
 CFLAGS += -iquote../../../../include/uapi -Wall
-peeksiginfo: peeksiginfo.c
 
-all: peeksiginfo
+all:
+	$(CC) $(CFLAGS) peeksiginfo.c -o peeksiginfo
 
 clean:
 	rm -f peeksiginfo
Signature · 1 line
2.1.0
author
#2 lore raw

PATCH 2/3 selftests: efivars build fails when invoked from kselftest target

In reply to Shuah Khan

efivars Makefile doesn't have an explicit build rule. As a result, efivars build fails, when it is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Add an explicit build rule to fix the problem.

---
 tools/testing/selftests/efivarfs/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/efivarfs/Makefile +2 -0
index 29e8c6b..bb48d73 100644
@@ -4,6 +4,8 @@ CFLAGS = -Wall
 test_objs = open-unlink create-read
 
 all: $(test_objs)
+%: %.c
+	$(CC) $(CFLAGS) -o $@ $^
 
 run_tests: all
 	@/bin/bash ./efivarfs.sh || echo "efivarfs selftests: [FAIL]"
Signature · 1 line
2.1.0
author
#3 lore raw

PATCH 3/3 selftests: kcmp build fails when invoked from kselftest target

In reply to Shuah Khan

kcmp Makefile doesn't have an explicit build rule. As a result, kcmp build fails, when it is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Add an explicit build rule to fix the problem. In addition, build fails as it can't find kcmp.h. Fix it by passing CFLAGS.

---
 tools/testing/selftests/kcmp/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/kcmp/Makefile +3 -2
index ff0eefd..83383eb 100644
@@ -1,7 +1,8 @@
 CC := $(CROSS_COMPILE)$(CC)
-CFLAGS += -I../../../../usr/include/
+CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
 
-all: kcmp_test
+all:
+	$(CC) $(CFLAGS) kcmp_test.c -o kcmp_test
 
 run_tests: all
 	@./kcmp_test || echo "kcmp_test: [FAIL]"
Signature · 1 line
2.1.0
#4 lore raw

Re: [PATCH 3/3] selftests: kcmp build fails when invoked from kselftest target

Quoted 17 lines · Shuah Khan

kcmp Makefile doesn't have an explicit build rule. As a result, kcmp build fails, when it is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Add an explicit build rule to fix the problem. In addition, build fails as it can't find kcmp.h. Fix it by passing CFLAGS.

---
 tools/testing/selftests/kcmp/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/kcmp/Makefile +0 -0
index ff0eefd..83383eb 100644

tools/testing/selftests/kcmp/Makefile line 8

Quoted 10 lines
tools/testing/selftests/kcmp/Makefile +3 -2
@@ -1,7 +1,8 @@
 CC := $(CROSS_COMPILE)$(CC)
-CFLAGS += -I../../../../usr/include/
+CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
 
-all: kcmp_test
+all:
+	$(CC) $(CFLAGS) kcmp_test.c -o kcmp_test
 
 run_tests: all
 	@./kcmp_test || echo "kcmp_test: [FAIL]"

Ho Shuah! Thanks for looking into it. I've a small question -- why kcmp_test prerequsite is dropped? As to me it should remain here, except explicit build rule added.

author
#5 lore raw

Re: [PATCH 3/3] selftests: kcmp build fails when invoked from kselftest target

Quoted 26 lines · Cyrill Gorcunov
Quoted 25 lines · Shuah Khan

kcmp Makefile doesn't have an explicit build rule. As a result, kcmp build fails, when it is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Add an explicit build rule to fix the problem. In addition, build fails as it can't find kcmp.h. Fix it by passing CFLAGS.

---
 tools/testing/selftests/kcmp/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/kcmp/Makefile +3 -2
index ff0eefd..83383eb 100644
@@ -1,7 +1,8 @@
 CC := $(CROSS_COMPILE)$(CC)
-CFLAGS += -I../../../../usr/include/
+CFLAGS += -I../../../../include/uapi -I../../../../usr/include/
 
-all: kcmp_test
+all:
+	$(CC) $(CFLAGS) kcmp_test.c -o kcmp_test
 
Quoted 7 lines

tools/testing/selftests/kcmp/Makefile line 8

Quoted 2 lines
tools/testing/selftests/kcmp/Makefile +0 -0
 run_tests: all
 	@./kcmp_test || echo "kcmp_test: [FAIL]"

Ho Shuah! Thanks for looking into it. I've a small question -- why kcmp_test prerequsite is dropped? As to me it should remain here, except explicit build rule added.

Are you looking for something like this:

all: kcmp_test

kcmp_test:

	$(CC) $(CFLAGS) kcmp_test.c -o kcmp_test

I just simplified it and removed the prerequsite.
If you prefer, I can make the change to keep the
prereq.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
#6 lore raw

Re: [PATCH 3/3] selftests: kcmp build fails when invoked from kselftest target

Quoted 11 lines · Shuah Khan

Are you looking for something like this:

all: kcmp_test

kcmp_test:

	$(CC) $(CFLAGS) kcmp_test.c -o kcmp_test

I just simplified it and removed the prerequsite.
If you prefer, I can make the change to keep the
prereq.

Yes please, and you may use internal make var $@ as well

kcmp_test:

	$(CC) $(CFLAGS) kcmp_test.c -o $@
#7 lore raw
In reply to Shuah Khan
Quoted 12 lines · Shuah Khan

ptrace, efivars, and kcmp Makefiles don't have explicit build rule. As a result, build fails when make is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Fxing the problems by adding an explicit build rule to fix the problem.

Shuah Khan (3):
selftests: ptrace build fails when invoked from kselftest target
selftests: efivars build fails when invoked from kselftest target
selftests: kcmp build fails when invoked from kselftest target

Quoted 4 lines
 tools/testing/selftests/efivarfs/Makefile | 2 ++
 tools/testing/selftests/kcmp/Makefile     | 5 +++--
 tools/testing/selftests/ptrace/Makefile   | 5 +++--
 3 files changed, 8 insertions(+), 4 deletions(-)

What? No. This is the bug my patch to filter the make flags fixes.

cheers

author
#8 lore raw
Quoted 13 lines · Michael Ellerman
Quoted 12 lines · Shuah Khan

ptrace, efivars, and kcmp Makefiles don't have explicit build rule. As a result, build fails when make is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Fxing the problems by adding an explicit build rule to fix the problem.

Shuah Khan (3):
selftests: ptrace build fails when invoked from kselftest target
selftests: efivars build fails when invoked from kselftest target
selftests: kcmp build fails when invoked from kselftest target

Quoted 10 lines
Quoted 4 lines
 tools/testing/selftests/efivarfs/Makefile | 2 ++
 tools/testing/selftests/kcmp/Makefile     | 5 +++--
 tools/testing/selftests/ptrace/Makefile   | 5 +++--
 3 files changed, 8 insertions(+), 4 deletions(-)

What? No. This is the bug my patch to filter the make flags fixes.

cheers

Michael,

Did you see my email from yesterday on how your patch introduced more problems. Can you please make sure the patches you send work and don't introduce problems. I am having this issue with a lot of your patches.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978
author
#9 lore raw
Quoted 25 lines · Shuah Khan
Quoted 13 lines · Michael Ellerman
Quoted 12 lines · Shuah Khan

ptrace, efivars, and kcmp Makefiles don't have explicit build rule. As a result, build fails when make is run from top level Makefile target kselftest. Without the explicit rule, make works only when it is run in the current directory or from selftests directory. Fxing the problems by adding an explicit build rule to fix the problem.

Shuah Khan (3):
selftests: ptrace build fails when invoked from kselftest target
selftests: efivars build fails when invoked from kselftest target
selftests: kcmp build fails when invoked from kselftest target

Quoted 10 lines
Quoted 4 lines
 tools/testing/selftests/efivarfs/Makefile | 2 ++
 tools/testing/selftests/kcmp/Makefile     | 5 +++--
 tools/testing/selftests/ptrace/Makefile   | 5 +++--
 3 files changed, 8 insertions(+), 4 deletions(-)

What? No. This is the bug my patch to filter the make flags fixes.

cheers

Quoted 7 lines

Michael,

Did you see my email from yesterday on how your patch introduced more problems. Can you please make sure the patches you send work and don't introduce problems. I am having this issue with a lot of your patches.

btw your patch doesn't fix the header file include problem. I don't see any reason why individual Makefile shouldn't address this problem.

thanks,
-- Shuah

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