Re: [PATCH] tracing: selftests: Add testing a user string to filters

From: Steven Rostedt
Date: Fri Apr 18 2025 - 08:24:03 EST


On Fri, 18 Apr 2025 16:14:04 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:

> > +if [ -f events/syscalls/sys_enter_openat/filter ]; then
> > + echo "filename.ustring ~ \"*test.d*\"" > events/syscalls/sys_enter_openat/filter
>
> I think it is better to use a $TMPDIR for the test script,
> instead of reusing the $TEST_DIR. Since $TMPDIR has been
> introduced to be used for this purpose.
>
> DIRNAME=`basename $TMPDIR`
>
> echo "filename.ustring ~ \"\*$DIRNAME\*\"" > events/syscalls/sys_enter_openat/filter
>
> > + echo 1 > events/syscalls/sys_enter_openat/enable
> > + echo 1 > tracing_on
> > + ls /bin/sh
> > + nocnt=`grep openat trace | wc -l`
> > + ls $TEST_DIR
>
> and `ls $TMPDIR` ?
>
> Does that work?
>

Yeah I can do that instead.

My actual fear is that 'ls' may one day not call openat and the test fails.
But if that happens we can always update the test.

Thanks,

-- Steve