selftests: introduce additional eventfd test coverage
authorWen Yang <wen.yang@linux.dev>
Mon, 27 May 2024 00:02:00 +0000 (08:02 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 25 Jun 2024 05:25:04 +0000 (22:25 -0700)
commit87beb66918f83700c8cfe8309b64b80dc48c6ef5
tree052ba810beeb952551274d889215ee40f08cae05
parent51d821654be4286b005ad2b7dc8b973d5008a2ec
selftests: introduce additional eventfd test coverage

Add several new test cases which assert corner cases on the eventfd
mechanism, for example, the supplied buffer is less than 8 bytes,
attempting to write a value that is too large, etc.

./eventfd_test
# Starting 9 tests from 1 test cases.
#  RUN           global.eventfd_check_flag_rdwr ...
#            OK  global.eventfd_check_flag_rdwr
ok 1 global.eventfd_check_flag_rdwr
#  RUN           global.eventfd_check_flag_cloexec ...
#            OK  global.eventfd_check_flag_cloexec
ok 2 global.eventfd_check_flag_cloexec
#  RUN           global.eventfd_check_flag_nonblock ...
#            OK  global.eventfd_check_flag_nonblock
ok 3 global.eventfd_check_flag_nonblock
#  RUN           global.eventfd_chek_flag_cloexec_and_nonblock ...
#            OK  global.eventfd_chek_flag_cloexec_and_nonblock
ok 4 global.eventfd_chek_flag_cloexec_and_nonblock
#  RUN           global.eventfd_check_flag_semaphore ...
#            OK  global.eventfd_check_flag_semaphore
ok 5 global.eventfd_check_flag_semaphore
#  RUN           global.eventfd_check_write ...
#            OK  global.eventfd_check_write
ok 6 global.eventfd_check_write
#  RUN           global.eventfd_check_read ...
#            OK  global.eventfd_check_read
ok 7 global.eventfd_check_read
#  RUN           global.eventfd_check_read_with_nonsemaphore ...
#            OK  global.eventfd_check_read_with_nonsemaphore
ok 8 global.eventfd_check_read_with_nonsemaphore
#  RUN           global.eventfd_check_read_with_semaphore ...
#            OK  global.eventfd_check_read_with_semaphore
ok 9 global.eventfd_check_read_with_semaphore
# PASSED: 9 / 9 tests passed.
# Totals: pass:9 fail:0 xfail:0 xpass:0 skip:0 error:0

Link: https://lkml.kernel.org/r/20240527000200.5615-1-wen.yang@linux.dev
Signed-off-by: Wen Yang <wen.yang@linux.dev>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Andrei Vagin <avagin@google.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Dave Young <dyoung@redhat.com>
Cc: Tim Bird <tim.bird@sony.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/filesystems/eventfd/eventfd_test.c