]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests/*stackprof*: elim flakiness, fix stackprof-subr.sh returns, no debuginfod
authorSerhei Makarov <serhei@serhei.io>
Mon, 22 Jun 2026 18:45:08 +0000 (14:45 -0400)
committerSerhei Makarov <serhei@serhei.io>
Mon, 22 Jun 2026 18:45:08 +0000 (14:45 -0400)
tests/run-stackprof-system-gprof.sh
tests/stackprof-subr.sh

index 19e46d16fb66e05858fa386db7c037830a78e98a..3c19499df076b9ea9234c2e4873da877dbb5f08e 100755 (executable)
@@ -26,17 +26,17 @@ type timeout 2>/dev/null || (echo "no timeout installed"; exit 77)
 check_perf_event_open || (echo "perf_event_open fails (check kernel.perf_event_paranoid + kernel config)"; exit 77)
 expr `whoami` = "root" || (echo "not running as root"; exit 77)
 
-tempfiles test.out
-tempfiles gmon.*
+tempfiles test.out gmon.*
 
 # run systemwide scan, no gprof output
-testrun timeout -p -sINT 10 ${abs_top_builddir}/src/stackprof -v 2>&1 | tee test.out
+testrun timeout -p --kill-after=5 10 ${abs_top_builddir}/src/stackprof -v 2>&1 | tee test.out
 grep "^perf_event_attr configuration" test.out
 grep "Starting stack profile collection systemwide" test.out
 grep -E "^[0-9]+ " test.out # -- pid / sample counts entries
 
 # run systemwide scan again, with gprof output
-testrun timeout -p -sINT 10 ${abs_top_builddir}/src/stackprof -v -g 2>&1 | tee test.out
+# reduce verbosity, bump post-processing timeout compared to the first run
+testrun timeout -p --kill-after=10 10 ${abs_top_builddir}/src/stackprof -g 2>&1 | tee test.out
 grep "^perf_event_attr configuration" test.out
 grep "Starting stack profile collection systemwide" test.out
 grep -E "^buildid [0-9a-f]+" test.out
@@ -45,6 +45,7 @@ stackprof_debuginfod_setup
 
 for f in gmon.*.out
 do
+    tempfiles "$exe" gprof_output.txt
     exe="`basename "$f" .out`.exe"
     if [ ! -f "$exe" ]; then
         buildid=`echo "$f" | cut -f2 -d.`
@@ -55,8 +56,6 @@ do
         ln -s "`${abs_top_builddir}/debuginfod/debuginfod-find executable $buildid`" "$exe"
     fi
     exe_info="$exe (`readlink $exe`)"
-    tempfiles "$exe"
-    tempfiles gprof_output.txt
     # try a plain gprof run on the executable
     if gprof "$exe" "$f" > gprof_output.txt 2>&1; then
         echo "$exe_info"
index a75a55d99304a8e1abf73ca1cd000c6f86f4e855..7d3bca973fc973066499182f92b2beb77232d5a6 100644 (file)
@@ -23,12 +23,14 @@ check_perf_event_open() {
     tempfiles perf-test.out
     if ! testrun timeout 2 ${abs_top_builddir}/src/stackprof -v -- /bin/true > perf-test.out 2>&1; then
         if grep -q "perf_event_open.*failed\|Operation note permitted\|Permission denied"; then
-            exit 77
+            return 77
         fi
     fi
+    return 0
 }
 
 stackprof_debuginfod_setup() {
     # TODO non networked version
-    export DEBUGINFOD_URLS=https://debuginfod.elfutils.org/
+    #export DEBUGINFOD_URLS=https://debuginfod.elfutils.org/
+    return 0
 }