Re: [PATCH liburing v1 2/2] test/Makefile: Append `.test` to the test binary filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/3/22 9:05 AM, Ammar Faizi wrote:
> On 4/3/22 10:00 PM, Jens Axboe wrote:
>> On 4/3/22 8:55 AM, Ammar Faizi wrote:
>>> On 4/3/22 9:51 PM, Jens Axboe wrote:
>>>> On 4/3/22 3:56 AM, Ammar Faizi wrote:
>>>>> When adding a new test, we often forget to add the new test binary to
>>>>> `.gitignore`. Append `.test` to the test binary filename, this way we
>>>>> can use a wildcard matching "test/*.test" in `.gitignore` to ignore all
>>>>> test binary files.
>>>>
>>>> Did you build it?
>>>>
>>>>        CC 917257daa0fe-test.test
>>>> /usr/bin/ld: /tmp/ccGrhiuN.o: in function `thread_start':
>>>> /home/axboe/git/liburing/test/35fa71a030ca-test.c:52: undefined reference to `pthread_attr_setstacksize'
>>>> /usr/bin/ld: /home/axboe/git/liburing/test/35fa71a030ca-test.c:55: undefined reference to `pthread_create'
>>>>        CC a0908ae19763-test.test
>>>> collect2: error: ld returned 1 exit status
>>>> make[1]: *** [Makefile:210: 35fa71a030ca-test.test] Error 1
>>>> make[1]: *** Waiting for unfinished jobs....
>>>> /usr/bin/ld: /tmp/cc2nozDW.o: in function `main':
>>>> /home/axboe/git/liburing/test/232c93d07b74-test.c:295: undefined reference to `pthread_create'
>>>> /usr/bin/ld: /home/axboe/git/liburing/test/232c93d07b74-test.c:296: undefined reference to `pthread_create'
>>>> /usr/bin/ld: /home/axboe/git/liburing/test/232c93d07b74-test.c:297: undefined reference to `pthread_join'
>>>> /usr/bin/ld: /home/axboe/git/liburing/test/232c93d07b74-test.c:298: undefined reference to `pthread_join'
>>>> collect2: error: ld returned 1 exit status
>>>> make[1]: *** [Makefile:210: 232c93d07b74-test.test] Error 1
>>>> make[1]: Leaving directory '/home/axboe/git/liburing/test'
>>>>
>>>> I do like the idea of not having to keep fixing that gitignore list.
>>>
>>> Hmm.. weird... It builds just fine from my end.
>>> Can you show the full commands?
>>
>> Sure, here it is:
>>
>> axboe@m1 ~/gi/liburing (master)> make V=1                                    0.011s
> 
> OK, it now makes sense to me.
> 
> These pthread stuff are appended for the test binary files without "*.test" suffix.
> 
> 35fa71a030ca-test: override LDFLAGS += -lpthread
> 232c93d07b74-test: override LDFLAGS += -lpthread
> send_recv: override LDFLAGS += -lpthread
> send_recvmsg: override LDFLAGS += -lpthread
> poll-link: override LDFLAGS += -lpthread
> accept-link: override LDFLAGS += -lpthread
> submit-reuse: override LDFLAGS += -lpthread
> poll-v-poll: override LDFLAGS += -lpthread
> across-fork: override LDFLAGS += -lpthread
> ce593a6c480a-test: override LDFLAGS += -lpthread
> wakeup-hang: override LDFLAGS += -lpthread
> pipe-eof: override LDFLAGS += -lpthread
> timeout-new: override LDFLAGS += -lpthread
> thread-exit: override LDFLAGS += -lpthread
> ring-leak2: override LDFLAGS += -lpthread
> poll-mshot-update: override LDFLAGS += -lpthread
> exit-no-cleanup: override LDFLAGS += -lpthread
> pollfree: override LDFLAGS += -lpthread
> msg-ring: override LDFLAGS += -lpthread
> recv-msgall: override LDFLAGS += -lpthread
> recv-msgall-stream: override LDFLAGS += -lpthread
> 
> I don't know why my linker doesn't complain about that.
> 
> What about appending -lpthread to all tests and remove all of these
> override stuff? Are you okay with that?
> 
> Or do you prefer to append -lpthread for only test that needs pthread?

Nah I think that's fine, also saves some hassle when you add a new test
that does use pthread.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux