Debian Codegraph @

tools/testing/selftests/ublk/Makefile

raw symbols SCIP
1 # SPDX-License-Identifier: GPL-2.0
2
3 CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir)/usr/include
4 ifneq ($(WERROR),0)
5 CFLAGS += -Werror
6 endif
7
8 LDLIBS += -lpthread -lm -luring
9
10 TEST_PROGS := test_generic_02.sh
11 TEST_PROGS += test_generic_03.sh
12 TEST_PROGS += test_generic_06.sh
13 TEST_PROGS += test_generic_07.sh
14
15 TEST_PROGS += test_generic_08.sh
16 TEST_PROGS += test_generic_09.sh
17 TEST_PROGS += test_generic_10.sh
18 TEST_PROGS += test_generic_12.sh
19 TEST_PROGS += test_generic_13.sh
20 TEST_PROGS += test_generic_16.sh
21 TEST_PROGS += test_generic_17.sh
22
23 TEST_PROGS += test_batch_01.sh
24 TEST_PROGS += test_batch_02.sh
25 TEST_PROGS += test_batch_03.sh
26
27 TEST_PROGS += test_null_01.sh
28 TEST_PROGS += test_null_02.sh
29 TEST_PROGS += test_null_03.sh
30 TEST_PROGS += test_loop_01.sh
31 TEST_PROGS += test_loop_02.sh
32 TEST_PROGS += test_loop_03.sh
33 TEST_PROGS += test_loop_04.sh
34 TEST_PROGS += test_loop_05.sh
35 TEST_PROGS += test_loop_06.sh
36 TEST_PROGS += test_loop_07.sh
37
38 TEST_PROGS += test_integrity_01.sh
39 TEST_PROGS += test_integrity_02.sh
40 TEST_PROGS += test_integrity_03.sh
41
42 TEST_PROGS += test_recover_01.sh
43 TEST_PROGS += test_recover_02.sh
44 TEST_PROGS += test_recover_03.sh
45 TEST_PROGS += test_recover_04.sh
46 TEST_PROGS += test_stripe_01.sh
47 TEST_PROGS += test_stripe_02.sh
48 TEST_PROGS += test_stripe_03.sh
49 TEST_PROGS += test_stripe_04.sh
50 TEST_PROGS += test_stripe_05.sh
51 TEST_PROGS += test_stripe_06.sh
52
53 TEST_PROGS += test_part_01.sh
54 TEST_PROGS += test_part_02.sh
55
56 TEST_PROGS += test_shmemzc_01.sh
57 TEST_PROGS += test_shmemzc_02.sh
58 TEST_PROGS += test_shmemzc_03.sh
59 TEST_PROGS += test_shmemzc_04.sh
60
61 TEST_PROGS += test_stress_01.sh
62 TEST_PROGS += test_stress_02.sh
63 TEST_PROGS += test_stress_03.sh
64 TEST_PROGS += test_stress_04.sh
65 TEST_PROGS += test_stress_05.sh
66 TEST_PROGS += test_stress_06.sh
67 TEST_PROGS += test_stress_07.sh
68 TEST_PROGS += test_stress_08.sh
69 TEST_PROGS += test_stress_09.sh
70
71 TEST_FILES := settings
72
73 TEST_GEN_PROGS_EXTENDED = kublk metadata_size
74 STANDALONE_UTILS := metadata_size.c
75
76 LOCAL_HDRS += $(wildcard *.h)
77 include ../lib.mk
78
79 $(OUTPUT)/kublk: $(filter-out $(STANDALONE_UTILS),$(wildcard *.c))
80
81 check:
82 shellcheck -x -f gcc *.sh
83
84 # Test groups for running subsets of tests
85 # JOBS=1 (default): sequential with kselftest TAP output
86 # JOBS>1: parallel execution with xargs -P
87 # Usage: make run_null JOBS=4
88 JOBS ?= 1
89 export JOBS
90
91 # Auto-detect test groups from TEST_PROGS (test_<group>_<num>.sh -> group)
92 TEST_GROUPS := $(shell echo "$(TEST_PROGS)" | tr ' ' '\n' | \
93 sed 's/test_\([^_]*\)_.*/\1/' | sort -u)
94
95 # Template for group test targets
96 # $(1) = group name (e.g., null, generic, stress)
97 define RUN_GROUP
98 run_$(1): all
99 @if [ $$(JOBS) -gt 1 ]; then \
100 echo $$(filter test_$(1)_%.sh,$$(TEST_PROGS)) | tr ' ' '\n' | \
101 xargs -P $$(JOBS) -n1 sh -c './"$$$$0"' || true; \
102 else \
103 $$(call RUN_TESTS, $$(filter test_$(1)_%.sh,$$(TEST_PROGS))); \
104 fi
105 .PHONY: run_$(1)
106 endef
107
108 # Generate targets for each discovered test group
109 $(foreach group,$(TEST_GROUPS),$(eval $(call RUN_GROUP,$(group))))
110
111 # Run all tests (parallel when JOBS>1)
112 run_all: all
113 @if [ $(JOBS) -gt 1 ]; then \
114 echo $(TEST_PROGS) | tr ' ' '\n' | \
115 xargs -P $(JOBS) -n1 sh -c './"$$0"' || true; \
116 else \
117 $(call RUN_TESTS, $(TEST_PROGS)); \
118 fi
119 .PHONY: run_all