Skip to content

Commit 5203562

Browse files
CmdrMoozyshuahkh
authored andcommitted
selftests: fix header dependency for pid_namespace selftests
The way the test target was defined before, when building with clang we get a command line like this: clang -Wall -Werror -g -I../../../../usr/include/ \ regression_enomem.c ../pidfd/pidfd.h -o regression_enomem This yields an error, because clang thinks we want to produce both a *.o file, as well as a precompiled header: clang: error: cannot specify -o when generating multiple output files gcc, for whatever reason, doesn't exhibit the same behavior which I suspect is why the problem wasn't noticed before. This can be fixed simply by using the LOCAL_HDRS infrastructure the selftests lib.mk provides. It does the right think and marks the target as depending on the header (so if the header changes, we rebuild), but it filters the header out of the compiler command line, so we don't get the error described above. Signed-off-by: Axel Rasmussen <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent aa8ce29 commit 5203562

File tree

1 file changed

+3
-3
lines changed
  • tools/testing/selftests/pid_namespace

1 file changed

+3
-3
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SPDX-License-Identifier: GPL-2.0
22
CFLAGS += -g -I../../../../usr/include/
33

4-
TEST_GEN_PROGS := regression_enomem
4+
TEST_GEN_PROGS = regression_enomem
55

6-
include ../lib.mk
6+
LOCAL_HDRS += $(selfdir)/pidfd/pidfd.h
77

8-
$(OUTPUT)/regression_enomem: regression_enomem.c ../pidfd/pidfd.h
8+
include ../lib.mk

0 commit comments

Comments
 (0)