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"
6 static void test_bpf_spin_lock(bool is_spin_lock)
8 struct tracing_failure *skel;
11 skel = tracing_failure__open();
12 if (!ASSERT_OK_PTR(skel, "tracing_failure__open"))
16 bpf_program__set_autoload(skel->progs.test_spin_lock, true);
18 bpf_program__set_autoload(skel->progs.test_spin_unlock, true);
20 err = tracing_failure__load(skel);
21 if (!ASSERT_OK(err, "tracing_failure__load"))
24 err = tracing_failure__attach(skel);
25 ASSERT_ERR(err, "tracing_failure__attach");
28 tracing_failure__destroy(skel);
31 void test_tracing_failure(void)
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);