[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADYN=9JM1nnjC9LypHqrz7JJjbZLpm8rArDUy4zgYYrajErBnA@mail.gmail.com>
Date: Sat, 13 Aug 2022 12:01:12 +0200
From: Anders Roxell <anders.roxell@...aro.org>
To: Guillaume Tucker <guillaume.tucker@...labora.com>
Cc: Guillaume <guillaume.tucker@...il.com>,
Shuah Khan <shuah@...nel.org>,
Mickaël Salaün <mic@...ikod.net>,
Tim.Bird@...y.com, kernel@...labora.com,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: Re: [PATCH] selftests/landlock: fix broken include of linux/landlock.h
On Wed, 3 Aug 2022 at 22:14, Guillaume Tucker
<guillaume.tucker@...labora.com> wrote:
>
> Revert part of the earlier changes to fix the kselftest build when
> using a sub-directory from the top of the tree as this broke the
> landlock test build as a side-effect when building with "make -C
> tools/testing/selftests/landlock".
>
> Reported-by: Mickaël Salaün <mic@...ikod.net>
> Fixes: a917dd94b832 ("selftests/landlock: drop deprecated headers dependency")
> Fixes: f2745dc0ba3d ("selftests: stop using KSFT_KHDR_INSTALL")
> Signed-off-by: Guillaume Tucker <guillaume.tucker@...labora.com>
Building with this patch doesn't work, it gives this output:
make[3]: Entering directory
'/home/anders/src/kernel/next/tools/testing/selftests/landlock'
make[3]: Leaving directory
'/home/anders/src/kernel/next/tools/testing/selftests/landlock'
make[3]: *** No rule to make target
'/home/anders/.cache/tuxmake/builds/78/build/kselftest/landlock/base_test',
needed by 'all'. Stop.
I'm building like this:
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12
--kconfig defconfig kselftest
which translates into this make command:
make --silent --keep-going --jobs=32
O=/home/anders/.cache/tuxmake/builds/78/build
INSTALL_PATH=/home/anders/.cache/tuxmake/builds/78/build/kselftest_install
ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- kselftest-install
building without this patch works, see below:
make[3]: Entering directory
'/home/anders/src/kernel/next/tools/testing/selftests/landlock'
x86_64-linux-gnu-gcc -Wall -O2 -isystem
/home/anders/.cache/tuxmake/builds/77/build/usr/include base_test.c
-o /home/anders/.cache/tuxmake/builds/77/build/kselftest/landlock/base_test
-lcap
x86_64-linux-gnu-gcc -Wall -O2 -isystem
/home/anders/.cache/tuxmake/builds/77/build/usr/include fs_test.c
-o /home/anders/.cache/tuxmake/builds/77/build/kselftest/landlock/fs_test
-lcap
x86_64-linux-gnu-gcc -Wall -O2 -isystem
/home/anders/.cache/tuxmake/builds/77/build/usr/include
ptrace_test.c -o
/home/anders/.cache/tuxmake/builds/77/build/kselftest/landlock/ptrace_test
-lcap
x86_64-linux-gnu-gcc -Wall -O2 -isystem
/home/anders/.cache/tuxmake/builds/77/build/usr/include true.c -o
/home/anders/.cache/tuxmake/builds/77/build/kselftest/landlock/true
-static
make[3]: Leaving directory
'/home/anders/src/kernel/next/tools/testing/selftests/landlock'
Cheers,
Anders
> ---
> tools/testing/selftests/landlock/Makefile | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/landlock/Makefile b/tools/testing/selftests/landlock/Makefile
> index a6959df28eb0..02868ac3bc71 100644
> --- a/tools/testing/selftests/landlock/Makefile
> +++ b/tools/testing/selftests/landlock/Makefile
> @@ -9,10 +9,13 @@ TEST_GEN_PROGS := $(src_test:.c=)
> TEST_GEN_PROGS_EXTENDED := true
>
> OVERRIDE_TARGETS := 1
> +top_srcdir := ../../../..
> include ../lib.mk
>
> +khdr_dir = $(top_srcdir)/usr/include
> +
> $(OUTPUT)/true: true.c
> $(LINK.c) $< $(LDLIBS) -o $@ -static
>
> -$(OUTPUT)/%_test: %_test.c ../kselftest_harness.h common.h
> - $(LINK.c) $< $(LDLIBS) -o $@ -lcap
> +$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h
> + $(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)
> --
> 2.30.2
>
Powered by blists - more mailing lists