diff options
Diffstat (limited to 'tools/testing')
41 files changed, 4083 insertions, 46 deletions
diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile index b3dbe9ef1a40..54833a791a44 100644 --- a/tools/testing/selftests/powerpc/Makefile +++ b/tools/testing/selftests/powerpc/Makefile | |||
| @@ -13,7 +13,7 @@ CFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CUR | |||
| 13 | 13 | ||
| 14 | export CC CFLAGS | 14 | export CC CFLAGS |
| 15 | 15 | ||
| 16 | TARGETS = pmu copyloops mm | 16 | TARGETS = pmu copyloops mm tm |
| 17 | 17 | ||
| 18 | endif | 18 | endif |
| 19 | 19 | ||
diff --git a/tools/testing/selftests/powerpc/harness.c b/tools/testing/selftests/powerpc/harness.c index e80c42a584fe..8ebc58a09311 100644 --- a/tools/testing/selftests/powerpc/harness.c +++ b/tools/testing/selftests/powerpc/harness.c | |||
| @@ -30,12 +30,15 @@ int run_test(int (test_function)(void), char *name) | |||
| 30 | 30 | ||
| 31 | pid = fork(); | 31 | pid = fork(); |
| 32 | if (pid == 0) { | 32 | if (pid == 0) { |
| 33 | setpgid(0, 0); | ||
| 33 | exit(test_function()); | 34 | exit(test_function()); |
| 34 | } else if (pid == -1) { | 35 | } else if (pid == -1) { |
| 35 | perror("fork"); | 36 | perror("fork"); |
| 36 | return 1; | 37 | return 1; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | setpgid(pid, pid); | ||
| 41 | |||
| 39 | /* Wake us up in timeout seconds */ | 42 | /* Wake us up in timeout seconds */ |
| 40 | alarm(TIMEOUT); | 43 | alarm(TIMEOUT); |
| 41 | terminated = false; | 44 | terminated = false; |
| @@ -50,17 +53,20 @@ wait: | |||
| 50 | 53 | ||
| 51 | if (terminated) { | 54 | if (terminated) { |
| 52 | printf("!! force killing %s\n", name); | 55 | printf("!! force killing %s\n", name); |
| 53 | kill(pid, SIGKILL); | 56 | kill(-pid, SIGKILL); |
| 54 | return 1; | 57 | return 1; |
| 55 | } else { | 58 | } else { |
| 56 | printf("!! killing %s\n", name); | 59 | printf("!! killing %s\n", name); |
| 57 | kill(pid, SIGTERM); | 60 | kill(-pid, SIGTERM); |
| 58 | terminated = true; | 61 | terminated = true; |
| 59 | alarm(KILL_TIMEOUT); | 62 | alarm(KILL_TIMEOUT); |
| 60 | goto wait; | 63 | goto wait; |
| 61 | } | 64 | } |
| 62 | } | 65 | } |
| 63 | 66 | ||
| 67 | /* Kill anything else in the process group that is still running */ | ||
| 68 | kill(-pid, SIGTERM); | ||
| 69 | |||
| 64 | if (WIFEXITED(status)) | 70 | if (WIFEXITED(status)) |
| 65 | status = WEXITSTATUS(status); | 71 | status = WEXITSTATUS(status); |
| 66 | else { | 72 | else { |
| @@ -99,7 +105,10 @@ int test_harness(int (test_function)(void), char *name) | |||
| 99 | 105 | ||
| 100 | rc = run_test(test_function, name); | 106 | rc = run_test(test_function, name); |
| 101 | 107 | ||
| 102 | test_finish(name, rc); | 108 | if (rc == MAGIC_SKIP_RETURN_VALUE) |
| 109 | test_skip(name); | ||
| 110 | else | ||
| 111 | test_finish(name, rc); | ||
| 103 | 112 | ||
| 104 | return rc; | 113 | return rc; |
| 105 | } | 114 | } |
diff --git a/tools/testing/selftests/powerpc/pmu/Makefile b/tools/testing/selftests/powerpc/pmu/Makefile index 7216f0091655..b9ff0db42c79 100644 --- a/tools/testing/selftests/powerpc/pmu/Makefile +++ b/tools/testing/selftests/powerpc/pmu/Makefile | |||
| @@ -4,7 +4,7 @@ noarg: | |||
| 4 | PROGS := count_instructions | 4 | PROGS := count_instructions |
| 5 | EXTRA_SOURCES := ../harness.c event.c | 5 | EXTRA_SOURCES := ../harness.c event.c |
| 6 | 6 | ||
| 7 | all: $(PROGS) | 7 | all: $(PROGS) sub_all |
| 8 | 8 | ||
| 9 | $(PROGS): $(EXTRA_SOURCES) | 9 | $(PROGS): $(EXTRA_SOURCES) |
| 10 | 10 | ||
| @@ -12,12 +12,30 @@ $(PROGS): $(EXTRA_SOURCES) | |||
| 12 | count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES) | 12 | count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES) |
| 13 | $(CC) $(CFLAGS) -m64 -o $@ $^ | 13 | $(CC) $(CFLAGS) -m64 -o $@ $^ |
| 14 | 14 | ||
| 15 | run_tests: all | 15 | run_tests: all sub_run_tests |
| 16 | @-for PROG in $(PROGS); do \ | 16 | @-for PROG in $(PROGS); do \ |
| 17 | ./$$PROG; \ | 17 | ./$$PROG; \ |
| 18 | done; | 18 | done; |
| 19 | 19 | ||
| 20 | clean: | 20 | clean: sub_clean |
| 21 | rm -f $(PROGS) loop.o | 21 | rm -f $(PROGS) loop.o |
| 22 | 22 | ||
| 23 | .PHONY: all run_tests clean | 23 | |
| 24 | SUB_TARGETS = ebb | ||
| 25 | |||
| 26 | sub_all: | ||
| 27 | @for TARGET in $(SUB_TARGETS); do \ | ||
| 28 | $(MAKE) -C $$TARGET all; \ | ||
| 29 | done; | ||
| 30 | |||
| 31 | sub_run_tests: all | ||
| 32 | @for TARGET in $(SUB_TARGETS); do \ | ||
| 33 | $(MAKE) -C $$TARGET run_tests; \ | ||
| < | |||
