Skip to contentSkip to conversation

selftests: sched_ext: Add sched_ext as proper selftest target

PATCH Superseded Björn Töpel 3 participants 4 messages Oct 4, 2024

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: sched_ext: Add sched_ext as proper selftest target

From: Björn Töpel <[email protected]>

The sched_ext selftests is missing proper cross-compilation support, a proper target entry, and out-of-tree build support.

When building the kselftest suite, e.g.:

  make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- \
    SKIP_TARGETS="" O=/output/foo -C tools/testing/selftests install

The expectation is that the sched_ext is included, cross-built, and placed into /output/foo.

Add CROSS_COMPILE, OUTPUT, and TARGETS support to the sched_ext selftest.

---
 tools/testing/selftests/Makefile           |  1 +
 tools/testing/selftests/sched_ext/Makefile | 59 +++++++++++++++-------
 2 files changed, 41 insertions(+), 19 deletions(-)
tools/testing/selftests/Makefile +1 -0
index b38199965f99..20ee8a0b795c 100644
@@ -88,6 +88,7 @@ TARGETS += rlimits
 TARGETS += rseq
 TARGETS += rtc
 TARGETS += rust
+TARGETS += sched_ext
 TARGETS += seccomp
 TARGETS += sgx
 TARGETS += sigaltstack
tools/testing/selftests/sched_ext/Makefile +40 -19

117 lines not on this page · raw message

base-commit: 0c559323bbaabee7346c12e74b497e283aaafef5

Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Björn Töpel

From: Björn Töpel <[email protected]>

The sched_ext selftests is missing proper cross-compilation support, a proper target entry, and out-of-tree build support.

When building the kselftest suite, e.g.:

   make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- \
     SKIP_TARGETS="" O=/output/foo -C tools/testing/selftests install

The expectation is that the sched_ext is included, cross-built, and placed into /output/foo.

Quoted 9 lines

Add CROSS_COMPILE, OUTPUT, and TARGETS support to the sched_ext selftest.

---
  tools/testing/selftests/Makefile           |  1 +
  tools/testing/selftests/sched_ext/Makefile | 59 +++++++++++++++-------
  2 files changed, 41 insertions(+), 19 deletions(-)

Thank you for the find. It appears *sched* is also missing from the default TARGETS in selftests/Makefile

This change looks good to me.

Tejun, Do let me know if you like me to take this through kselftest tree.

thanks,
-- Shuah

thanks,
-- Shuah

maintainer
#2 lore raw
Quoted 24 lines · Shuah Khan
Quoted 13 lines · Björn Töpel

From: Björn Töpel <[email protected]>

The sched_ext selftests is missing proper cross-compilation support, a proper target entry, and out-of-tree build support.

When building the kselftest suite, e.g.:

   make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- \
     SKIP_TARGETS="" O=/output/foo -C tools/testing/selftests install

The expectation is that the sched_ext is included, cross-built, and placed into /output/foo.

Quoted 9 lines

Add CROSS_COMPILE, OUTPUT, and TARGETS support to the sched_ext selftest.

---
  tools/testing/selftests/Makefile           |  1 + tools/testing/selftests/sched_ext/Makefile | 59 +++++++++++++++-------

  2 files changed, 41 insertions(+), 19 deletions(-)
Quoted 9 lines

Thank you for the find. It appears *sched* is also missing from the default TARGETS in selftests/Makefile

This change looks good to me.

Tejun, Do let me know if you like me to take this through kselftest tree.

Please don't take this patch at the moment.

Adding Mark.

After catching up with my Inbox - this is a no for me. This test depends on bpf and will fail in CIs that don't have the support.

We are discussing the issue here in this thread.

https://patchwork.kernel.org/project/linux-kselftest/patch/[email protected]/

thanks,
-- Shuah

reviewer
#3 lore raw
In reply to Björn Töpel
Quoted 1 line · Björn Töpel

From: Björn Töpel <[email protected]>

Thanks a lot Björn for working on this.

Quoted 37 lines

The sched_ext selftests is missing proper cross-compilation support, a proper target entry, and out-of-tree build support.

When building the kselftest suite, e.g.:

  make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- \
    SKIP_TARGETS="" O=/output/foo -C tools/testing/selftests install

The expectation is that the sched_ext is included, cross-built, and placed into /output/foo.

Add CROSS_COMPILE, OUTPUT, and TARGETS support to the sched_ext selftest.

---
 tools/testing/selftests/Makefile           |  1 +
 tools/testing/selftests/sched_ext/Makefile | 59 +++++++++++++++-------
 2 files changed, 41 insertions(+), 19 deletions(-)
tools/testing/selftests/Makefile +1 -0
index b38199965f99..20ee8a0b795c 100644
@@ -88,6 +88,7 @@ TARGETS += rlimits
 TARGETS += rseq
 TARGETS += rtc
 TARGETS += rust
+TARGETS += sched_ext
 TARGETS += seccomp
 TARGETS += sgx
 TARGETS += sigaltstack
tools/testing/selftests/sched_ext/Makefile +0 -0
index 0754a2c110a1..66467a99184d 100644

tools/testing/selftests/sched_ext/Makefile LLVM_SUFFIX := $(LLVM) · line 17

Quoted 5 lines
tools/testing/selftests/sched_ext/Makefile +0 -2
@@ -13,14 +13,8 @@ LLVM_SUFFIX := $(LLVM)
 endif
 
 CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLANG_FLAGS) -fintegrated-as
-else
-CC := gcc

Given that we're including ../lib.mk, can we just get rid of this whole block?

Quoted 10 lines
tools/testing/selftests/sched_ext/Makefile +0 -4
 endif # LLVM
 
-ifneq ($(CROSS_COMPILE),)
-$(error CROSS_COMPILE not supported for scx selftests)
-endif # CROSS_COMPILE
-
 CURDIR := $(abspath .)
 REPOROOT := $(abspath ../../../..)
 TOOLSDIR := $(REPOROOT)/tools

tools/testing/selftests/sched_ext/Makefile GENHDR := $(GENDIR)/autoconf.h · line 35

Quoted 9 lines
tools/testing/selftests/sched_ext/Makefile +5 -1
@@ -34,18 +28,39 @@ GENHDR := $(GENDIR)/autoconf.h
 SCXTOOLSDIR := $(TOOLSDIR)/sched_ext
 SCXTOOLSINCDIR := $(TOOLSDIR)/sched_ext/include
 
-OUTPUT_DIR := $(CURDIR)/build
+ifeq (,$(OUTPUT))
+OUTPUT := $(CURDIR)/build
+RUNNER_DIR := $(CURDIR)
+else
+OUTPUT_DIR := $(OUTPUT)

This breaks if you use make from the selftests/sched_ext directory. AFAICT it looks like OUTPUT is always set in ../lib.mk, so we always go to the OUTPUT_DIR := $(CURDIR) branch. Because of that, running make clean will delete the whole sched_ext selftests directory. Also, did you mean for the first branch to be:

+OUTPUT_DIR := $(CURDIR)/build

as opposed to:

tools/testing/selftests/sched_ext/Makefile GENHDR := $(GENDIR)/autoconf.h · line 32

Quoted 1 line
tools/testing/selftests/sched_ext/Makefile +1 -0
+OUTPUT := $(CURDIR)/build

[...]

Thanks,
David