selftests/powerpc: make sub-folders buildable on their own
authorMadhavan Srinivasan <maddy@linux.ibm.com>
Thu, 29 Feb 2024 09:37:11 +0000 (15:07 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 29 Apr 2024 13:54:42 +0000 (23:54 +1000)
Build breaks when executing make with run_tests for sub-folders
under powerpc. This is because, CFLAGS and GIT_VERSION macros are
defined in Makefile of toplevel powerpc folder.

  make: Entering directory '/home/maddy/linux/tools/testing/selftests/powerpc/mm'
  gcc     hugetlb_vs_thp_test.c ../harness.c ../utils.c  -o /home/maddy/selftest_output//hugetlb_vs_thp_test
  hugetlb_vs_thp_test.c:6:10: fatal error: utils.h: No such file or directory
      6 | #include "utils.h"
        |          ^~~~~~~~~
  compilation terminated.

Fix this by adding the flags.mk in each sub-folder Makefile. Also remove
the CFLAGS and GIT_VERSION macros from powerpc/ folder Makefile since
the same is definied in flags.mk

Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240229093711.581230-3-maddy@linux.ibm.com
24 files changed:
tools/testing/selftests/powerpc/Makefile
tools/testing/selftests/powerpc/alignment/Makefile
tools/testing/selftests/powerpc/benchmarks/Makefile
tools/testing/selftests/powerpc/cache_shape/Makefile
tools/testing/selftests/powerpc/copyloops/Makefile
tools/testing/selftests/powerpc/dexcr/Makefile
tools/testing/selftests/powerpc/dscr/Makefile
tools/testing/selftests/powerpc/eeh/Makefile
tools/testing/selftests/powerpc/math/Makefile
tools/testing/selftests/powerpc/mce/Makefile
tools/testing/selftests/powerpc/mm/Makefile
tools/testing/selftests/powerpc/nx-gzip/Makefile
tools/testing/selftests/powerpc/papr_attributes/Makefile
tools/testing/selftests/powerpc/papr_sysparm/Makefile
tools/testing/selftests/powerpc/papr_vpd/Makefile
tools/testing/selftests/powerpc/primitives/Makefile
tools/testing/selftests/powerpc/ptrace/Makefile
tools/testing/selftests/powerpc/security/Makefile
tools/testing/selftests/powerpc/signal/Makefile
tools/testing/selftests/powerpc/stringloops/Makefile
tools/testing/selftests/powerpc/switch_endian/Makefile
tools/testing/selftests/powerpc/syscalls/Makefile
tools/testing/selftests/powerpc/tm/Makefile
tools/testing/selftests/powerpc/vphn/Makefile

index c376151982c4df2d2d40c89c04b29be5d273da87..2f299fd04d2d96482ec7bc53d61e12cc77f4d22b 100644 (file)
@@ -7,12 +7,6 @@ ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
 
 ifeq ($(ARCH),powerpc)
 
-GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
-
-CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS)
-
-export CFLAGS
-
 SUB_DIRS = alignment           \
           benchmarks           \
           cache_shape          \
@@ -46,6 +40,7 @@ $(SUB_DIRS):
        BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
 
 include ../lib.mk
+include ./flags.mk
 
 override define RUN_TESTS
        +@for TARGET in $(SUB_DIRS); do \
index 93e9af37449d63c20feef3aa94a192e2c3259232..66d5d7aaeb20cc1befa282088f700a1f086b80ef 100644 (file)
@@ -3,5 +3,6 @@ TEST_GEN_PROGS := copy_first_unaligned alignment_handler
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
index 75f5232c3aeca561d895ef16fc1343712a8cf8fa..1321922038d0fe651681c1ca8b41aad92515b6dd 100644 (file)
@@ -6,6 +6,7 @@ TEST_FILES := settings
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS += -O2
 
index 689f6c8ebcd8d649055069a342e98728433fe2e7..3a3ca956ac66492adc76cba43e27f86c5b285ec4 100644 (file)
@@ -3,5 +3,6 @@ TEST_GEN_PROGS := cache_shape
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
index 72684ed589c0ac441e8ff4b25e8fa0f645f93c15..42940f92d832236152a07300f8903b559a059d43 100644 (file)
@@ -10,6 +10,7 @@ EXTRA_SOURCES := validate.c ../harness.c stubs.S
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 # The loops are all 64-bit code
 CFLAGS += -m64
index 76210f2bcec3c89e2e6a03c94c70ecfb257c6a2d..523947a38d1750bf930eb3273580518aec013741 100644 (file)
@@ -2,6 +2,7 @@ TEST_GEN_PROGS := hashchk_test
 TEST_GEN_FILES := lsdexcr
 
 include ../../lib.mk
+include ../flags.mk
 
 $(OUTPUT)/hashchk_test: CFLAGS += -fno-pie $(call cc-option,-mno-rop-protect)
 
index 9289d5febe1ed16173fecf2002636b191a988162..9fa9cb5bd989a88ed0ee6b9313b8f1fb84950282 100644 (file)
@@ -5,6 +5,7 @@ TEST_GEN_PROGS := dscr_default_test dscr_explicit_test dscr_user_test   \
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(OUTPUT)/dscr_default_test: LDLIBS += -lpthread
 $(OUTPUT)/dscr_explicit_test: LDLIBS += -lpthread
index ae963eb2dc5bf9ddc053a304f039c2ae284eb233..70797716f2b56bf22dc381de1cf420e8198f926b 100644 (file)
@@ -7,3 +7,4 @@ TEST_FILES := eeh-functions.sh settings
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
index 3948f7c510aa7470edcaceda13cc397f415f3310..b14fd2e0c6a8847f54efd532d15b4c307f1b01a7 100644 (file)
@@ -3,6 +3,7 @@ TEST_GEN_PROGS := fpu_syscall fpu_preempt fpu_signal fpu_denormal vmx_syscall vm
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c
 $(TEST_GEN_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
index 2424513982d9b58663b3615b5734cfcc9367f018..ce4ed679aaafbf6c37dfdb1722cc81b113906b18 100644 (file)
@@ -3,5 +3,6 @@
 TEST_GEN_PROGS := inject-ra-err
 
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c
index 4a6608beef0e970a2106bc122084011000c4ed56..aab058ecb3528ce383ec3d8f4b0577d87c0cc742 100644 (file)
@@ -13,6 +13,7 @@ TEST_GEN_FILES := tempfile
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
index b40991f902b2c5af9583a26606a07975e055b552..480d8ba94cf77a840e1603012cd23455cbe40a5f 100644 (file)
@@ -2,6 +2,7 @@ TEST_GEN_FILES := gzfht_test gunz_test
 TEST_PROGS := nx-gzip-test.sh
 
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS = -O3 -m64 -I./include -I../include
 
index e899712d49db1ab5b57c5f46708417fcc6123e49..406429499022495ec7aac38002b00c15e71c9fe1 100644 (file)
@@ -3,5 +3,6 @@ TEST_GEN_PROGS := attr_test
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
-$(TEST_GEN_PROGS): ../harness.c ../utils.c
\ No newline at end of file
+$(TEST_GEN_PROGS): ../harness.c ../utils.c
index 7f79e437634a285e88722af6407a0e8f0a8838ba..fed4f2414dbfb31044676d2bc60fdaf50eb019be 100644 (file)
@@ -6,6 +6,7 @@ TEST_GEN_PROGS := papr_sysparm
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
index 06b719703bfd7e8d73176b4ec24455c50b59be81..b09852e408822342d96074bee6f63b414e94ea15 100644 (file)
@@ -6,6 +6,7 @@ TEST_GEN_PROGS := papr_vpd
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
index 6dc5c5a42ca95ff2367a09a750a17cd34fc47ac9..23bd9a7590dde4e201fd8809b7f8af3eb50f74d7 100644 (file)
@@ -3,6 +3,7 @@ TEST_GEN_PROGS := load_unaligned_zeropad
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS += -I$(CURDIR)
 
index 1b39b86849da5e4b2d2d48f43fe664befc9175f6..59ca01d8567e233cd3c9a13698f0175fbda291b1 100644 (file)
@@ -26,6 +26,7 @@ LOCAL_HDRS += $(patsubst %,$(selfdir)/powerpc/ptrace/%,$(wildcard *.h))
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 TM_TESTS := $(patsubst %,$(OUTPUT)/%,$(TM_TESTS))
 TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(TESTS_64))
index 0a08386be9696b1cafe3b12baa74aa1a2c98211d..33286039724aa220423c09c4cffc2b48b47212a6 100644 (file)
@@ -6,6 +6,7 @@ TEST_PROGS := mitigation-patching.sh
 top_srcdir = ../../../../..
 
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS += $(KHDR_INCLUDES)
 
index b15d5dbccc24bc5ac9cdc774765b0cc2c4c01b0c..ece95bd52be98a3cf54aabbd5d1a4b305f0b8123 100644 (file)
@@ -10,6 +10,7 @@ TEST_FILES := settings
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS += -maltivec
 
index 87c8c8f238daa8055efd7004fd8945907141e64b..4c9d9a58c9d1592151a6276425e7aa5c51291f63 100644 (file)
@@ -26,6 +26,7 @@ endif
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 # The loops are all 64-bit code
 CFLAGS += -I$(CURDIR)
index 8f0c2a1d3333b757d7108b3f4ca63fe10eb84a8b..0da2e0a742648c62085759f8674a691ca2c11947 100644 (file)
@@ -5,6 +5,7 @@ EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 ASFLAGS += -O2 -Wall -g -nostdlib -m64
 
index 83dc33500773207acebd3442577875bf45301fee..3bc07af88f0e12db35c255e639b798bdf9b8904c 100644 (file)
@@ -3,6 +3,7 @@ TEST_GEN_PROGS := ipc_unmuxed rtas_filter
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS += $(KHDR_INCLUDES)
 
index 3876805c2f312170d2a1c4bc9c855d83064d8383..f13f0ab36007c31b51778821cbce9e34e24111ed 100644 (file)
@@ -11,6 +11,7 @@ TEST_FILES := settings
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 $(TEST_GEN_PROGS): ../harness.c ../utils.c
 
index ddc09a20b80fbab72f9b804c93afddd0c84b4eb1..61d519a076c6f58fff3fabea64dd875e8615aa29 100644 (file)
@@ -3,6 +3,7 @@ TEST_GEN_PROGS := test-vphn
 
 top_srcdir = ../../../../..
 include ../../lib.mk
+include ../flags.mk
 
 CFLAGS += -m64 -I$(CURDIR)