selftests/sched_ext: Fix enum resolution
All scx enums are now automatically generated from vmlinux.h and they
must be initialized using the SCX_ENUM_INIT() macro.
Fix the scx selftests to use this macro to properly initialize these
values.
Fixes: 8da7bf2cee
("tools/sched_ext: Receive updates from SCX repo")
Reported-by: Ihor Solodrai <ihor.solodrai@pm.me>
Closes: https://lore.kernel.org/all/Z2tNK2oFDX1OPp8C@slm.duckdns.org/
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
2279563e3a
commit
74ca334338
19 changed files with 88 additions and 67 deletions
|
@ -14,11 +14,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct create_dsq *skel;
|
||||
|
||||
skel = create_dsq__open_and_load();
|
||||
if (!skel) {
|
||||
SCX_ERR("Failed to open and load skel");
|
||||
return SCX_TEST_FAIL;
|
||||
}
|
||||
skel = create_dsq__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(create_dsq__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,8 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct ddsp_bogus_dsq_fail *skel;
|
||||
|
||||
skel = ddsp_bogus_dsq_fail__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = ddsp_bogus_dsq_fail__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(ddsp_bogus_dsq_fail__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -14,8 +14,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct ddsp_vtimelocal_fail *skel;
|
||||
|
||||
skel = ddsp_vtimelocal_fail__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = ddsp_vtimelocal_fail__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(ddsp_vtimelocal_fail__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,6 +15,7 @@ static enum scx_test_status setup(void **ctx)
|
|||
|
||||
skel = dsp_local_on__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
|
||||
skel->rodata->nr_cpus = libbpf_num_possible_cpus();
|
||||
SCX_FAIL_IF(dsp_local_on__load(skel), "Failed to load skel");
|
||||
|
|
|
@ -15,11 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct enq_last_no_enq_fails *skel;
|
||||
|
||||
skel = enq_last_no_enq_fails__open_and_load();
|
||||
if (!skel) {
|
||||
SCX_ERR("Failed to open and load skel");
|
||||
return SCX_TEST_FAIL;
|
||||
}
|
||||
skel = enq_last_no_enq_fails__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(enq_last_no_enq_fails__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,11 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct enq_select_cpu_fails *skel;
|
||||
|
||||
skel = enq_select_cpu_fails__open_and_load();
|
||||
if (!skel) {
|
||||
SCX_ERR("Failed to open and load skel");
|
||||
return SCX_TEST_FAIL;
|
||||
}
|
||||
skel = enq_select_cpu_fails__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(enq_select_cpu_fails__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -23,6 +23,7 @@ static enum scx_test_status run(void *ctx)
|
|||
char buf[16];
|
||||
|
||||
skel = exit__open();
|
||||
SCX_ENUM_INIT(skel);
|
||||
skel->rodata->exit_point = tc;
|
||||
exit__load(skel);
|
||||
link = bpf_map__attach_struct_ops(skel->maps.exit_ops);
|
||||
|
|
|
@ -49,8 +49,10 @@ static enum scx_test_status test_hotplug(bool onlining, bool cbs_defined)
|
|||
|
||||
SCX_ASSERT(is_cpu_online());
|
||||
|
||||
skel = hotplug__open_and_load();
|
||||
SCX_ASSERT(skel);
|
||||
skel = hotplug__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(hotplug__load(skel), "Failed to load skel");
|
||||
|
||||
/* Testing the offline -> online path, so go offline before starting */
|
||||
if (onlining)
|
||||
|
|
|
@ -15,22 +15,6 @@
|
|||
|
||||
#define SCHED_EXT 7
|
||||
|
||||
static struct init_enable_count *
|
||||
open_load_prog(bool global)
|
||||
{
|
||||
struct init_enable_count *skel;
|
||||
|
||||
skel = init_enable_count__open();
|
||||
SCX_BUG_ON(!skel, "Failed to open skel");
|
||||
|
||||
if (!global)
|
||||
skel->struct_ops.init_enable_count_ops->flags |= SCX_OPS_SWITCH_PARTIAL;
|
||||
|
||||
SCX_BUG_ON(init_enable_count__load(skel), "Failed to load skel");
|
||||
|
||||
return skel;
|
||||
}
|
||||
|
||||
static enum scx_test_status run_test(bool global)
|
||||
{
|
||||
struct init_enable_count *skel;
|
||||
|
@ -40,7 +24,14 @@ static enum scx_test_status run_test(bool global)
|
|||
struct sched_param param = {};
|
||||
pid_t pids[num_pre_forks];
|
||||
|
||||
skel = open_load_prog(global);
|
||||
skel = init_enable_count__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
|
||||
if (!global)
|
||||
skel->struct_ops.init_enable_count_ops->flags |= SCX_OPS_SWITCH_PARTIAL;
|
||||
|
||||
SCX_FAIL_IF(init_enable_count__load(skel), "Failed to load skel");
|
||||
|
||||
/*
|
||||
* Fork a bunch of children before we attach the scheduler so that we
|
||||
|
|
|
@ -14,8 +14,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct maximal *skel;
|
||||
|
||||
skel = maximal__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = maximal__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(maximal__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,11 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct minimal *skel;
|
||||
|
||||
skel = minimal__open_and_load();
|
||||
if (!skel) {
|
||||
SCX_ERR("Failed to open and load skel");
|
||||
return SCX_TEST_FAIL;
|
||||
}
|
||||
skel = minimal__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(minimal__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,11 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct prog_run *skel;
|
||||
|
||||
skel = prog_run__open_and_load();
|
||||
if (!skel) {
|
||||
SCX_ERR("Failed to open and load skel");
|
||||
return SCX_TEST_FAIL;
|
||||
}
|
||||
skel = prog_run__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(prog_run__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -18,11 +18,10 @@ bool force_exit = false;
|
|||
|
||||
static enum scx_test_status setup(void **ctx)
|
||||
{
|
||||
skel = maximal__open_and_load();
|
||||
if (!skel) {
|
||||
SCX_ERR("Failed to open and load skel");
|
||||
return SCX_TEST_FAIL;
|
||||
}
|
||||
skel = maximal__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(maximal__load(skel), "Failed to load skel");
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct select_cpu_dfl *skel;
|
||||
|
||||
skel = select_cpu_dfl__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = select_cpu_dfl__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(select_cpu_dfl__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -17,8 +17,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct select_cpu_dfl_nodispatch *skel;
|
||||
|
||||
skel = select_cpu_dfl_nodispatch__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = select_cpu_dfl_nodispatch__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(select_cpu_dfl_nodispatch__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -17,8 +17,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct select_cpu_dispatch *skel;
|
||||
|
||||
skel = select_cpu_dispatch__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = select_cpu_dispatch__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(select_cpu_dispatch__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,8 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct select_cpu_dispatch_bad_dsq *skel;
|
||||
|
||||
skel = select_cpu_dispatch_bad_dsq__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = select_cpu_dispatch_bad_dsq__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(select_cpu_dispatch_bad_dsq__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,8 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct select_cpu_dispatch_dbl_dsp *skel;
|
||||
|
||||
skel = select_cpu_dispatch_dbl_dsp__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = select_cpu_dispatch_dbl_dsp__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(select_cpu_dispatch_dbl_dsp__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
|
@ -15,8 +15,11 @@ static enum scx_test_status setup(void **ctx)
|
|||
{
|
||||
struct select_cpu_vtime *skel;
|
||||
|
||||
skel = select_cpu_vtime__open_and_load();
|
||||
SCX_FAIL_IF(!skel, "Failed to open and load skel");
|
||||
skel = select_cpu_vtime__open();
|
||||
SCX_FAIL_IF(!skel, "Failed to open");
|
||||
SCX_ENUM_INIT(skel);
|
||||
SCX_FAIL_IF(select_cpu_vtime__load(skel), "Failed to load skel");
|
||||
|
||||
*ctx = skel;
|
||||
|
||||
return SCX_TEST_PASS;
|
||||
|
|
Loading…
Add table
Reference in a new issue