FILE
maximal.c
File preview with syntax highlighting.
linux-6.19.14/tools/testing/selftests/sched_ext/maximal.c
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(); 18 SCX_FAIL_IF(!skel, "Failed to open"); 19 SCX_ENUM_INIT(skel); 20 SCX_FAIL_IF(maximal__load(skel), "Failed to load skel"); 21 22 *ctx = skel; 23 24 return SCX_TEST_PASS; 25} 26 27static enum scx_test_status run(void *ctx) 28{ 29 struct maximal *skel = ctx; 30 struct bpf_link *link; 31 32 link = bpf_map__attach_struct_ops(skel->maps.maximal_ops); 33 SCX_FAIL_IF(!link, "Failed to attach scheduler"); 34 35 bpf_link__destroy(link); 36 37 return SCX_TEST_PASS; 38} 39 40static void cleanup(void *ctx) 41{ 42 struct maximal *skel = ctx; 43 44 maximal__destroy(skel); 45} 46 47struct scx_test maximal = { 48 .name = "maximal", 49 .description = "Verify we can load a scheduler with every callback defined", 50 .setup = setup, 51 .run = run, 52 .cleanup = cleanup, 53}; 54REGISTER_SCX_TEST(&maximal)
~/
Read-only file preview.