Commit 74ca3343 authored by Andrea Righi's avatar Andrea Righi Committed by Tejun Heo
Browse files

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: 8da7bf2c ("tools/sched_ext: Receive updates from SCX repo")
Reported-by: default avatarIhor Solodrai <ihor.solodrai@pm.me>
Closes: https://lore.kernel.org/all/Z2tNK2oFDX1OPp8C@slm.duckdns.org/


Signed-off-by: default avatarAndrea Righi <arighi@nvidia.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 2279563e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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;
+5 −2
Original line number Diff line number Diff line
@@ -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;
+5 −2
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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");
+5 −5
Original line number Diff line number Diff line
@@ -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;
Loading