Re: git: c728c56c870a - main - kqueue tests: Add file and line info to some test failure output

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 14 Jul 2022 19:10:48 UTC
On 7/14/22 11:33 AM, John Baldwin wrote:
> On 5/24/22 5:18 PM, Mark Johnston wrote:
>> The branch main has been updated by markj:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=c728c56c870abe230e45cee5c477f0d890ebacef
>>
>> commit c728c56c870abe230e45cee5c477f0d890ebacef
>> Author:     Mark Johnston <markj@FreeBSD.org>
>> AuthorDate: 2022-05-25 00:14:20 +0000
>> Commit:     Mark Johnston <markj@FreeBSD.org>
>> CommitDate: 2022-05-25 00:14:20 +0000
>>
>>       kqueue tests: Add file and line info to some test failure output
>>       
>>       This brings us slightly closer to upstream and is useful when debugging
>>       test failures.
>>       
>>       MFC after:      2 weeks
>>       Sponsored by:   The FreeBSD Foundation
> 
> For some reason this has caused build errors with NO_CLEAN builds on pretty
> much every host I've tried to upgrade such as:
> 
> ld.lld: error: undefined symbol: test_no_kevents
>>>> referenced by read.c:169 (/usr/home/john/work/cheri/git/cheribsd/tests/sys/kqueue/libkqueue/read.c:169)
>>>>                read.o:(test_evfilt_read)
>>>> referenced by read.c:75 (/usr/home/john/work/cheri/git/cheribsd/tests/sys/kqueue/libkqueue/read.c:75)
>>>>                read.o:(test_evfilt_read)
>>>> referenced by read.c:137 (/usr/home/john/work/cheri/git/cheribsd/tests/sys/kqueue/libkqueue/read.c:137)
>>>>                read.o:(test_evfilt_read)
>>>> referenced 31 more times
>>>> did you mean: _test_no_kevents
>>>> defined in: main.o
> ld.lld: error: undefined symbol: kevent_cmp
>>>> referenced by read.c:72 (/usr/home/john/work/cheri/git/cheribsd/tests/sys/kqueue/libkqueue/read.c:72)
>>>>                read.o:(test_evfilt_read)
>>>> referenced by read.c:145 (/usr/home/john/work/cheri/git/cheribsd/tests/sys/kqueue/libkqueue/read.c:145)
>>>>                read.o:(test_evfilt_read)
>>>> referenced by read.c:193 (/usr/home/john/work/cheri/git/cheribsd/tests/sys/kqueue/libkqueue/read.c:193)
>>>>                read.o:(test_evfilt_read)
>>>> referenced 14 more times
>>>> did you mean: _kevent_cmp
>>>> defined in: main.o
> 
> It seems like read.o at least doesn't get rebuilt even though common.h
> changed.  I can see common.h listed in .depend.kqtest.read.o, but make
> doesn't think it needs to be rebuilt based on the timestamps in the
> object directory:
> 
> -rw-r--r--  1 john  src    131 Jun 27 10:27 .depend.kqtest
> -rw-r--r--  1 john  src   6201 Jun 27 16:28 .depend.kqtest.main.o
> -rw-r--r--  1 john  src   6201 Jun 27 16:28 .depend.kqtest.proc.o
> -rw-r--r--  1 john  src   6201 Jun 27 16:28 .depend.kqtest.read.o
> -rw-r--r--  1 john  src   6205 Jun 27 16:28 .depend.kqtest.signal.o
> -rw-r--r--  1 john  src   6203 Jun 27 16:28 .depend.kqtest.timer.o
> -rw-r--r--  1 john  src   6201 Jun 27 16:28 .depend.kqtest.user.o
> -rw-r--r--  1 john  src   6203 Jun 27 16:28 .depend.kqtest.vnode.o
> -rw-r--r--  1 john  src    136 Jul 14 10:40 .depend.kqueue_test
> -rw-r--r--  1 john  src   6201 Jul 14 10:40 .depend.kqueue_test.main.o
> -rw-r--r--  1 john  src   6203 Jul 14 10:40 .depend.kqueue_test.timer.o
> -rw-r--r--  1 john  src    117 Jun 27 10:27 Kyuafile
> -rwxr-xr-x  1 john  src  41256 Jul  6 10:42 kqtest
> -rwxr-xr-x  1 john  src  62248 Jul  6 10:42 kqtest.debug
> -rwxr-xr-x  1 john  src  63128 Jul  6 10:42 kqtest.full
> -rwxr-xr-x  1 john  src  36488 Jul  6 10:42 kqtest.stripped
> -rwxr-xr-x  1 john  src    386 Jun 27 10:27 kqueue_test
> -rw-r--r--  1 john  src  28560 Jul 14 10:40 main.o
> -rw-r--r--  1 john  src  17920 Jun 27 16:28 proc.o
> -rw-r--r--  1 john  src  17872 Jun 27 16:28 read.o
> -rw-r--r--  1 john  src  12568 Jun 27 16:28 signal.o
> -rw-r--r--  1 john  src  29888 Jul 14 10:40 timer.o
> -rw-r--r--  1 john  src  10784 Jun 27 16:28 user.o
> -rw-r--r--  1 john  src  18984 Jun 27 16:28 vnode.o
> 
> Oh, I think I see the problem.  kqueue_test went from being a shell
> script to being an executable in a later commit.  I guess that is
> a case that needs handling in depend-cleanup.sh.

After more head scratching, the issue is that make thinks read.o
is up to date because it is newer than read.c, and that when
building for kqueue_test it looks for .depend.kqueue_test.read.o
(which doesn't exist) and thus doesn't find the dependency on
common.h which was previously recorded in .depend.kqtest.read.o.

I have a patch for depend-cleanup.sh to deal with this at
https://reviews.freebsd.org/D35820

It does use 'stat' since it is checking a glob (for which you
can't use [ -e ]) but stat is available on both Linux and macOS
so I think that's ok.

-- 
John Baldwin