blob: 99e438fe12acd527e606b419eca71c66ede59d6f (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 | // SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2024 Benjamin Tissoires */
#include <test_progs.h>
#include "wq.skel.h"
#include "wq_failures.skel.h"
void serial_test_wq(void)
{
	struct wq *wq_skel = NULL;
	int err, prog_fd;
	LIBBPF_OPTS(bpf_test_run_opts, topts);
	RUN_TESTS(wq);
	/* re-run the success test to check if the timer was actually executed */
	wq_skel = wq__open_and_load();
	if (!ASSERT_OK_PTR(wq_skel, "wq_skel_load"))
		return;
	err = wq__attach(wq_skel);
	if (!ASSERT_OK(err, "wq_attach"))
		return;
	prog_fd = bpf_program__fd(wq_skel->progs.test_syscall_array_sleepable);
	err = bpf_prog_test_run_opts(prog_fd, &topts);
	ASSERT_OK(err, "test_run");
	ASSERT_EQ(topts.retval, 0, "test_run");
	usleep(50); /* 10 usecs should be enough, but give it extra */
	ASSERT_EQ(wq_skel->bss->ok_sleepable, (1 << 1), "ok_sleepable");
	wq__destroy(wq_skel);
}
void serial_test_failures_wq(void)
{
	RUN_TESTS(wq_failures);
}
 |