> On 6/26/25, 3:49 AM, "Jan Kara" <jack@xxxxxxx <mailto:jack@xxxxxxx>> wrote: > On Tue 24-06-25 07:58:59, Amir Goldstein wrote: > > On Mon, Jun 23, 2025 at 9:45 PM Ibrahim Jirdeh <ibrahimjirdeh@xxxxxxxx <mailto:ibrahimjirdeh@xxxxxxxx>> wrote: > > > > > > This adds selftests which exercise generating / responding to > > > permission events. They requre root privileges since > > > ^^^^ require > > > FAN_CLASS_PRE_CONTENT requires it. > > > > > > Signed-off-by: Ibrahim Jirdeh <ibrahimjirdeh@xxxxxxxx <mailto:ibrahimjirdeh@xxxxxxxx>> > > > --- > > > tools/testing/selftests/Makefile | 1 + > > > .../selftests/filesystems/fanotify/.gitignore | 2 + > > > .../selftests/filesystems/fanotify/Makefile | 8 + > > > .../filesystems/fanotify/fanotify_perm_test.c | 386 ++++++++++++++++++ > > > 4 files changed, 397 insertions(+) > > > create mode 100644 tools/testing/selftests/filesystems/fanotify/.gitignore > > > create mode 100644 tools/testing/selftests/filesystems/fanotify/Makefile > > > create mode 100644 tools/testing/selftests/filesystems/fanotify/fanotify_perm_test.c > > > > > > > > > Hi Ibrahim, > > > > > As a general comment, I do not mind having diverse testing > > methods, but just wanted to make sure that you know that we > > usually write fanotify tests to new features in LTP. > > > > LTP vs. selftests have their pros and cons, but both bring value > > and add test coverage. > > selftests would not have been my first choice for this particular test, > > because it is so similar to tests already existing in LTP, e.g.: > > https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/fanotify/fanotify24.c <https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/fanotify/fanotify24.c> > > > Yeah, frankly I'd prefer to keep tests in one place unless there's a good > reason not to. As you write in this case we already have very similar tests > in LTP so adding a coverage for the new functionality there seems like a > no-brainer... > > > > but I suppose that testing the full functionality of event listener fd handover > > might be easier to implement with the selftest infrastructure. > > Anyway, I will not require you to use one test suite or the other if you have > > a preference. > > > If there's some functionality that's hard to test from LTP, we can consider > implementing that in kselftests but I'd like to hear those reasons first... I missed the existing tests present in LTP repo. Will resubmit the test cases for new functionality to that repo rather than adding them as selftests.