Skip to content

Commit 66bd2ec

Browse files
fomichevAlexei Starovoitov
authored andcommitted
selftests/bpf: test_progs: test__printf -> printf
Now that test__printf is a simple wraper around printf, let's drop it (and test__vprintf as well). Cc: Andrii Nakryiko <[email protected]> Acked-by: Andrii Nakryiko <[email protected]> Signed-off-by: Stanislav Fomichev <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 946152b commit 66bd2ec

File tree

10 files changed

+22
-38
lines changed

10 files changed

+22
-38
lines changed

tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ static int libbpf_debug_print(enum libbpf_print_level level,
55
const char *format, va_list args)
66
{
77
if (level != LIBBPF_DEBUG) {
8-
test__vprintf(format, args);
8+
vprintf(format, args);
99
return 0;
1010
}
1111

1212
if (!strstr(format, "verifier log"))
1313
return 0;
14-
test__vprintf("%s", args);
14+
vprintf("%s", args);
1515
return 0;
1616
}
1717

tools/testing/selftests/bpf/prog_tests/l4lb_all.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void test_l4lb(const char *file)
7474
}
7575
if (bytes != MAGIC_BYTES * NUM_ITER * 2 || pkts != NUM_ITER * 2) {
7676
error_cnt++;
77-
test__printf("test_l4lb:FAIL:stats %lld %lld\n", bytes, pkts);
77+
printf("test_l4lb:FAIL:stats %lld %lld\n", bytes, pkts);
7878
}
7979
out:
8080
bpf_object__close(obj);

tools/testing/selftests/bpf/prog_tests/map_lock.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ static void *parallel_map_access(void *arg)
99
for (i = 0; i < 10000; i++) {
1010
err = bpf_map_lookup_elem_flags(map_fd, &key, vars, BPF_F_LOCK);
1111
if (err) {
12-
test__printf("lookup failed\n");
12+
printf("lookup failed\n");
1313
error_cnt++;
1414
goto out;
1515
}
1616
if (vars[0] != 0) {
17-
test__printf("lookup #%d var[0]=%d\n", i, vars[0]);
17+
printf("lookup #%d var[0]=%d\n", i, vars[0]);
1818
error_cnt++;
1919
goto out;
2020
}
2121
rnd = vars[1];
2222
for (j = 2; j < 17; j++) {
2323
if (vars[j] == rnd)
2424
continue;
25-
test__printf("lookup #%d var[1]=%d var[%d]=%d\n",
26-
i, rnd, j, vars[j]);
25+
printf("lookup #%d var[1]=%d var[%d]=%d\n",
26+
i, rnd, j, vars[j]);
2727
error_cnt++;
2828
goto out;
2929
}
@@ -43,7 +43,7 @@ void test_map_lock(void)
4343

4444
err = bpf_prog_load(file, BPF_PROG_TYPE_CGROUP_SKB, &obj, &prog_fd);
4545
if (err) {
46-
test__printf("test_map_lock:bpf_prog_load errno %d\n", errno);
46+
printf("test_map_lock:bpf_prog_load errno %d\n", errno);
4747
goto close_prog;
4848
}
4949
map_fd[0] = bpf_find_map(__func__, obj, "hash_map");

tools/testing/selftests/bpf/prog_tests/send_signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ static int test_send_signal_nmi(void)
202202
-1 /* cpu */, -1 /* group_fd */, 0 /* flags */);
203203
if (pmu_fd == -1) {
204204
if (errno == ENOENT) {
205-
test__printf("%s:SKIP:no PERF_COUNT_HW_CPU_CYCLES\n",
206-
__func__);
205+
printf("%s:SKIP:no PERF_COUNT_HW_CPU_CYCLES\n",
206+
__func__);
207207
return 0;
208208
}
209209
/* Let the test fail with a more informative message */

tools/testing/selftests/bpf/prog_tests/spinlock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void test_spinlock(void)
1212

1313
err = bpf_prog_load(file, BPF_PROG_TYPE_CGROUP_SKB, &obj, &prog_fd);
1414
if (err) {
15-
test__printf("test_spin_lock:bpf_prog_load errno %d\n", errno);
15+
printf("test_spin_lock:bpf_prog_load errno %d\n", errno);
1616
goto close_prog;
1717
}
1818
for (i = 0; i < 4; i++)

tools/testing/selftests/bpf/prog_tests/stacktrace_build_id.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ void test_stacktrace_build_id(void)
109109
if (build_id_matches < 1 && retry--) {
110110
bpf_link__destroy(link);
111111
bpf_object__close(obj);
112-
test__printf("%s:WARN:Didn't find expected build ID from the map, retrying\n",
113-
__func__);
112+
printf("%s:WARN:Didn't find expected build ID from the map, retrying\n",
113+
__func__);
114114
goto retry;
115115
}
116116

tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void test_stacktrace_build_id_nmi(void)
140140
if (build_id_matches < 1 && retry--) {
141141
bpf_link__destroy(link);
142142
bpf_object__close(obj);
143-
test__printf("%s:WARN:Didn't find expected build ID from the map, retrying\n",
144-
__func__);
143+
printf("%s:WARN:Didn't find expected build ID from the map, retrying\n",
144+
__func__);
145145
goto retry;
146146
}
147147

tools/testing/selftests/bpf/prog_tests/xdp_noinline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ void test_xdp_noinline(void)
7575
}
7676
if (bytes != MAGIC_BYTES * NUM_ITER * 2 || pkts != NUM_ITER * 2) {
7777
error_cnt++;
78-
test__printf("test_xdp_noinline:FAIL:stats %lld %lld\n",
79-
bytes, pkts);
78+
printf("test_xdp_noinline:FAIL:stats %lld %lld\n",
79+
bytes, pkts);
8080
}
8181
out:
8282
bpf_object__close(obj);

tools/testing/selftests/bpf/test_progs.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,6 @@ void test__force_log() {
105105
env.test->force_log = true;
106106
}
107107

108-
void test__vprintf(const char *fmt, va_list args)
109-
{
110-
vprintf(fmt, args);
111-
}
112-
113-
void test__printf(const char *fmt, ...)
114-
{
115-
va_list args;
116-
117-
va_start(args, fmt);
118-
test__vprintf(fmt, args);
119-
va_end(args);
120-
}
121-
122108
struct ipv4_packet pkt_v4 = {
123109
.eth.h_proto = __bpf_constant_htons(ETH_P_IP),
124110
.iph.ihl = 5,
@@ -310,7 +296,7 @@ static int libbpf_print_fn(enum libbpf_print_level level,
310296
{
311297
if (!env.very_verbose && level == LIBBPF_DEBUG)
312298
return 0;
313-
test__vprintf(format, args);
299+
vprintf(format, args);
314300
return 0;
315301
}
316302

tools/testing/selftests/bpf/test_progs.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ extern int error_cnt;
7070
extern int pass_cnt;
7171
extern struct test_env env;
7272

73-
extern void test__printf(const char *fmt, ...);
74-
extern void test__vprintf(const char *fmt, va_list args);
7573
extern void test__force_log();
7674
extern bool test__start_subtest(const char *name);
7775

@@ -97,12 +95,12 @@ extern struct ipv6_packet pkt_v6;
9795
int __ret = !!(condition); \
9896
if (__ret) { \
9997
error_cnt++; \
100-
test__printf("%s:FAIL:%s ", __func__, tag); \
101-
test__printf(format); \
98+
printf("%s:FAIL:%s ", __func__, tag); \
99+
printf(format); \
102100
} else { \
103101
pass_cnt++; \
104-
test__printf("%s:PASS:%s %d nsec\n", \
105-
__func__, tag, duration); \
102+
printf("%s:PASS:%s %d nsec\n", \
103+
__func__, tag, duration); \
106104
} \
107105
__ret; \
108106
})

0 commit comments

Comments
 (0)