Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.17.
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Copyright (c) 2024 Meta Platforms, Inc. and affiliates.
 4 * Copyright (c) 2024 David Vernet <dvernet@meta.com>
 5 */
 6#include <bpf/bpf.h>
 7#include <scx/common.h>
 8#include <sys/wait.h>
 9#include <unistd.h>
10#include "maximal.bpf.skel.h"
11#include "scx_test.h"
12
13static enum scx_test_status setup(void **ctx)
14{
15	struct maximal *skel;
16
17	skel = maximal__open_and_load();
18	SCX_FAIL_IF(!skel, "Failed to open and load skel");
19	*ctx = skel;
20
21	return SCX_TEST_PASS;
22}
23
24static enum scx_test_status run(void *ctx)
25{
26	struct maximal *skel = ctx;
27	struct bpf_link *link;
28
29	link = bpf_map__attach_struct_ops(skel->maps.maximal_ops);
30	SCX_FAIL_IF(!link, "Failed to attach scheduler");
31
32	bpf_link__destroy(link);
33
34	return SCX_TEST_PASS;
35}
36
37static void cleanup(void *ctx)
38{
39	struct maximal *skel = ctx;
40
41	maximal__destroy(skel);
42}
43
44struct scx_test maximal = {
45	.name = "maximal",
46	.description = "Verify we can load a scheduler with every callback defined",
47	.setup = setup,
48	.run = run,
49	.cleanup = cleanup,
50};
51REGISTER_SCX_TEST(&maximal)