Re: [PATCH v2 04/18] perf test cs-etm: Test process attribution

From: Leo Yan

Date: Wed Jun 03 2026 - 07:10:58 EST


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"
> + cleanup

We don't need cleanup explictly here, as trap covers exit case?

> + exit 1
> + fi
> +
> + if grep "proc2.*context_switch_loop_proc1" "$tmpdir/script"; then
> + echo "Thread1 symbol was attributed to proc2"
> + cleanup

Ditto.

> + exit 1
> + fi
> +
> + if grep "proc1.*context_switch_loop_proc2" "$tmpdir/script"; then
> + echo "Thread2 symbol was attributed to proc1"
> + cleanup

Ditto.

Otherwise:

Reviewed-by: Leo Yan <leo.yan@xxxxxxx>