From nobody Thu Apr 2 17:13:12 2026 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDDE72D6407 for ; Wed, 11 Feb 2026 01:52:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770774780; cv=none; b=dMcdXdF90eDu3HRv06RBcXaeaFSdTv3p9bYnBG4u29rc8qcd33oQDN9GHohAyHqICAgWu6/0A0oVXquoyOj5o6SW2aED06znAD9DLaA3BiCoPN1a7zHY6ar7papl2ebXpg+LRVhvWUiGLqqGmTxYJdvQ88tHiseh63fYfXGFh1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770774780; c=relaxed/simple; bh=tQHrkngzVLUEqGsMf/7XWZpqU1lbr91is2l0EGQbIBI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=Wo6iezXsCbER9bB5YdUpMqOVrITWcv5IYT6DmMWp/1rxlKeVq8CH17/8Y8LvE+yizJskZlAGEfEajgtKIuI4K+lRixXxvPUehH8gUPqe68mWlG1GkPbBjRCc31U06tIV8aU5tWgou1P1CRWcpzfXTk02xVzsxX1e+zZUMtLtkts= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=X+dUx1/k; arc=none smtp.client-ip=74.125.82.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="X+dUx1/k" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2ba9a744f7dso466564eec.0 for ; Tue, 10 Feb 2026 17:52:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770774778; x=1771379578; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=z/GTs5A9yek4he0BUlqIoIsxHRmHOoQilOIUJRqh028=; b=X+dUx1/ku5ehRavVOUt0AZynPHHNl8iFUuUVzloC2yPNiyIEHMDljQ/vjrCa+9BJn5 Uim4Wc5uHjX1sCWJYyQUOOj+cVc8SDkmpeUiLXENeeyQQUwy8oSML1g/4DahWrDlH4GF x99/zFFs02mOZw2ur/u/IUDJ2mxh526I87TsOwNQg6yZ0/zKgdhpaGoxij48ZGyzTCQv 8ChBipy+mQMy4qzPAtV/FlezuW64ELL3VAeXUw9PSMrjUGrQsTUUfLkA1q1Tpn6em2yt hEXJA0MEMtpZzzm87BRH07TL8JFGLgNrIjIuB/eNcjfYBwgC3fogy8+3ltDFiy1NK7sC 91LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770774778; x=1771379578; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z/GTs5A9yek4he0BUlqIoIsxHRmHOoQilOIUJRqh028=; b=mixfBQmKiAXH+iEE1wo7miTW9UtdvIOrHPiDevEjKaXIR3Li1Smbe7ZEa+eK8QOZZZ teOneGMlrVI5vKnVpgbo9Ed2lHc6nS3BSxgp3xK8oRLZeQkeiMFLx+LUoMDGr1w4xO6t 06uFiKiKXZX5wtNC7a2W6ZiVnFxoLx3kF+qzRdE8wV4wOorFwiyEoy45FVBaRldUeDnS 9ey7J8DURq4Tzx+3NtrxBQwYyoQjXetartSTElv/j2tMb3AgJQaKst77oDr4pNVZyyLH bwNAilRW75mKHbnGqqKvYu1pT7RY/167zDTaSBHHdHHtvqYJtbsqFFG6ZenfHNcQXnc2 P2Gw== X-Forwarded-Encrypted: i=1; AJvYcCX8Sgq2ydN3VeadLRgtRDYCwUAUmNa6MVIZr77bf6U1QaVvQq+3dXfdFGom7rBqxdyqR1gs84t1e19LSh8=@vger.kernel.org X-Gm-Message-State: AOJu0YwWD4zrWpI5mgWO4M8WhWHMNrjWPCxVCJcBpZhGuPXQJm3P2tK+ xlAMNUqavMYGlHOtT8GzG4+hM2oQYKDVuYp7yRdJ2V2f5ttxrJ8GyxPqAvy3XrlIhCgsDLX+a+X 0m2kwvOE89A== X-Received: from dybhf8.prod.google.com ([2002:a05:7301:2a08:b0:2ac:3025:bdaa]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:2f99:b0:2b7:2664:ae9f with SMTP id 5a478bee46e88-2ba9e01564emr134737eec.1.1770774778056; Tue, 10 Feb 2026 17:52:58 -0800 (PST) Date: Tue, 10 Feb 2026 17:52:42 -0800 In-Reply-To: <20260211015242.2700218-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260211015242.2700218-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260211015242.2700218-6-irogers@google.com> Subject: [PATCH v1 5/5] perf test: perf data --to-ctf testing From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Derek Foreman , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If babeltrace is detected check that --to-ctf functions with a data file and in pipe mode. Signed-off-by: Ian Rogers --- .../shell/test_perf_data_converter_ctf.sh | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 tools/perf/tests/shell/test_perf_data_converter_ctf.sh diff --git a/tools/perf/tests/shell/test_perf_data_converter_ctf.sh b/tools= /perf/tests/shell/test_perf_data_converter_ctf.sh new file mode 100755 index 000000000000..334eebc9945e --- /dev/null +++ b/tools/perf/tests/shell/test_perf_data_converter_ctf.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# 'perf data convert --to-ctf' command test +# SPDX-License-Identifier: GPL-2.0 + +set -e + +err=3D0 + +perfdata=3D$(mktemp /tmp/__perf_test.perf.data.XXXXX) +ctf_dir=3D$(mktemp -d /tmp/__perf_test.ctf.XXXXX) + +cleanup() +{ + rm -f "${perfdata}" + rm -rf "${ctf_dir}" + trap - exit term int +} + +trap_cleanup() +{ + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit ${err} +} +trap trap_cleanup exit term int + +check_babeltrace_support() +{ + if ! perf check feature libbabeltrace + then + echo "perf not linked with libbabeltrace, skipping test" + exit 2 + fi +} + +test_ctf_converter_file() +{ + echo "Testing Perf Data Conversion Command to CTF (File input)" + # Record some data + if ! perf record -o "$perfdata" -F 99 -g -- perf test -w noploop + then + echo "Failed to record perf data" + err=3D1 + return + fi + + # Cleanup previous ctf dir + rm -rf "${ctf_dir}" + + # Convert + if ! perf data convert --to-ctf "$ctf_dir" --force -i "$perfdata" + then + echo "Perf Data Converter Command to CTF (File input) [FAILED]" + err=3D1 + return + fi + + if [ -d "${ctf_dir}" ] && [ "$(ls -A "${ctf_dir}")" ] + then + echo "Perf Data Converter Command to CTF (File input) [SUCCESS]" + else + echo "Perf Data Converter Command to CTF (File input) [FAILED]" + echo " Output directory empty or missing" + err=3D1 + fi +} + +test_ctf_converter_pipe() +{ + echo "Testing Perf Data Conversion Command to CTF (Pipe mode)" + + # Cleanup previous ctf dir + rm -rf "${ctf_dir}" + + # Record to stdout and pipe to $perfdata file + if ! perf record -o - -F 99 -g -- perf test -w noploop > "$perfdata" + then + echo "Failed to record perf data" + err=3D1 + return + fi + + if ! perf data convert --to-ctf "$ctf_dir" --force -i "$perfdata" + then + echo "Perf Data Converter Command to CTF (Pipe mode) [FAILED]" + err=3D1 + return + fi + + if [ -d "${ctf_dir}" ] && [ "$(ls -A "${ctf_dir}")" ] + then + echo "Perf Data Converter Command to CTF (Pipe mode) [SUCCESS]" + else + echo "Perf Data Converter Command to CTF (Pipe mode) [FAILED]" + echo " Output directory empty or missing" + err=3D1 + fi +} + +check_babeltrace_support +test_ctf_converter_file +test_ctf_converter_pipe + +exit ${err} --=20 2.53.0.239.g8d8fc8a987-goog