Skip to content

Commit c31f2ee

Browse files
committed
sched_ext: Fix enq_last_no_enq_fails selftest
cc9877f ("sched_ext: Improve error reporting during loading") changed how load failures are reported so that more error context can be communicated. This breaks the enq_last_no_enq_fails test as attach no longer fails. The scheduler is guaranteed to be ejected on attach completion with full error information. Update enq_last_no_enq_fails so that it checks that the scheduler is ejected using ops.exit(). Signed-off-by: Tejun Heo <[email protected]> Reported-by: Vishal Chourasia <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Fixes: cc9877f ("sched_ext: Improve error reporting during loading")
1 parent 7724abf commit c31f2ee

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tools/testing/selftests/sched_ext/enq_last_no_enq_fails.bpf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@
1212

1313
char _license[] SEC("license") = "GPL";
1414

15+
u32 exit_kind;
16+
17+
void BPF_STRUCT_OPS_SLEEPABLE(enq_last_no_enq_fails_exit, struct scx_exit_info *info)
18+
{
19+
exit_kind = info->kind;
20+
}
21+
1522
SEC(".struct_ops.link")
1623
struct sched_ext_ops enq_last_no_enq_fails_ops = {
1724
.name = "enq_last_no_enq_fails",
1825
/* Need to define ops.enqueue() with SCX_OPS_ENQ_LAST */
1926
.flags = SCX_OPS_ENQ_LAST,
27+
.exit = (void *) enq_last_no_enq_fails_exit,
2028
.timeout_ms = 1000U,
2129
};

tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ static enum scx_test_status run(void *ctx)
3131
struct bpf_link *link;
3232

3333
link = bpf_map__attach_struct_ops(skel->maps.enq_last_no_enq_fails_ops);
34-
if (link) {
35-
SCX_ERR("Incorrectly succeeded in to attaching scheduler");
34+
if (!link) {
35+
SCX_ERR("Incorrectly failed at attaching scheduler");
36+
return SCX_TEST_FAIL;
37+
}
38+
if (!skel->bss->exit_kind) {
39+
SCX_ERR("Incorrectly stayed loaded");
3640
return SCX_TEST_FAIL;
3741
}
3842

@@ -50,7 +54,7 @@ static void cleanup(void *ctx)
5054

5155
struct scx_test enq_last_no_enq_fails = {
5256
.name = "enq_last_no_enq_fails",
53-
.description = "Verify we fail to load a scheduler if we specify "
57+
.description = "Verify we eject a scheduler if we specify "
5458
"the SCX_OPS_ENQ_LAST flag without defining "
5559
"ops.enqueue()",
5660
.setup = setup,

0 commit comments

Comments
 (0)