Linux Audio

Check our new training course

Loading...
Note: File does not exist in v5.4.
 1// SPDX-License-Identifier: GPL-2.0
 2/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
 3#include <test_progs.h>
 4#include "tracing_failure.skel.h"
 5
 6static void test_bpf_spin_lock(bool is_spin_lock)
 7{
 8	struct tracing_failure *skel;
 9	int err;
10
11	skel = tracing_failure__open();
12	if (!ASSERT_OK_PTR(skel, "tracing_failure__open"))
13		return;
14
15	if (is_spin_lock)
16		bpf_program__set_autoload(skel->progs.test_spin_lock, true);
17	else
18		bpf_program__set_autoload(skel->progs.test_spin_unlock, true);
19
20	err = tracing_failure__load(skel);
21	if (!ASSERT_OK(err, "tracing_failure__load"))
22		goto out;
23
24	err = tracing_failure__attach(skel);
25	ASSERT_ERR(err, "tracing_failure__attach");
26
27out:
28	tracing_failure__destroy(skel);
29}
30
31void test_tracing_failure(void)
32{
33	if (test__start_subtest("bpf_spin_lock"))
34		test_bpf_spin_lock(true);
35	if (test__start_subtest("bpf_spin_unlock"))
36		test_bpf_spin_lock(false);
37}