Re: [PATCH] selftests: fix compile error for sync

From: Shuah Khan
Date: Tue Nov 07 2017 - 17:55:02 EST


On 11/06/2017 06:14 PM, lei yang wrote:
>
>
> On 2017å11æ07æ 07:35, Shuah Khan wrote:
>> On 11/05/2017 03:08 AM, Lei Yang wrote:
>>> I got below error message when building sync test:
>>>
>>> make[1]: Entering directory `tools/testing/selftests/sync'
>>> gcc -c sync.c -o tools/testing/selftests/sync/sync.o
>>> sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
>>> Â #include <linux/sync_file.h>
>>>
>>> obviously, CFLAGS and LDFLAGS are not used when comipling.
>>>
>>> Signed-off-by: Lei Yang <Lei.Yang@xxxxxxxxxxxxx>
>>> ---
>>> Â tools/testing/selftests/sync/Makefile | 4 ++--
>>> Â 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile
>>> index 8e04d0a..46cbcc3 100644
>>> --- a/tools/testing/selftests/sync/Makefile
>>> +++ b/tools/testing/selftests/sync/Makefile
>>> @@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
>>> ÂÂÂÂÂ $(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
>>> Â Â $(OBJS): $(OUTPUT)/%.o: %.c
>>> -ÂÂÂ $(CC) -c $^ -o $@
>>> +ÂÂÂ $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
>>> Â Â $(TESTS): $(OUTPUT)/%.o: %.c
>>> -ÂÂÂ $(CC) -c $^ -o $@
>>> +ÂÂÂ $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
>>> Â Â EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)
>>>
>> How are you building the test? I am not seeing the error on linux-4.14.0-rc8
>
> make -C tools/testing/selftests
>
> Lei
>
>

Based on the information in your other emails, looks like you are
testing these patches on

$ cat /proc/version
Linux version 3.16.0-30-generic (buildd@kissel) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015

That explains why you aren't finding sync_file.h header. This test isn't applicable
to Linux 3.16. In any case, I can't take patches that aren't tested on the latest
kernel release. 3.16 is very old.

thanks,
-- Shuah