On 03/06/2026 12:10 pm, Leo Yan wrote:
On Tue, Jun 02, 2026 at 03:26:46PM +0100, James Clark wrote:
[...]
+check_samples() {
- owner_samples=$(grep -c "proc1.*context_switch_loop_proc1" "$tmpdir/script" || true)
- next_samples=$(grep -c "proc2.*context_switch_loop_proc2" "$tmpdir/script" || true)
- if [ "$owner_samples" -eq 0 ] || [ "$next_samples" -eq 0 ]; then
echo "No samples found"cleanupWe don't need cleanup explictly here, as trap covers exit case?
We need it whenever we call exit because it removes the trap which would trap and return with its own (potentially different) exit value.
The alternative is a global $err which you set and then call exit without a value and let cleanup() do exit $err. But from searching the existing shell tests calling cleanup before exit seemed to be more common so I did it that way.
exit 1- fi
- if grep "proc2.*context_switch_loop_proc1" "$tmpdir/script"; then
echo "Thread1 symbol was attributed to proc2"cleanupDitto.
exit 1- fi
- if grep "proc1.*context_switch_loop_proc2" "$tmpdir/script"; then
echo "Thread2 symbol was attributed to proc1"cleanupDitto.
Otherwise:
Reviewed-by: Leo Yan leo.yan@arm.com