[Ezbench-dev] [PATCH 2/5] ezbench: improve the add_test output
Martin Peres
martin.peres at linux.intel.com
Thu Mar 2 11:54:19 UTC 2017
---
ezbench | 11 +++++++++--
python-modules/ezbench/smartezbench.py | 12 +++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ezbench b/ezbench
index a8a14ef..470086f 100755
--- a/ezbench
+++ b/ezbench
@@ -178,8 +178,15 @@ if args.commits is not None and args.tests is not None:
# Add all the commits and tests to commit
for commit in run_info.commits:
for test in run_info.tests:
- print("add {count} runs to {test} on {commit}".format(count=args.rounds, test=test, commit=commit))
- sbench.add_test(commit, test, args.rounds)
+ total_rounds = sbench.add_test(commit, test, args.rounds)
+ if args.rounds >= 0:
+ print("added {} runs to {} on {} --> {} runs".format(args.rounds,
+ test, commit,
+ total_rounds))
+ else:
+ print("removed {} runs to {} on {} --> {} runs".format(-args.rounds,
+ test, commit,
+ total_rounds))
if args.commits is not None and len(testsets_to_be_added) > 0:
# remove duplicates in the lists
diff --git a/python-modules/ezbench/smartezbench.py b/python-modules/ezbench/smartezbench.py
index 6436d0b..ba15602 100644
--- a/python-modules/ezbench/smartezbench.py
+++ b/python-modules/ezbench/smartezbench.py
@@ -485,23 +485,28 @@ class SmartEzbench:
else:
task_tree[commit]['tests'][test]['rounds'] += rounds
+ total_rounds = task_tree[commit]['tests'][test]['rounds']
+
# if the number of rounds is equal to 0 for a test, delete it
if task_tree[commit]['tests'][test]['rounds'] <= 0:
del task_tree[commit]['tests'][test]
+ total_rounds = 0
# Delete a commit that has no test
if len(task_tree[commit]['tests']) == 0:
del task_tree[commit]
+ return total_rounds
+
def __add_test_unlocked__(self, commit, test, rounds):
scm = self.repo()
if scm is not None:
commit = scm.full_version_name(commit)
if rounds is None:
- return
+ return self.state['commits'][commit]['tests'][test]['rounds']
- self.__task_tree_add_test__(self.state['commits'], commit, test, rounds)
+ return self.__task_tree_add_test__(self.state['commits'], commit, test, rounds)
# If the state was DONE, set it back to RUN
if self.__running_mode_unlocked__(check_running=False) == RunningMode.DONE:
@@ -509,9 +514,10 @@ class SmartEzbench:
def add_test(self, commit, test, rounds = None):
self.__reload_state(keep_lock=True)
- self.__add_test_unlocked__(commit, test, rounds)
+ total_rounds = self.__add_test_unlocked__(commit, test, rounds)
self.__save_state()
self.__release_lock()
+ return total_rounds
def add_testset(self, commit, testset, rounds = None):
self.__reload_state(keep_lock=True)
--
2.11.1
More information about the Ezbench-dev
mailing list