public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] Simplify build for tests and a gitignore cleanup
@ 2022-04-03 15:38 Ammar Faizi
  2022-04-03 15:38 ` [PATCH liburing 1/2] test/Makefile: Append -lpthread for all tests Ammar Faizi
  2022-04-03 15:38 ` [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename Ammar Faizi
  0 siblings, 2 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-03 15:38 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Ammar Faizi, io-uring Mailing List, GNU/Weeb Mailing List

Hi Jens,

Two patches in this series:

  - Append -lpthread for all tests and remove the LDFLAGS override
    for tests that use pthread.

  - Another patch to append `.test` to the test binary filename for
    gitignore simplification after my first try at [1].

[1]: https://lore.kernel.org/io-uring/[email protected]

Signed-off-by: Ammar Faizi <[email protected]>
---

Ammar Faizi (2):
  test/Makefile: Append -lpthread for all tests
  test/Makefile: Append `.test` to the test binary filename

 .gitignore    | 132 +-------------------------------------------------
 test/Makefile |  33 +++----------
 2 files changed, 7 insertions(+), 158 deletions(-)


base-commit: c0a2850e7192edbf3679265db20e2fb2a828e830
-- 
Ammar Faizi


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH liburing 1/2] test/Makefile: Append -lpthread for all tests
  2022-04-03 15:38 [PATCH liburing 0/2] Simplify build for tests and a gitignore cleanup Ammar Faizi
@ 2022-04-03 15:38 ` Ammar Faizi
  2022-04-03 15:38 ` [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename Ammar Faizi
  1 sibling, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-03 15:38 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Ammar Faizi, io-uring Mailing List, GNU/Weeb Mailing List

Instead of overriding LDFLAGS one by one for tests that need pthread,
append -lpthread to LDFLAGS for all tests. This makes the Makefile
script simpler. It also saves some hassle when we add a new test
that does use pthread.

Signed-off-by: Ammar Faizi <[email protected]>
---
 test/Makefile | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 1526776..e43738f 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -31,7 +31,7 @@ override CFLAGS += $(XCFLAGS) -DLIBURING_BUILD_TEST
 override CXXFLAGS += $(XCFLAGS) -std=c++11 -DLIBURING_BUILD_TEST
 
 LDFLAGS ?=
-override LDFLAGS += -L../src/ -luring
+override LDFLAGS += -L../src/ -luring -lpthread
 
 test_srcs := \
 	232c93d07b74-test.c \
@@ -210,29 +210,6 @@ helpers.o: helpers.c
 %: %.cc $(helpers) helpers.h ../src/liburing.a
 	$(QUIET_CXX)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
 
-
-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
-
 install: $(test_targets) runtests.sh runtests-loop.sh
 	$(INSTALL) -D -d -m 755 $(datadir)/liburing-test/
 	$(INSTALL) -D -m 755 $(test_targets) $(datadir)/liburing-test/
-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename
  2022-04-03 15:38 [PATCH liburing 0/2] Simplify build for tests and a gitignore cleanup Ammar Faizi
  2022-04-03 15:38 ` [PATCH liburing 1/2] test/Makefile: Append -lpthread for all tests Ammar Faizi
@ 2022-04-03 15:38 ` Ammar Faizi
  2022-04-03 16:43   ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Ammar Faizi @ 2022-04-03 15:38 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Ammar Faizi, io-uring Mailing List, GNU/Weeb Mailing List

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.

Goals:
  - Make the .gitignore simpler.
  - Avoid the burden of adding a new test to .gitignore.

Signed-off-by: Ammar Faizi <[email protected]>
---
 .gitignore    | 132 +-------------------------------------------------
 test/Makefile |   8 +--
 2 files changed, 6 insertions(+), 134 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4a6e585..0b0add0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,137 +15,7 @@
 /examples/io_uring-test
 /examples/link-cp
 /examples/ucontext-cp
-
-/test/232c93d07b74-test
-/test/35fa71a030ca-test
-/test/500f9fbadef8-test
-/test/7ad0e4b2f83c-test
-/test/8a9973408177-test
-/test/917257daa0fe-test
-/test/a0908ae19763-test
-/test/a4c0b3decb33-test
-/test/accept
-/test/accept-link
-/test/accept-reuse
-/test/accept-test
-/test/across-fork
-/test/b19062a56726-test
-/test/b5837bd5311d-test
-/test/ce593a6c480a-test
-/test/close-opath
-/test/config.local
-/test/connect
-/test/cq-full
-/test/cq-overflow
-/test/cq-overflow-peek
-/test/cq-peek-batch
-/test/cq-ready
-/test/cq-size
-/test/d4ae271dfaae-test
-/test/d77a67ed5f27-test
-/test/defer
-/test/double-poll-crash
-/test/drop-submit
-/test/eeed8b54e0df-test
-/test/empty-eownerdead
-/test/eventfd
-/test/eventfd-disable
-/test/eventfd-reg
-/test/eventfd-ring
-/test/exit-no-cleanup
-/test/fadvise
-/test/fallocate
-/test/fc2a85cb02ef-test
-/test/file-register
-/test/file-update
-/test/file-verify
-/test/files-exit-hang-poll
-/test/files-exit-hang-timeout
-/test/fixed-buf-iter
-/test/fixed-link
-/test/fixed-reuse
-/test/fpos
-/test/fsync
-/test/hardlink
-/test/io-cancel
-/test/io_uring_enter
-/test/io_uring_register
-/test/io_uring_setup
-/test/iopoll
-/test/lfs-openat
-/test/lfs-openat-write
-/test/link
-/test/link-timeout
-/test/link_drain
-/test/madvise
-/test/mkdir
-/test/msg-ring
-/test/nop
-/test/nop-all-sizes
-/test/open-close
-/test/open-direct-link
-/test/openat2
-/test/personality
-/test/pipe-eof
-/test/pipe-reuse
-/test/poll
-/test/poll-cancel
-/test/poll-cancel-ton
-/test/poll-link
-/test/poll-many
-/test/poll-ring
-/test/poll-v-poll
-/test/pollfree
-/test/probe
-/test/read-write
-/test/recv-msgall
-/test/recv-msgall-stream
-/test/register-restrictions
-/test/rename
-/test/ring-leak
-/test/ring-leak2
-/test/self
-/test/send_recv
-/test/send_recvmsg
-/test/sendmsg_fs_cve
-/test/shared-wq
-/test/short-read
-/test/shutdown
-/test/sigfd-deadlock
-/test/socket-rw
-/test/socket-rw-eagain
-/test/socket-rw-offset
-/test/splice
-/test/sq-full
-/test/sq-full-cpp
-/test/sq-poll-dup
-/test/sq-poll-kthread
-/test/sq-poll-share
-/test/sqpoll-disable-exit
-/test/sqpoll-exit-hang
-/test/sqpoll-sleep
-/test/sq-space_left
-/test/statx
-/test/stdout
-/test/submit-reuse
-/test/symlink
-/test/teardowns
-/test/thread-exit
-/test/timeout
-/test/timeout-new
-/test/timeout-overflow
-/test/tty-write-dpoll
-/test/unlink
-/test/wakeup-hang
-/test/multicqes_drain
-/test/poll-mshot-update
-/test/rsrc_tags
-/test/rw_merge_test
-/test/sqpoll-cancel-hang
-/test/testfile
-/test/submit-link-fail
-/test/exec-target
-/test/skip-cqe
+/test/*.test
 /test/*.dmesg
 /test/output/
 
diff --git a/test/Makefile b/test/Makefile
index e43738f..f62740e 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -183,7 +183,9 @@ endif
 all_targets += sq-full-cpp
 
 
-test_targets := $(patsubst %.c,%,$(patsubst %.cc,%,$(test_srcs)))
+test_targets := $(patsubst %.c,%,$(test_srcs))
+test_targets := $(patsubst %.cc,%,$(test_targets))
+test_targets := $(patsubst %,%.test,$(test_targets))
 all_targets += $(test_targets)
 
 #
@@ -204,10 +206,10 @@ all: $(test_targets)
 helpers.o: helpers.c
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 
-%: %.c $(helpers) helpers.h ../src/liburing.a
+%.test: %.c $(helpers) helpers.h ../src/liburing.a
 	$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
 
-%: %.cc $(helpers) helpers.h ../src/liburing.a
+%.test: %.cc $(helpers) helpers.h ../src/liburing.a
 	$(QUIET_CXX)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(helpers) $(LDFLAGS)
 
 install: $(test_targets) runtests.sh runtests-loop.sh
-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename
  2022-04-03 15:38 ` [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename Ammar Faizi
@ 2022-04-03 16:43   ` Jens Axboe
  2022-04-03 17:21     ` Ammar Faizi
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2022-04-03 16:43 UTC (permalink / raw)
  To: Ammar Faizi; +Cc: io-uring Mailing List, GNU/Weeb Mailing List

On 4/3/22 9:38 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.
> 
> Goals:
>   - Make the .gitignore simpler.
>   - Avoid the burden of adding a new test to .gitignore.

Just a cosmetic issue, but the .test does bother me a bit. Probably just
because we aren't used to it. Maybe let's just call them .t? And we
should probably rename the foo-test.c cases to just foo.c as a prep patch
too.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename
  2022-04-03 16:43   ` Jens Axboe
@ 2022-04-03 17:21     ` Ammar Faizi
  0 siblings, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2022-04-03 17:21 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring Mailing List, GNU/Weeb Mailing List

On 4/3/22 11:43 PM, Jens Axboe wrote:
> On 4/3/22 9:38 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.
>>
>> Goals:
>>    - Make the .gitignore simpler.
>>    - Avoid the burden of adding a new test to .gitignore.
> 
> Just a cosmetic issue, but the .test does bother me a bit. Probably just
> because we aren't used to it. Maybe let's just call them .t? And we
> should probably rename the foo-test.c cases to just foo.c as a prep patch
> too.

Yes, I agree. Will do it in the next version.

-- 
Ammar Faizi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-03 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-03 15:38 [PATCH liburing 0/2] Simplify build for tests and a gitignore cleanup Ammar Faizi
2022-04-03 15:38 ` [PATCH liburing 1/2] test/Makefile: Append -lpthread for all tests Ammar Faizi
2022-04-03 15:38 ` [PATCH liburing 2/2] test/Makefile: Append `.test` to the test binary filename Ammar Faizi
2022-04-03 16:43   ` Jens Axboe
2022-04-03 17:21     ` Ammar Faizi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox