From mboxrd@z Thu Jan 1 00:00:00 1970 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 30A3EB640 for ; Mon, 1 Jun 2026 00:06:25 +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=1780272391; cv=none; b=foZeiMPmOt8Cs7qhnz35D7G9CmFnvRLTTQJwTNqFOxUjm4hFzhiFAsTfuQKrDvGNiziIqsYe7WQ3eWCfoCoGDuVepKEd3DyP42Y6LfGwWdFuWcttD/8Y3CsPpP7U/ozOFIiSC4FhgH/sESLR0zZExIssmC4U6+Y2oa7zsGFOxoo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780272391; c=relaxed/simple; bh=fceYlMYPSFIBhgKdtj2vldQcRO1z7pGUGyHIbbbwZFg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sVflDLs+AT6JeoO0NWpuCv6n0DkA1PVoascPaCprox9dumqw/BofN5u7C+B9ARufGnt8pC0gun4JzK/J0WN84hQvZion+yrTsy99NDtbcH2m/fDE+cAX7QRLKOdx8JQLEZv9tgVM21HUd3B1j4f2tgU962QWYqAEdq94AhqBvXQ= 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=OAysrWx3; 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="OAysrWx3" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-304ee7d1368so2217834eec.0 for ; Sun, 31 May 2026 17:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780272385; x=1780877185; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5fWSS6pmKaXR3mc2oxOogwkg8pn144sIhxDOKYQ4GWI=; b=OAysrWx3+dM7HDyRsaDSU7/5of1kFP/EsB4adJV41NyYZRcHa/2E3jSoNGziJuRDJi KyRxKigOx3DqMSj0C9LXtLRI9IbLMMookBTpxT78euDpWCJuySwr1ZUIJ8ECPrWdifMY GSd9nkx10recCYmCJ8dF5b/+iqwKopvH7l/TFbZGX6V920kNnQowRtY41/0AOEanMZJs All4BdQ3UftcHji9i8AFCVXqjhc8NXuNNSuBvFohqfWH2a+OXRdJQKVvKYfoXvvo0EqF QuEbA77VB5Rfj4Ozt08rT0XXLCR1yYVthnoRrrFRiJeu9pY8qlgoaV1DkjHQW3T4LQFH S7EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780272385; x=1780877185; h=cc: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=5fWSS6pmKaXR3mc2oxOogwkg8pn144sIhxDOKYQ4GWI=; b=LDv4uJElrqXQVFUYhSLU7o1RRph2YSBvBadAw6RgdLpySIitbV0lhpPWIWKOqgD9dJ uQiyQtXd0dcELUxYdLaprFydhIZBJNNNXE/sg2nh2imSM3vep0bPDGSWOKOJWtE1Tbdg dgN3umyBH6yn17s9dNFcI21L0aenEjLhitXVm8csdVvZImOUXc90kSZfsrAndu7Nuyfm KC34KO+lpFleARciQk8A0wrNc7afjcajoEQQspHF+lY5Ca358NxFPmL4CMDMft/dmeA8 Ckiz6G8NYbvDIlHbx+cttU+NZmyxQPKAIRMLAxQG4qqErFoRA/CIPYL+BPV8tVbwam6w a4zA== X-Forwarded-Encrypted: i=1; AFNElJ+lyc9VeiyrUBebiJvumxdGYIuQ/3SKSmUaaGcjCUbvrH/TnozdpJnue2G46DGt2iDuxx2h4k+tJQGMwR0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6z5onrh1adxCB6zi/bJcCYPVYuT3VKaP5dKVkEjASMOGETuio d9aENylT7FWrF1JfxrQV67MhZKkU7ganNKCOrBDSnndddh+K8vs3GyXkqG7RG4rikn/z8JOa97W YhmDZrKNyXw== X-Received: from dll6.prod.google.com ([2002:a05:7022:206:b0:132:9fc5:59aa]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:3804:b0:137:e6a9:b986 with SMTP id a92af1059eb24-137e6a9bc7amr15990c88.18.1780272384773; Sun, 31 May 2026 17:06:24 -0700 (PDT) Date: Sun, 31 May 2026 17:05:47 -0700 In-Reply-To: <20260601000548.1195604-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: <20260531082235.940833-1-irogers@google.com> <20260601000548.1195604-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260601000548.1195604-15-irogers@google.com> Subject: [PATCH 14/15] perf test: Add shell test to validate JUnit XML reporting output From: Ian Rogers To: irogers@google.com, acme@kernel.org, adrian.hunter@intel.com, namhyung@kernel.org Cc: alexander.shishkin@linux.intel.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org Content-Type: text/plain; charset="UTF-8" Add a shell test script (test_test_junit_output.sh) to execute perf test with the -j/--junit option and validate that the generated test report complies perfectly with standard XML formatting using Python's ElementTree XML parser. Assisted-by: Gemini-CLI:Google Gemini 3 Signed-off-by: Ian Rogers --- .../tests/shell/test_test_junit_output.sh | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 tools/perf/tests/shell/test_test_junit_output.sh diff --git a/tools/perf/tests/shell/test_test_junit_output.sh b/tools/perf/tests/shell/test_test_junit_output.sh new file mode 100755 index 000000000000..5104ac1e1e6d --- /dev/null +++ b/tools/perf/tests/shell/test_test_junit_output.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# perf test junit XML output validation + +set -e + +err=0 + +shelldir=$(dirname "$0") +# shellcheck source=lib/setup_python.sh +. "${shelldir}"/lib/setup_python.sh + +result=$(mktemp /tmp/__perf_test.output.xml.XXXXX) + +cleanup() +{ + rm -f "${result}" + trap - exit term int +} + +trap_cleanup() +{ + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup exit term int + +test_junit_output() +{ + echo "Testing perf test JUnit XML output command" + perf test -v -j"$result" util || true + if [ -s "$result" ] ; then + echo "perf test JUnit XML output command [SUCCESS]" + else + echo "perf test JUnit XML output command [FAILED]" + err=1 + fi +} + +validate_xml_format() +{ + echo "Validating perf test converted JUnit XML file" + if [ -f "$result" ] ; then + if $PYTHON -c \ + "import xml.etree.ElementTree as ET; ET.parse('$result')" \ + >/dev/null 2>&1 ; then + echo "The file contains valid XML format [SUCCESS]" + else + echo "The file does not contain valid XML format [FAILED]" + err=1 + fi + else + echo "File not found [FAILED]" + err=1 + fi +} + +test_junit_output +validate_xml_format + +cleanup +exit ${err} -- 2.54.0.823.g6e5bcc1fc9-goog