Skip to content

Commit 6faeeea

Browse files
mpeShuah Khan
authored andcommitted
selftests: Add install support for the powerpc tests
The bulk of the selftests are actually below the powerpc sub directory. This adds support for installing them, when on a powerpc machine, or if ARCH and CROSS_COMPILE are set appropriately. This is a little more complicated because of the sub directory structure under powerpc, but much of the common logic in lib.mk is still used. The net effect of the patch is still a reduction in code. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
1 parent 5744de5 commit 6faeeea

8 files changed

Lines changed: 73 additions & 82 deletions

File tree

‎tools/testing/selftests/powerpc/Makefile‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,25 @@ all: $(TARGETS)
2222
$(TARGETS):
2323
$(MAKE) -k -C $@ all
2424

25-
run_tests: all
25+
include ../lib.mk
26+
27+
override define RUN_TESTS
2628
@for TARGET in $(TARGETS); do \
2729
$(MAKE) -C $$TARGET run_tests; \
2830
done;
31+
endef
32+
33+
override define INSTALL_RULE
34+
@for TARGET in $(TARGETS); do \
35+
$(MAKE) -C $$TARGET install; \
36+
done;
37+
endef
38+
39+
override define EMIT_TESTS
40+
@for TARGET in $(TARGETS); do \
41+
$(MAKE) -s -C $$TARGET emit_tests; \
42+
done;
43+
endef
2944

3045
clean:
3146
@for TARGET in $(TARGETS); do \
@@ -36,4 +51,4 @@ clean:
3651
tags:
3752
find . -name '*.c' -o -name '*.h' | xargs ctags
3853

39-
.PHONY: all run_tests clean tags $(TARGETS)
54+
.PHONY: tags $(TARGETS)

‎tools/testing/selftests/powerpc/copyloops/Makefile‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,19 @@ CFLAGS += -D SELFTEST
66
# Use our CFLAGS for the implicit .S rule
77
ASFLAGS = $(CFLAGS)
88

9-
PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
9+
TEST_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
1010
EXTRA_SOURCES := validate.c ../harness.c
1111

12-
all: $(PROGS)
12+
all: $(TEST_PROGS)
1313

1414
copyuser_64: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
1515
copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
1616
memcpy_64: CPPFLAGS += -D COPY_LOOP=test_memcpy
1717
memcpy_power7: CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
1818

19-
$(PROGS): $(EXTRA_SOURCES)
19+
$(TEST_PROGS): $(EXTRA_SOURCES)
2020

21-
run_tests: all
22-
@-for PROG in $(PROGS); do \
23-
./$$PROG; \
24-
done;
21+
include ../../lib.mk
2522

2623
clean:
27-
rm -f $(PROGS) *.o
28-
29-
.PHONY: all run_tests clean
24+
rm -f $(TEST_PROGS) *.o
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
noarg:
22
$(MAKE) -C ../
33

4-
PROGS := hugetlb_vs_thp_test subpage_prot
4+
TEST_PROGS := hugetlb_vs_thp_test subpage_prot
55

6-
all: $(PROGS) tempfile
6+
all: $(TEST_PROGS) tempfile
77

8-
$(PROGS): ../harness.c
8+
$(TEST_PROGS): ../harness.c
99

10-
run_tests: all
11-
@-for PROG in $(PROGS); do \
12-
./$$PROG; \
13-
done;
10+
include ../../lib.mk
1411

1512
tempfile:
1613
dd if=/dev/zero of=tempfile bs=64k count=1
1714

1815
clean:
19-
rm -f $(PROGS) tempfile
20-
21-
.PHONY: all run_tests clean
16+
rm -f $(TEST_PROGS) tempfile
Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
11
noarg:
22
$(MAKE) -C ../
33

4-
PROGS := count_instructions l3_bank_test per_event_excludes
4+
TEST_PROGS := count_instructions l3_bank_test per_event_excludes
55
EXTRA_SOURCES := ../harness.c event.c lib.c
66

7-
SUB_TARGETS = ebb
7+
all: $(TEST_PROGS) ebb
88

9-
all: $(PROGS) $(SUB_TARGETS)
10-
11-
$(PROGS): $(EXTRA_SOURCES)
9+
$(TEST_PROGS): $(EXTRA_SOURCES)
1210

1311
# loop.S can only be built 64-bit
1412
count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
1513
$(CC) $(CFLAGS) -m64 -o $@ $^
1614

17-
run_tests: all sub_run_tests
18-
@-for PROG in $(PROGS); do \
19-
./$$PROG; \
20-
done;
15+
include ../../lib.mk
2116

22-
clean: sub_clean
23-
rm -f $(PROGS) loop.o
17+
DEFAULT_RUN_TESTS := $(RUN_TESTS)
18+
override define RUN_TESTS
19+
$(DEFAULT_RUN_TESTS)
20+
$(MAKE) -C ebb run_tests
21+
endef
2422

25-
$(SUB_TARGETS):
26-
$(MAKE) -k -C $@ all
23+
DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
24+
override define EMIT_TESTS
25+
$(DEFAULT_EMIT_TESTS)
26+
$(MAKE) -s -C ebb emit_tests
27+
endef
2728

28-
sub_run_tests: all
29-
@for TARGET in $(SUB_TARGETS); do \
30-
$(MAKE) -C $$TARGET run_tests; \
31-
done;
29+
DEFAULT_INSTALL := $(INSTALL_RULE)
30+
override define INSTALL_RULE
31+
$(DEFAULT_INSTALL_RULE)
32+
$(MAKE) -C ebb install
33+
endef
3234

33-
sub_clean:
34-
@for TARGET in $(SUB_TARGETS); do \
35-
$(MAKE) -C $$TARGET clean; \
36-
done;
35+
clean:
36+
rm -f $(TEST_PROGS) loop.o
37+
$(MAKE) -C ebb clean
38+
39+
ebb:
40+
$(MAKE) -k -C $@ all
3741

38-
.PHONY: all run_tests clean sub_run_tests sub_clean $(SUB_TARGETS)
42+
.PHONY: all run_tests clean ebb

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ noarg:
44
# The EBB handler is 64-bit code and everything links against it
55
CFLAGS += -m64
66

7-
PROGS := reg_access_test event_attributes_test cycles_test \
7+
TEST_PROGS := reg_access_test event_attributes_test cycles_test \
88
cycles_with_freeze_test pmc56_overflow_test \
99
ebb_vs_cpu_event_test cpu_event_vs_ebb_test \
1010
cpu_event_pinned_vs_ebb_test task_event_vs_ebb_test \
@@ -16,18 +16,15 @@ PROGS := reg_access_test event_attributes_test cycles_test \
1616
lost_exception_test no_handler_test \
1717
cycles_with_mmcr2_test
1818

19-
all: $(PROGS)
19+
all: $(TEST_PROGS)
2020

21-
$(PROGS): ../../harness.c ../event.c ../lib.c ebb.c ebb_handler.S trace.c busy_loop.S
21+
$(TEST_PROGS): ../../harness.c ../event.c ../lib.c ebb.c ebb_handler.S trace.c busy_loop.S
2222

2323
instruction_count_test: ../loop.S
2424

2525
lost_exception_test: ../lib.c
2626

27-
run_tests: all
28-
@-for PROG in $(PROGS); do \
29-
./$$PROG; \
30-
done;
27+
include ../../../lib.mk
3128

3229
clean:
33-
rm -f $(PROGS)
30+
rm -f $(TEST_PROGS)
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
CFLAGS += -I$(CURDIR)
22

3-
PROGS := load_unaligned_zeropad
3+
TEST_PROGS := load_unaligned_zeropad
44

5-
all: $(PROGS)
5+
all: $(TEST_PROGS)
66

7-
$(PROGS): ../harness.c
7+
$(TEST_PROGS): ../harness.c
88

9-
run_tests: all
10-
@-for PROG in $(PROGS); do \
11-
./$$PROG; \
12-
done;
9+
include ../../lib.mk
1310

1411
clean:
15-
rm -f $(PROGS) *.o
16-
17-
.PHONY: all run_tests clean
12+
rm -f $(TEST_PROGS) *.o

‎tools/testing/selftests/powerpc/stringloops/Makefile‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22
CFLAGS += -m64
33
CFLAGS += -I$(CURDIR)
44

5-
PROGS := memcmp
5+
TEST_PROGS := memcmp
66
EXTRA_SOURCES := memcmp_64.S ../harness.c
77

8-
all: $(PROGS)
8+
all: $(TEST_PROGS)
99

10-
$(PROGS): $(EXTRA_SOURCES)
10+
$(TEST_PROGS): $(EXTRA_SOURCES)
1111

12-
run_tests: all
13-
@-for PROG in $(PROGS); do \
14-
./$$PROG; \
15-
done;
12+
include ../../lib.mk
1613

1714
clean:
18-
rm -f $(PROGS) *.o
19-
20-
.PHONY: all run_tests clean
15+
rm -f $(TEST_PROGS) *.o
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
PROGS := tm-resched-dscr
1+
TEST_PROGS := tm-resched-dscr
22

3-
all: $(PROGS)
3+
all: $(TEST_PROGS)
44

5-
$(PROGS): ../harness.c
5+
$(TEST_PROGS): ../harness.c
66

7-
run_tests: all
8-
@-for PROG in $(PROGS); do \
9-
./$$PROG; \
10-
done;
7+
include ../../lib.mk
118

129
clean:
13-
rm -f $(PROGS) *.o
14-
15-
.PHONY: all run_tests clean
10+
rm -f $(TEST_PROGS) *.o

0 commit comments

Comments
 (0)