Skip to content

Commit 80d443e

Browse files
bamvor.zhangjian@huawei.comShuah Khan
authored andcommitted
selftests: add EXTRA_CLEAN for clean target
Some testcases need the clean extra data after running. This patch introduce the "EXTRA_CLEAN" variable to address this requirement. After KBUILD_OUTPUT is enabled in later patch, it will be easy to decide to if we need do the cleanup in the KBUILD_OUTPUT path(if the testcase ran immediately after compiled). Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
1 parent 5a2d4a5 commit 80d443e

7 files changed

Lines changed: 17 additions & 24 deletions

File tree

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
CFLAGS = -Wall
22

3+
TEST_GEN_PROGS := execveat
4+
TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
5+
# Makefile is a run-time dependency, since it's accessed by the execveat test
6+
TEST_FILES := Makefile
7+
8+
EXTRA_CLEAN := subdir.moved execveat.moved xxxxx*
9+
10+
include ../lib.mk
11+
312
subdir:
413
mkdir -p $@
514
script:
@@ -11,13 +20,3 @@ execveat.symlink: execveat
1120
execveat.denatured: execveat
1221
cp $< $@
1322
chmod -x $@
14-
15-
TEST_GEN_PROGS := execveat
16-
TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
17-
# Makefile is a run-time dependency, since it's accessed by the execveat test
18-
TEST_FILES := Makefile
19-
20-
include ../lib.mk
21-
22-
clean:
23-
rm -rf $(TEST_GEN_PROGS) $(TEST_GEN_FILES) subdir.moved execveat.moved xxxxx*

‎tools/testing/selftests/ftrace/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ all:
22

33
TEST_PROGS := ftracetest
44
TEST_FILES := test.d
5+
EXTRA_CLEAN := logs/*
56

67
include ../lib.mk
7-
8-
clean:
9-
rm -rf logs/*

‎tools/testing/selftests/kcmp/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CFLAGS += -I../../../../usr/include/
22

33
TEST_GEN_PROGS := kcmp_test
44

5+
EXTRA_CLEAN := kcmp-test-file
6+
57
include ../lib.mk
68

7-
clean:
8-
$(RM) $(TEST_GEN_PROGS) kcmp-test-file

‎tools/testing/selftests/lib.mk‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ emit_tests:
4343
all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
4444

4545
clean:
46-
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
46+
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
4747

4848
%: %.c
4949
$(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $^

‎tools/testing/selftests/powerpc/switch_endian/Makefile‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ TEST_GEN_PROGS := switch_endian_test
22

33
ASFLAGS += -O2 -Wall -g -nostdlib -m64
44

5+
EXTRA_CLEAN = *.o check-reversed.S
6+
57
include ../../lib.mk
68

79
switch_endian_test: check-reversed.S
@@ -11,6 +13,3 @@ check-reversed.o: check.o
1113

1214
check-reversed.S: check-reversed.o
1315
hexdump -v -e '/1 ".byte 0x%02X\n"' $< > $@
14-
15-
clean:
16-
$(RM) $(TEST_GEN_PROGS) *.o check-reversed.S

‎tools/testing/selftests/pstore/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ all:
55

66
TEST_PROGS := pstore_tests pstore_post_reboot_tests
77
TEST_FILES := common_tests pstore_crash_test
8+
EXTRA_CLEAN := logs/* *uuid
89

910
include ../lib.mk
1011

1112
run_crash:
1213
@sh pstore_crash_test || { echo "pstore_crash_test: [FAIL]"; exit 1; }
13-
14-
clean:
15-
rm -rf logs/* *uuid

‎tools/testing/selftests/zram/Makefile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ all:
22

33
TEST_PROGS := zram.sh
44
TEST_FILES := zram01.sh zram02.sh zram_lib.sh
5+
EXTRA_CLEAN := err.log
56

67
include ../lib.mk
78

8-
clean:
9-
$(RM) err.log

0 commit comments

Comments
 (0)