[PATCH] D48077: [LNT] Allow --use-perf=profile and --run-under to work together
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 07:12:50 PDT 2018
peter.smith created this revision.
peter.smith added reviewers: MatzeB, cmatthews, kristof.beyls.
The perf.py module invokes the run_under.mutateCommandLine member function before mutating its own command line. In a recent refactoring r314239 "litsupport: Rework test module support" the run_test.mutateCommandLine was renamed with a leading _ to make it private. This means that when --use-perf=profile (or all) and --run-under are used simultaneously, as suggested for benchmarking in the lnt manual, we get the error:
test-suite/litsupport/modules/perf.py", line 32, in mutatePlan
run_under.mutateCommandLine)
AttributeError: 'module' object has no attribute 'mutateCommandLine'
For reference the mutatePlan function from perf.py is:
def mutatePlan(context, plan):
script = context.parsed_runscript
if context.config.run_under:
script = testplan.mutateScript(context, script,
run_under.mutateCommandLine)
script = testplan.mutateScript(context, script, _mutateCommandLine)
plan.profilescript += script
plan.metric_collectors.append(
lambda context: {'profile': context.tmpBase + '.perf_data'})
The patch just renames the _mutateCommandLine in run_under.py as I don't think that it should be marked private if run_under.py is calling it.
I've not been able to find an easy way to write a regression test for this. The existing run_under tests in the lnt unit tests run using a fake lit so I couldn't write a failing test. I'm an almost complete novice with lnt development so I'd welcome any suggestions for how to write a unit test.
https://reviews.llvm.org/D48077
Files:
litsupport/modules/run_under.py
Index: litsupport/modules/run_under.py
===================================================================
--- litsupport/modules/run_under.py
+++ litsupport/modules/run_under.py
@@ -4,7 +4,7 @@
from litsupport import testplan
-def _mutateCommandLine(context, commandline):
+def mutateCommandLine(context, commandline):
cmd = shellcommand.parse(commandline)
run_under_cmd = shellcommand.parse(context.config.run_under)
@@ -24,4 +24,4 @@
run_under = context.config.run_under
if run_under:
plan.runscript = testplan.mutateScript(context, plan.runscript,
- _mutateCommandLine)
+ mutateCommandLine)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48077.150940.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180612/5c8e6a2f/attachment.bin>
More information about the llvm-commits
mailing list