Re: [PATCH 3/5] test: Fix some ustackdepth tests
Kris Van Hees <[email protected]>
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Oct 01, 2025 at 02:24:16AM -0400, [email protected] wrote: > From: Eugene Loh <[email protected]> > > Fix these issues. > > Issue 1. > > In commit e48bf6a23 ("Add support for built-in variable ustackdepth"), > tests ustackdepth2 and ustackdepth_big were introduced and their .r and > .r.p files were links to those of the stackdepth2 test. > > In commit 842eabc0e > ("test: caller and stackdepth tests for fbt provider"), the stackdepth2 > test was explicitly renamed "fbt" since tests for many providers were > being introduced. The links of the earlier patch were not updated. > > Issue 2. > > The ustackdepth_big test modified perf_event_max_stack. If the test > were interrupted, the value was not restored. > > Issue 3. > > That ustackdepth_big test only checked that the stackdepth was > consistent with the reported stack. While this check is good, it missed > the point of the test, which is that the system limit could be > increased. > > Signed-off-by: Eugene Loh <[email protected]> Reviewed-by: Kris Van Hees <[email protected]> > --- > .../variables/bvar/tst.ustackdepth2.r | 2 +- > .../variables/bvar/tst.ustackdepth2.r.p | 2 +- > .../variables/bvar/tst.ustackdepth_big.r | 1 - > .../variables/bvar/tst.ustackdepth_big.r.p | 1 - > .../variables/bvar/tst.ustackdepth_big.sh | 34 +++++++++++++++++-- > 5 files changed, 34 insertions(+), 6 deletions(-) > mode change 120000 => 100644 test/unittest/variables/bvar/tst.ustackdepth2.r > delete mode 120000 test/unittest/variables/bvar/tst.ustackdepth_big.r > delete mode 120000 test/unittest/variables/bvar/tst.ustackdepth_big.r.p > > diff --git a/test/unittest/variables/bvar/tst.ustackdepth2.r b/test/unittest/variables/bvar/tst.ustackdepth2.r > deleted file mode 120000 > index 5cc8498f8..000000000 > --- a/test/unittest/variables/bvar/tst.ustackdepth2.r > +++ /dev/null > @@ -1 +0,0 @@ > -tst.stackdepth2.r > \ No newline at end of file > diff --git a/test/unittest/variables/bvar/tst.ustackdepth2.r b/test/unittest/variables/bvar/tst.ustackdepth2.r > new file mode 100644 > index 000000000..3bd29b8ed > --- /dev/null > +++ b/test/unittest/variables/bvar/tst.ustackdepth2.r > @@ -0,0 +1 @@ > +Stack depth OK > diff --git a/test/unittest/variables/bvar/tst.ustackdepth2.r.p b/test/unittest/variables/bvar/tst.ustackdepth2.r.p > index 8320b603c..e50f12822 120000 > --- a/test/unittest/variables/bvar/tst.ustackdepth2.r.p > +++ b/test/unittest/variables/bvar/tst.ustackdepth2.r.p > @@ -1 +1 @@ > -tst.stackdepth2.r.p > \ No newline at end of file > +check_stackdepth_to_stack.awk > \ No newline at end of file > diff --git a/test/unittest/variables/bvar/tst.ustackdepth_big.r b/test/unittest/variables/bvar/tst.ustackdepth_big.r > deleted file mode 120000 > index b6a2d6bcd..000000000 > --- a/test/unittest/variables/bvar/tst.ustackdepth_big.r > +++ /dev/null > @@ -1 +0,0 @@ > -tst.ustackdepth2.r > \ No newline at end of file > diff --git a/test/unittest/variables/bvar/tst.ustackdepth_big.r.p b/test/unittest/variables/bvar/tst.ustackdepth_big.r.p > deleted file mode 120000 > index 0e8338907..000000000 > --- a/test/unittest/variables/bvar/tst.ustackdepth_big.r.p > +++ /dev/null > @@ -1 +0,0 @@ > -tst.ustackdepth2.r.p > \ No newline at end of file > diff --git a/test/unittest/variables/bvar/tst.ustackdepth_big.sh b/test/unittest/variables/bvar/tst.ustackdepth_big.sh > index 777940ec8..e84850c02 100755 > --- a/test/unittest/variables/bvar/tst.ustackdepth_big.sh > +++ b/test/unittest/variables/bvar/tst.ustackdepth_big.sh > @@ -14,11 +14,19 @@ > > dtrace=$1 > > +POSTPROC=$PWD/test/unittest/variables/bvar/check_stackdepth_to_stack.awk > +TRIGGER=$PWD/test/triggers/ustack-tst-bigstack-spin > + > +DIRNAME=$tmpdir/ustackdepth_big.$$.$RANDOM > +mkdir -p $DIRNAME > +cd $DIRNAME > + > orig_maxstack=`sysctl -n kernel.perf_event_max_stack` > echo kernel.perf_event_max_stack was $orig_maxstack > +trap "sysctl kernel.perf_event_max_stack=$orig_maxstack" QUIT EXIT > sysctl kernel.perf_event_max_stack=200 > > -$dtrace $dt_flags -c test/triggers/ustack-tst-bigstack-spin -qn ' > +$dtrace $dt_flags -c $TRIGGER -qn ' > profile-1 > /pid == $target/ > { > @@ -32,7 +40,7 @@ ERROR > { > exit(1); > } > -' > +' > D.out > if [ $? -ne 0 ]; then > echo DTrace failure > exit 1 > @@ -41,4 +49,26 @@ fi > sleep 2 > sysctl kernel.perf_event_max_stack=$orig_maxstack > > +$POSTPROC D.out > awk.out > +if [ $? -ne 0 ]; then > + echo post processing failure > + exit 1 > +fi > + > +if echo "Stack depth OK" | diff -q - awk.out; then > + mydepth=`gawk '/DEPTH/ { print $2 }' D.out` > + if [ $mydepth -gt $orig_maxstack ]; then > + echo success depth $mydepth exceeded original limit $orig_maxstack > + exit 0 > + else > + echo ERROR: $mydepth does not exceed original limit $orig_maxstack > + cat D.out > + exit 1 > + fi > +else > + echo "ERROR: stack depth does not match stack" > + cat D.out > + exit 1 > +fi > + > exit 0 > -- > 2.47.3 >