Skip to content

Commit 5553a79

Browse files
maddy-kerneldevmpe
authored andcommitted
selftests/powerpc: Add flags.mk to support pmu buildable
When running `make -C powerpc/pmu run_tests` from top level selftests directory, currently this error is being reported: make: Entering directory '/home/maddy/linux/tools/testing/selftests/powerpc/pmu' Makefile:40: warning: overriding recipe for target 'emit_tests' ../../lib.mk:111: warning: ignoring old recipe for target 'emit_tests' gcc -m64 count_instructions.c ../harness.c event.c lib.c ../utils.c loop.S -o /home/maddy/selftest_output//count_instructions In file included from count_instructions.c:13: event.h:12:10: fatal error: utils.h: No such file or directory 12 | #include "utils.h" | ^~~~~~~~~ compilation terminated. This is due to missing of include path in CFLAGS. That is, CFLAGS and GIT_VERSION macros are defined in the powerpc/ folder Makefile which in this case is not involved. To address the failure in case of executing specific sub-folder test directly, a new rule file has been addded by the patch called "flags.mk" under selftest/powerpc/ folder and is linked to all the Makefile of powerpc/pmu sub-folders. Reported-by: Sachin Sant <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Tested-by: Sachin Sant <[email protected]> [mpe: Fixup ifeq, make GIT_VERSION simply expanded to avoid re-executing git describe] Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 3749684 commit 5553a79

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#This checks for any ENV variables and add those.
2+
3+
ifeq ($(GIT_VERSION),)
4+
GIT_VERSION := $(shell git describe --always --long --dirty || echo "unknown")
5+
export GIT_VERSION
6+
endif
7+
8+
ifeq ($(CFLAGS),)
9+
CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(selfdir)/powerpc/include $(CFLAGS)
10+
export CFLAGS
11+
endif
12+

tools/testing/selftests/powerpc/pmu/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
77

88
top_srcdir = ../../../../..
99
include ../../lib.mk
10+
include ../flags.mk
1011

1112
all: $(TEST_GEN_PROGS) ebb sampling_tests event_code_tests
1213

tools/testing/selftests/powerpc/pmu/ebb/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ TEST_GEN_PROGS := reg_access_test event_attributes_test cycles_test \
1818

1919
top_srcdir = ../../../../../..
2020
include ../../../lib.mk
21+
include ../../flags.mk
2122

2223
# The EBB handler is 64-bit code and everything links against it
2324
CFLAGS += -m64

tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TEST_GEN_PROGS := group_constraint_pmc56_test group_pmc56_exclude_constraints_te
99

1010
top_srcdir = ../../../../../..
1111
include ../../../lib.mk
12+
include ../../flags.mk
1213

1314
CFLAGS += -m64
1415

tools/testing/selftests/powerpc/pmu/sampling_tests/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TEST_GEN_PROGS := mmcr0_exceptionbits_test mmcr0_cc56run_test mmcr0_pmccext_test
99

1010
top_srcdir = ../../../../../..
1111
include ../../../lib.mk
12+
include ../../flags.mk
1213

1314
CFLAGS += -m64
1415

0 commit comments

Comments
 (0)