linux-nfs / nfsd

Linux kernel source tree
Other
0 stars 0 forks source link

Testing for the nfsd and sunrpc tracing subsystems #75

Open chucklever opened 4 months ago

chucklever commented 4 months ago

Occasionally a newly-added trace point will trigger a segfault.

chucklever commented 3 months ago

I asked Steven Rostedt for his thoughts on this:

Is there a test suite we should run regularly to build some confidence in the kernel's observability apparatus? We're building a menagerie of tests around kdevops, and one area where we know there is a testing gap is the tracepoints in NFSD and SunRPC.

I try to add self tests within the macros. As assign_str() is going to turn into just __assign_str(field) (instead of assign_str(field, src)), I added a test to make sure what was passed to string() is also what assign_str() gets.

There's checks in the tracepoint code as well for things like referencing a pointer that was not saved in the event, and other things. But a generic test on a custom trace event, I don't really have.

Note, you could enable CONFIG_TRACE_EVENT_INJECT where an "inject" file is created, and you can write into it:

# cd /sys/kernel/tracing
# echo 1 > events/rpcgss/rpcgss_context/enable
# echo 'expiry=123456 now=222' > events/rpcgss/rpcgss_context/inject
# cat trace
bash-843     [001] .....   720.083189: rpcgss_context: win_size=0 expiry=123456 now=222 timeout=0 acceptor=

And you could use that for testing.