File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33# To be run inside the profiling container
44
5+ # Clear any stale marker from a previous run
6+ rm -f /etc/prof-results/.profiling_complete
7+
58# Load proto_load config to get packet settings
69source /etc/freeradius/proto_load_config.env
710
@@ -30,14 +33,20 @@ until grep -q "Ready to process requests" /tmp/fr.log; do
3033 sleep 0.1
3134done
3235
33- FR_PID=$( pgrep -f " freeradius -f" )
34-
35- # Enable instrumentation at packet processing start
36- callgrind_control --instr=on ${FR_PID}
36+ # Enable instrumentation. callgrind_control auto-detects the running callgrind
37+ # instance and prints "PID <n>: freeradius ..." — capture that to get the PID
38+ # we need later for the graceful shutdown signal.
39+ CTRL_OUT=$( callgrind_control --instr=on)
40+ printf ' %s\n' " $CTRL_OUT "
41+ FR_PID=$( printf ' %s\n' " $CTRL_OUT " | grep -oP ' PID \K\d+(?=: freeradius)' | head -1)
42+ echo " Freeradius PID: ${FR_PID} "
3743
3844# Wait for approximate send duration
3945sleep ${SEND_DURATION}
4046
4147# Graceful shutdown (equivalent to Ctrl+C)
4248kill -SIGINT ${FR_PID}
4349wait
50+
51+ # Signal that valgrind has finished writing all profiling data
52+ touch /etc/prof-results/.profiling_complete
Original file line number Diff line number Diff line change @@ -13,5 +13,6 @@ loadgen:
1313 repeat : " no"
1414
1515# Test framework
16- test_timeout : 80
17- test_verify_timeout : 70
16+ test_timeout : 165
17+ test_state1_verify_timeout : 130
18+ test_state2_verify_timeout : 5
Original file line number Diff line number Diff line change @@ -48,8 +48,14 @@ states:
4848 source /etc/freeradius/start_valgrind_profiling.sh
4949
5050 detach: true
51+ - execute_command:
52+ command: |
53+ # Block until valgrind finishes writing all profiling data.
54+ # start_valgrind_profiling.sh touches this file after `wait` returns.
55+ until [ -f /etc/prof-results/.profiling_complete ]; do sleep 5; done
56+ rm -f /etc/prof-results/.profiling_complete
5157 verify:
52- timeout: {{ test_verify_timeout }}
58+ timeout: {{ test_state1_verify_timeout }}
5359 trigger_mode: unordered
5460 state_2:
5561 description: >
@@ -63,5 +69,5 @@ states:
6369 #cd /etc/prof-results
6470 #callgrind_annotate $(find . -name "callgrind.out.*" -size +0c | sort) > callgrind_report.txt
6571 verify:
66- timeout: 5
72+ timeout: {{ test_state2_verify_timeout }}
6773 trigger_mode: unordered
You can’t perform that action at this time.
0 commit comments