git: bc9229035c5f - main - Allow programs run under this program to have arguments.
Date: Tue, 03 Mar 2026 17:11:10 UTC
The branch main has been updated by gnn:
URL: https://cgit.FreeBSD.org/src/commit/?id=bc9229035c5f46674cf06b48d66e9f039b3a9875
commit bc9229035c5f46674cf06b48d66e9f039b3a9875
Author: George V. Neville-Neil <gnn@FreeBSD.org>
AuthorDate: 2026-03-03 17:10:26 +0000
Commit: George V. Neville-Neil <gnn@FreeBSD.org>
CommitDate: 2026-03-03 17:10:42 +0000
Allow programs run under this program to have arguments.
---
tools/test/hwpmc/pmctest.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/test/hwpmc/pmctest.py b/tools/test/hwpmc/pmctest.py
index ba20306f1d68..1c113c256e32 100755
--- a/tools/test/hwpmc/pmctest.py
+++ b/tools/test/hwpmc/pmctest.py
@@ -27,6 +27,7 @@ import argparse
import tempfile
from pathlib import Path
import os
+import shlex
def gather_counters():
"""Run program and return output as array of lines."""
@@ -58,7 +59,9 @@ def main():
print("Choose one of --count OR --sample.")
sys.exit()
- program = Path(args.program).name
+ # Split program and arguments properly
+ program_parts = shlex.split(args.program)
+ program = Path(program_parts[0]).name
if args.count == True:
tmpdir = tempfile.mkdtemp(prefix=program + "-", suffix="-counting-pmc")
@@ -73,8 +76,7 @@ def main():
continue
if args.count == True:
with open(tmpdir + "/" + program + "-" + counter + ".txt", 'w') as file:
- p = subprocess.Popen(["pmcstat",
- "-p", counter, args.program],
+ p = subprocess.Popen(["pmcstat", "-p", counter] + program_parts,
text=True, stderr=file, stdout=file)
result = p.wait()
print(result)
@@ -82,7 +84,7 @@ def main():
pmcout = tmpdir + "/" + program + "-" + counter + ".pmc"
p = subprocess.Popen(["pmcstat",
"-O", pmcout,
- "-P", counter, args.program],
+ "-P", counter] + program_parts,
text=True, stderr=PIPE)
result = p.wait()
resdir = tmpdir + "/" + program + "-" + counter + ".results"
@@ -97,7 +99,7 @@ def main():
if Path(gmondir).is_dir():
with open(gmondir + "/" + "gprof.out", "w") as file:
p = subprocess.Popen(["gprof",
- args.program,
+ program_parts[0],
program + ".gmon"],
cwd=gmondir,
text=True,
@@ -109,7 +111,7 @@ def main():
print(result)
else:
- p = subprocess.Popen(["pmcstat", "-p", counter, args.program],
+ p = subprocess.Popen(["pmcstat", "-p", counter] + program_parts,
text=True, stderr=PIPE)
result = p.wait()
print(result)