From nobody Tue Dec 2 01:36:31 2025 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.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 264482FB966 for ; Sat, 22 Nov 2025 08:20:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763799602; cv=none; b=Lk0XJJ7vybL75Xx7b7l+PZIiRJhNN+jlb1fH54BTHYQpXGWDx87JukgmAwKWLq0hZ0ig6PR8rQ0T1MrtWMGyY7IvPDzOeyDVLMctQrfFskvEiSvzrS22HBxIomXGkr7Dnbw0ovGiQ73NQlD6XfA9gcKknzxSMcNx+SHIE568COs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763799602; c=relaxed/simple; bh=rm1IqrKBPHLzJkcMCtYYI8jd1FLWutvG90VSMPspXtc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=e8RYEW0EQVsHaPPX/1WlQYzg2KgBQtMfQaNdfO7RAExarZw2i8uuNuw6GYP8MDLUK8DaKoCCox5ww+IgUC+f4vvm0aqUZ9f4chxC8C1rz/amxCt7oVtVUg/uxyOxDaGDVBkgFSaoy1z5OFquPyHru2FnRDLqWuY7ny0/Hmd8Jqg= 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=G3xk5U47; arc=none smtp.client-ip=209.85.215.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="G3xk5U47" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b9d73d57328so2952931a12.1 for ; Sat, 22 Nov 2025 00:20:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763799600; x=1764404400; 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=vGR4BXI5WcGpKIWk+D2mRg8n/v4+474MDwz+X0FyE40=; b=G3xk5U47A2JsIkp2AMxFOC2GRi8q2e5qRg+9Qi7DTK2w/r+XxkKk9UmzM7NSQXR+bh 5s1urlp3Bti5i9p0BIKDEcqWrwcPgE6AjnSK/4Uqvn/fWuF2XdQghcjblqWdu0wju6G9 xvsgvtlVRmJ0BQp5BDeLOvNFdp3uTIaum3UEIPCdqK4kyjR3zp8ZnM7UruvHxBkJ9z1o 8nCX5HO1eOi2sqHMs9Xm/YiQnrU4t/7CFLuayR8mRy7jPSMZaqlYddog6MqrUZt5Eg1b bvFjmNBKyDmes2yVMpe+7nBwKQoBTTwo45MJcG1ckQ7K3ppaDXuwdLXuuszEn+lfJNdW Rdbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763799600; x=1764404400; 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=vGR4BXI5WcGpKIWk+D2mRg8n/v4+474MDwz+X0FyE40=; b=lNI1WVptLCXs0OVqYMkjje/auFVxWwkLcyuSLtil6FWJXkOq/SMfWhnWkI5y1sZhWx Rq/URmP4BrH90QAVnwWEGH8acJQKQ58teI1LFeHSbFVINjt87V4lrtNuFLgnEcPUgH9i HPO5T9sfxxVg/WbyvckEky2g7KGKYEAxxUglWrnQ7h9rOQZwze2EbdlO5+vUoZ494iOs O0IYB/5D+n1WHHIYzujKXgSuZSHV7aHGHshDDsXZD34wsr0sXdwdpZEkY7cQqdwpQY5M ZAyV6ghRerEzIVj/s1es8x9BlvObvl12K2U4EhMw2Yl0dXaaq9A1934R2PZw/p/PfEPf /q9g== X-Forwarded-Encrypted: i=1; AJvYcCXEkv/N4Ubu4qPM6uU6nXNOnZL0qawbTcNUcCqBnTqYirgK8kPkHbNfwbkV/cx7+eg3WGO8GmUP9gT7EcU=@vger.kernel.org X-Gm-Message-State: AOJu0YwQpDU8rxqsSh5OTXZIcmZAGd+KI0FtoBLpDd5WnzNJk9wuNNdq JrMOCKIeNTLQih1i1NN+sgIbFsmiFrlaVNpGG7Nq4+aPK0OYOLG7CxrIQMHbfvwGqFI8QfgKIzS hnVnJBKwydA== X-Google-Smtp-Source: AGHT+IFwXD0UPsR32BV1vhsitlbMopKgA+delZqUK7OlNd63rhYZA7+H0e0oSXCCw0pVxEMPrNNFg8+wDt/t X-Received: from dlbdx41.prod.google.com ([2002:a05:7022:e29:b0:11a:3780:4b65]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:8085:b0:2a4:874c:ba92 with SMTP id 5a478bee46e88-2a7192d457bmr2103902eec.36.1763799600458; Sat, 22 Nov 2025 00:20:00 -0800 (PST) Date: Sat, 22 Nov 2025 00:19:25 -0800 In-Reply-To: <20251122081929.7588-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: <20251122081929.7588-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.rc2.455.g230fcf2819-goog Message-ID: <20251122081929.7588-14-irogers@google.com> Subject: [PATCH v1 13/17] perf tests timechart: Add a perf timechart test From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Collin Funk , Dmitry Vyukov , Andi Kleen , Thomas Falcon , Leo Yan , Yicong Yang , Greg Kroah-Hartman , "Masami Hiramatsu (Google)" , Stephen Brennan , Haibo Xu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Basic coverage for `perf timechart` doing a record and then a basic sanity test of the generated SVG file. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/timechart.sh | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 tools/perf/tests/shell/timechart.sh diff --git a/tools/perf/tests/shell/timechart.sh b/tools/perf/tests/shell/t= imechart.sh new file mode 100755 index 000000000000..b14b3472c284 --- /dev/null +++ b/tools/perf/tests/shell/timechart.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# perf timechart tests +# SPDX-License-Identifier: GPL-2.0 + +set -e + +err=3D0 +perfdata=3D$(mktemp /tmp/__perf_timechart_test.perf.data.XXXXX) +output=3D$(mktemp /tmp/__perf_timechart_test.output.XXXXX.svg) + +cleanup() { + rm -f "${perfdata}" + rm -f "${output}" + trap - EXIT TERM INT +} + +trap_cleanup() { + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + +test_timechart() { + echo "Basic perf timechart test" + + # Try to record timechart data. + # perf timechart record uses system-wide recording and specific tracepoin= ts. + # If it fails (e.g. permissions, missing tracepoints), skip the test. + if ! perf timechart record -o "${perfdata}" true > /dev/null 2>&1; then + echo "Basic perf timechart test [Skipped: perf timechart record failed (= permissions/events?)]" + return + fi + + # Generate the timechart + if ! perf timechart -i "${perfdata}" -o "${output}" > /dev/null 2>&1; then + echo "Basic perf timechart test [Failed: perf timechart command failed]" + err=3D1 + return + fi + + # Check if output file exists and is not empty + if [ ! -s "${output}" ]; then + echo "Basic perf timechart test [Failed: output file is empty or missing= ]" + err=3D1 + return + fi + + # Check if it looks like an SVG + if ! grep -q "svg" "${output}"; then + echo "Basic perf timechart test [Failed: output doesn't look like SVG]" + err=3D1 + return + fi + + echo "Basic perf timechart test [Success]" +} + +if ! perf check feature -q libtraceevent ; then + echo "perf timechart is not supported. Skip." + cleanup + exit 2 +fi + +test_timechart +cleanup +exit $err --=20 2.52.0.rc2.455.g230fcf2819-goog