linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Two cross-compilation kselftest fixes
@ 2023-06-29 16:22 Björn Töpel
  2023-06-29 16:22 ` [PATCH 1/2] selftests/openat2: Run-time check for -fsanitize=undefined Björn Töpel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Björn Töpel @ 2023-06-29 16:22 UTC (permalink / raw)
  To: Shuah Khan, linux-kselftest
  Cc: Björn Töpel, linux-kernel, linux-riscv, Alexey Dobriyan,
	linux-fsdevel, Anders Roxell

From: Björn Töpel <bjorn@rivosinc.com>

When you're cross-building kselftest, in this case RISC-V:

  | make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- O=/tmp/kselftest \
  |   HOSTCC=gcc FORMAT= SKIP_TARGETS="arm64 ia64 powerpc sparc64 x86 \
  |   sgx" -C tools/testing/selftests gen_tar

the components (paths) that fail to build are skipped. In this case,
openat2 failed due to missing library support, and proc due to an
x86-64 only test.

This tiny series addresses the problems above.


Björn

Björn Töpel (2):
  selftests/openat2: Run-time check for -fsanitize=undefined
  selftests/proc: Do not build x86-64 tests on non-x86-64 builds

 tools/testing/selftests/openat2/Makefile | 9 ++++++++-
 tools/testing/selftests/proc/Makefile    | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)


base-commit: 3a8a670eeeaa40d87bd38a587438952741980c18
-- 
2.39.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] selftests/openat2: Run-time check for -fsanitize=undefined
  2023-06-29 16:22 [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel
@ 2023-06-29 16:22 ` Björn Töpel
  2023-06-29 16:23 ` [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds Björn Töpel
  2023-07-03  6:36 ` [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel
  2 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2023-06-29 16:22 UTC (permalink / raw)
  To: Shuah Khan, linux-kselftest
  Cc: Björn Töpel, linux-kernel, linux-riscv, Alexey Dobriyan,
	linux-fsdevel, Anders Roxell

From: Björn Töpel <bjorn@rivosinc.com>

Some architectures, e.g. riscv, does not have support for the GCC
option '-fsanitize=undefined'.

Check for '-fsanitize=undefined' support, and only add it to CFLAGS if
supported.

Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 tools/testing/selftests/openat2/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/openat2/Makefile b/tools/testing/selftests/openat2/Makefile
index 843ba56d8e49..f13ad02a18ea 100644
--- a/tools/testing/selftests/openat2/Makefile
+++ b/tools/testing/selftests/openat2/Makefile
@@ -1,6 +1,13 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
-CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined
+# We need this for the "try-run" macro.
+include ../../../build/Build.include
+
+CFLAGS += -Wall -O2 -g -fsanitize=address
+CFLAGS += $(call try-run, \
+	echo 'int main() {}' | $(CC) -fsanitize=undefined -x c - -o /dev/null, \
+	-fsanitize=undefined,)
+
 TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test
 
 include ../lib.mk
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds
  2023-06-29 16:22 [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel
  2023-06-29 16:22 ` [PATCH 1/2] selftests/openat2: Run-time check for -fsanitize=undefined Björn Töpel
@ 2023-06-29 16:23 ` Björn Töpel
  2023-06-29 19:42   ` Alexey Dobriyan
  2023-07-03  6:36 ` [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel
  2 siblings, 1 reply; 6+ messages in thread
From: Björn Töpel @ 2023-06-29 16:23 UTC (permalink / raw)
  To: Shuah Khan, linux-kselftest
  Cc: Björn Töpel, linux-kernel, linux-riscv, Alexey Dobriyan,
	linux-fsdevel, Anders Roxell

From: Björn Töpel <bjorn@rivosinc.com>

The proc-empty-vm test is x86-64 only. Remove that test from
non-x86-64 builds.

Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 tools/testing/selftests/proc/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile
index cd95369254c0..35e765f79b6d 100644
--- a/tools/testing/selftests/proc/Makefile
+++ b/tools/testing/selftests/proc/Makefile
@@ -8,7 +8,11 @@ TEST_GEN_PROGS += fd-001-lookup
 TEST_GEN_PROGS += fd-002-posix-eq
 TEST_GEN_PROGS += fd-003-kthread
 TEST_GEN_PROGS += proc-loadavg-001
+
+ifneq (,$(filter $(ARCH),x86_64))
 TEST_GEN_PROGS += proc-empty-vm
+endif
+
 TEST_GEN_PROGS += proc-pid-vm
 TEST_GEN_PROGS += proc-self-map-files-001
 TEST_GEN_PROGS += proc-self-map-files-002
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds
  2023-06-29 16:23 ` [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds Björn Töpel
@ 2023-06-29 19:42   ` Alexey Dobriyan
  2023-06-30 10:27     ` Björn Töpel
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2023-06-29 19:42 UTC (permalink / raw)
  To: Björn Töpel
  Cc: Shuah Khan, linux-kselftest, Björn Töpel, linux-kernel,
	linux-riscv, linux-fsdevel, Anders Roxell

On Thu, Jun 29, 2023 at 06:23:00PM +0200, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
> 
> The proc-empty-vm test is x86-64 only. Remove that test from
> non-x86-64 builds.
> 
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>

What's the address space size on risc-v?

> --- a/tools/testing/selftests/proc/Makefile
> +++ b/tools/testing/selftests/proc/Makefile
> @@ -8,7 +8,11 @@ TEST_GEN_PROGS += fd-001-lookup
>  TEST_GEN_PROGS += fd-002-posix-eq
>  TEST_GEN_PROGS += fd-003-kthread
>  TEST_GEN_PROGS += proc-loadavg-001
> +
> +ifneq (,$(filter $(ARCH),x86_64))
>  TEST_GEN_PROGS += proc-empty-vm
> +endif
> +
>  TEST_GEN_PROGS += proc-pid-vm
>  TEST_GEN_PROGS += proc-self-map-files-001
>  TEST_GEN_PROGS += proc-self-map-files-002

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds
  2023-06-29 19:42   ` Alexey Dobriyan
@ 2023-06-30 10:27     ` Björn Töpel
  0 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2023-06-30 10:27 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: Shuah Khan, linux-kselftest, Björn Töpel, linux-kernel,
	linux-riscv, linux-fsdevel, Anders Roxell

Alexey Dobriyan <adobriyan@gmail.com> writes:

> On Thu, Jun 29, 2023 at 06:23:00PM +0200, Björn Töpel wrote:
>> From: Björn Töpel <bjorn@rivosinc.com>
>> 
>> The proc-empty-vm test is x86-64 only. Remove that test from
>> non-x86-64 builds.
>> 
>> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
>
> What's the address space size on risc-v?

Different sizes are supported, 39b, 48b, and 57b:
Documentation/riscv/vm-layout.rst

Did you have anything particular in mind?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Two cross-compilation kselftest fixes
  2023-06-29 16:22 [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel
  2023-06-29 16:22 ` [PATCH 1/2] selftests/openat2: Run-time check for -fsanitize=undefined Björn Töpel
  2023-06-29 16:23 ` [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds Björn Töpel
@ 2023-07-03  6:36 ` Björn Töpel
  2 siblings, 0 replies; 6+ messages in thread
From: Björn Töpel @ 2023-07-03  6:36 UTC (permalink / raw)
  To: Shuah Khan, linux-kselftest
  Cc: Björn Töpel, linux-kernel, linux-riscv, Alexey Dobriyan,
	linux-fsdevel, Anders Roxell

Björn Töpel <bjorn@kernel.org> writes:

> From: Björn Töpel <bjorn@rivosinc.com>
>
> When you're cross-building kselftest, in this case RISC-V:
>
>   | make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- O=/tmp/kselftest \
>   |   HOSTCC=gcc FORMAT= SKIP_TARGETS="arm64 ia64 powerpc sparc64 x86 \
>   |   sgx" -C tools/testing/selftests gen_tar
>
> the components (paths) that fail to build are skipped. In this case,
> openat2 failed due to missing library support, and proc due to an
> x86-64 only test.
>
> This tiny series addresses the problems above.

Shuah,

Alexey submitted a series [1] that makes the 2nd patch of this series
unnecessary . It's on Andrew's -mm tree.

Patch 1 is still relevant. I guess it can go via your tree, or the
RISC-V tree.


Björn

[1] https://lore.kernel.org/all/20230630183434.17434-2-adobriyan@gmail.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-03  6:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-29 16:22 [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel
2023-06-29 16:22 ` [PATCH 1/2] selftests/openat2: Run-time check for -fsanitize=undefined Björn Töpel
2023-06-29 16:23 ` [PATCH 2/2] selftests/proc: Do not build x86-64 tests on non-x86-64 builds Björn Töpel
2023-06-29 19:42   ` Alexey Dobriyan
2023-06-30 10:27     ` Björn Töpel
2023-07-03  6:36 ` [PATCH 0/2] Two cross-compilation kselftest fixes Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).