Optofidelity: Dry run functionality
Change-Id: Iae9025d2a6b7b27b635469a6971a057654bf7957
Reviewed-on: https://chromium-review.googlesource.com/336536
Commit-Ready: Dennis Kempin <denniskempin@chromium.org>
Tested-by: Dennis Kempin <denniskempin@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@chromium.org>
diff --git a/optofidelity/optofidelity/orchestrator/orchestrator.py b/optofidelity/optofidelity/orchestrator/orchestrator.py
index 5ff3d3d..58c6ce0 100644
--- a/optofidelity/optofidelity/orchestrator/orchestrator.py
+++ b/optofidelity/optofidelity/orchestrator/orchestrator.py
@@ -203,6 +203,22 @@
with subject.access:
subject.Verify()
+ def DryRunBenchmarks(self, match="*"):
+ for subject, benchmark_defs in self._ListMatchingBenchmarks(match):
+ self._progress.Info(subject.name, "Access")
+ with subject.access:
+ try:
+ subject.navigator.Open()
+ for benchmark_def in benchmark_defs:
+ full_name = "%s/%s" % (subject.name, benchmark_def.name)
+ self._progress.Info(full_name, "Dry Run")
+ benchmark = self._runner.CreateBenchmark(full_name,
+ benchmark_def.benchmark_type, benchmark_def.activity,
+ benchmark_def.params, {})
+ benchmark.ExecuteOnSubject(subject)
+ finally:
+ subject.navigator.Cleanup()
+
def UpdateAndRunBenchmarks(self, match, versions, skip_installed=False):
"""Runs updates and benchmarks on all bencharks matching 'match'
diff --git a/optofidelity/orchestrator_main.py b/optofidelity/orchestrator_main.py
index 2ab87d0..96d3e5c 100644
--- a/optofidelity/orchestrator_main.py
+++ b/optofidelity/orchestrator_main.py
@@ -63,6 +63,8 @@
builder.orchestrator.VerifySubjects(match)
elif options.setup:
builder.orchestrator.SetUpSubjects(match, options.versions)
+ elif options.dry_run:
+ builder.orchestrator.DryRunBenchmarks(match)
else:
builder.orchestrator.UpdateAndRunBenchmarks(match, options.versions,
options.skip_installed)
@@ -101,6 +103,9 @@
parser.add_option("--access",
dest="access", default=False, action="store_true",
help="Enable USB access to subject.")
+ parser.add_option("--dry-run",
+ dest="dry_run", default=False, action="store_true",
+ help="Only run robot interaction on selected benchmarks.")
(options, args) = parser.parse_args()
matches = args if len(args) > 0 else ["*"]