]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-build-perf-test: new {tag_num} keyword for --commit-results-tag
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 23 Aug 2016 13:41:53 +0000 (16:41 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 25 Aug 2016 22:00:04 +0000 (23:00 +0100)
This makes it possible to create numbered tags, where the "basename" of
the tag is the same and the only difference is an (automatically)
increasing index number. This is useful if you do multiple test runs on
the same commit. For example, using:
--commit-results-tag {tester_host}/{git_commit}/{tag_num}

would give you tags something like:
myhost/decb3119dffd3fd38b800bebc1e510f9217a152e/0
myhost/decb3119dffd3fd38b800bebc1e510f9217a152e/1
...

The default tag format is updated to use this new keyword in order to
prevent unintentional tag name clashes.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/buildperf/base.py
scripts/oe-build-perf-test

index a3cd3f3155cd78521f17b07883daa168a41b0b4d..faa30c72eccce9009c576435278b519a61782ce3 100644 (file)
@@ -226,10 +226,21 @@ class BuildPerfTestResult(unittest.TextTestResult):
 
             # Create (annotated) tag
             if tag:
-                # Replace keywords
-                tag = tag.format(git_branch=self.git_branch,
-                                 git_commit=self.git_commit,
-                                 tester_host=self.hostname)
+                # Find tags matching the pattern
+                tag_keywords = dict(git_branch=self.git_branch,
+                                    git_commit=self.git_commit,
+                                    tester_host=self.hostname,
+                                    tag_num='[0-9]{1,5}')
+                tag_re = re.compile(tag.format(**tag_keywords) + '$')
+                tag_keywords['tag_num'] = 0
+                for existing_tag in repo.run_cmd('tag').splitlines():
+                    if tag_re.match(existing_tag):
+                        tag_keywords['tag_num'] += 1
+
+                tag = tag.format(**tag_keywords)
+                msg = "Test run #{} of {}:{}\n".format(tag_keywords['tag_num'],
+                                                       self.git_branch,
+                                                       self.git_commit)
                 repo.run_cmd(['tag', '-a', '-m', msg, tag, commit])
 
         finally:
index 1ed5bdbf5eadc114f7e88eae22f24b31d908c5e0..cd2758412017625764754b0eaa54e26ea1490f46 100755 (executable)
@@ -140,7 +140,7 @@ def parse_args(argv):
                         default="{git_branch}",
                         help="Commit results to branch BRANCH.")
     parser.add_argument('--commit-results-tag', metavar='TAG',
-                        default="{git_branch}/{git_commit}",
+                        default="{git_branch}/{git_commit}/{tag_num}",
                         help="Tag results commit with TAG.")
 
     return parser.parse_args(argv)