On Thu, Jun 26, 2025 at 8:53 PM Ibrahim Jirdeh <ibrahimjirdeh@xxxxxxxx> wrote: > > > 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. As I wrote in another reply, please see test fanotify25 that I forked from fanotify24 for testing new pre-content events API: https://github.com/amir73il/ltp/commits/fan_pre_content_fid/ I do not wish to fork a test for every new feature and config variant. I'd rather test all new features in a given release in the same test if they are related. Feel free to add FAN_REPORT_EVENT_ID testing to fanotify25 because I do not plan to leave the event->fd when reporting fid info unless I have to, and even if we do leave event->fd, you can use the test_variants iterator to run all test cases with and without FAN_REPORT_EVENT_ID instead of duplicating the test code. See this test variant expansion for example: a4377184c ("fanotify21: Test reporting fd open errors with FAN_REPORT_FD_ERROR") Thanks, Amir.