]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/sched_ext: Fix enum resolution
authorAndrea Righi <arighi@nvidia.com>
Thu, 23 Jan 2025 12:46:06 +0000 (13:46 +0100)
committerTejun Heo <tj@kernel.org>
Fri, 24 Jan 2025 18:09:52 +0000 (08:09 -1000)
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: 8da7bf2cee27 ("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>
19 files changed:
tools/testing/selftests/sched_ext/create_dsq.c
tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c
tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c
tools/testing/selftests/sched_ext/dsp_local_on.c
tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c
tools/testing/selftests/sched_ext/enq_select_cpu_fails.c
tools/testing/selftests/sched_ext/exit.c
tools/testing/selftests/sched_ext/hotplug.c
tools/testing/selftests/sched_ext/init_enable_count.c
tools/testing/selftests/sched_ext/maximal.c
tools/testing/selftests/sched_ext/minimal.c
tools/testing/selftests/sched_ext/prog_run.c
tools/testing/selftests/sched_ext/reload_loop.c
tools/testing/selftests/sched_ext/select_cpu_dfl.c
tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.c
tools/testing/selftests/sched_ext/select_cpu_dispatch.c
tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.c
tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c
tools/testing/selftests/sched_ext/select_cpu_vtime.c

index fa946d9146d4dbb52a819b5677d829aeb750111e..d67431f57ac6567689665c5c91e48a4bd7e68bcd 100644 (file)
@@ -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;
index e65d22f23f3bc23d3d37b4342545030d1f7be4b5..b6d13496b24e8c30f34c04ebccaf3af3214b6853 100644 (file)
@@ -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;
index abafee587cd6012b6313b0eab51072cf7798d4ad..af9ce4ee8baac83c54b3b7493db2bc73bbd59d0a 100644 (file)
@@ -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;
index 0ff27e57fe4303a78ac2360e313df852bc18c2f3..e1f2ce4abfe6434198a84ccd6c108015cb210231 100644 (file)
@@ -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");
index 73e679953e27ae15d7341450b6137273db849179..d3387ae036794dc0ab47ce073ead4a010305e609 100644 (file)
@@ -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;
index dd1350e5f002d051d7186cf25bb4516387e2308c..a80e3a3b3698c664fd85bfa14dcc3ca4eabbc19a 100644 (file)
@@ -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;
index 31bcd06e21cd3d1d12a255be31c510e9db358f60..9451782689de1dec0d9d6e550f90da6624a6066b 100644 (file)
@@ -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);
index 87bf220b1bcee89bdce4f49f69e6612f122495f2..1c9ceb661c43ea5d1b6b1fed9b11235ee2a34a06 100644 (file)
@@ -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)
index 97d45f1e5597ed5612a1fa6344ecfe341b95c25c..0f3eddc7a17a0cc09b6bab7eca821c0433fc8bfe 100644 (file)
 
 #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
index f38fc973c3800705f7a824b73a01424cb73b979a..c6be50a9941d55aa8994c69456e03a087e5b75fc 100644 (file)
@@ -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;
index 6c5db8ebbf8ac4a72e89e5f7388199d5a720d4ec..89f7261757ffb4ba063537b4ba459ee323c25eda 100644 (file)
@@ -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;
index 3cd57ef8daaa5190b9443cb676f1169e3de192ae..05974820ca69d8ba22b9b7af8312002a72f1282c 100644 (file)
@@ -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;
index 5cfba2d6e0568ffc8a7035cdb520e760e49be6d4..308211d804364aae76331638a25171ac764a97d2 100644 (file)
@@ -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;
 }
index a53a40c2d2f0fe2195b23d52a4c7316f3e608f48..5b6e045e1109b9b626095aff7aa60984865cac19 100644 (file)
@@ -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;
index 1d85bf4bf3a39b4f5936e92eb7f7b45d15d0130d..9b5d232efb7f610b319721aaf57b815bf1e4e64e 100644 (file)
@@ -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;
index 0309ca8785b362e6f1d90df8dacf44d7a7fd84f0..80283dbc41b7ece849d8c3ca8ff7b0734ec5cc5b 100644 (file)
@@ -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;
index 47eb6ed7627d95107895cd705de60b92106cdb78..5e72ebbc90a5aa3f29690aea94da282f22dc5c0f 100644 (file)
@@ -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;
index 48ff028a3c46d9439811343139fc74250bdc6f2e..aa85949478bcf4e22193bb5fcb7ed3c5c69e85fd 100644 (file)
@@ -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;
index b4629c2364f5db3d5a390844c34cae8bb8d4269c..1e9b5c9bfff1d3559395cf12b87294288ada081c 100644 (file)
@@ -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;