]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: fix header dependency for pid_namespace selftests
authorAxel Rasmussen <axelrasmussen@google.com>
Thu, 24 Mar 2022 22:39:28 +0000 (15:39 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 4 Apr 2022 19:32:31 +0000 (13:32 -0600)
commitfac1781c630eacf918a7b1c7d960d3dab9c17ff9
tree64c3e5e300e8b67cfcdf532846f58f082a97b150
parenta9d5ede0d9ac0ea8f93d68be6e3a01d2ac364c55
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 <axelrasmussen@google.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/pid_namespace/Makefile