diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-02-03 19:58:54 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-15 20:06:41 -0800 |
commit | 1440b3e9aa98c4b5f846226c4a5b433325313907 (patch) | |
tree | e7b373ddba3441815a67b187e26515a255a2578e | |
parent | 37c9f3f180c018ed031e7cb79d68307cdb9bd515 (diff) | |
download | poky-1440b3e9aa98c4b5f846226c4a5b433325313907.tar.gz |
oe-build-perf-test: drop --commit-results
Drop support for committing results into Git repository. The
functionality was not directly related to testing and feels unnecessary
complication of the script. The functionality has been moved into a
separate oe-git-archive script.
[YOCTO #10582]
(From OE-Core rev: 4de387c0cfcb6b58760c6b6e150474abe82bfe4c)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/oe-build-perf-test | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/scripts/oe-build-perf-test b/scripts/oe-build-perf-test index f3867abfb9..8950c32004 100755 --- a/scripts/oe-build-perf-test +++ b/scripts/oe-build-perf-test | |||
@@ -33,7 +33,6 @@ import oeqa.buildperf | |||
33 | from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult, | 33 | from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult, |
34 | BuildPerfTestRunner, KernelDropCaches) | 34 | BuildPerfTestRunner, KernelDropCaches) |
35 | from oeqa.utils.commands import runCmd | 35 | from oeqa.utils.commands import runCmd |
36 | from oeqa.utils.git import GitRepo, GitError | ||
37 | from oeqa.utils.metadata import metadata_from_bb, write_metadata_file | 36 | from oeqa.utils.metadata import metadata_from_bb, write_metadata_file |
38 | 37 | ||
39 | 38 | ||
@@ -74,31 +73,6 @@ def pre_run_sanity_check(): | |||
74 | return False | 73 | return False |
75 | return True | 74 | return True |
76 | 75 | ||
77 | def init_git_repo(path): | ||
78 | """Check/create Git repository where to store results""" | ||
79 | path = os.path.abspath(path) | ||
80 | if os.path.isfile(path): | ||
81 | log.error("Invalid Git repo %s: path exists but is not a directory", path) | ||
82 | return False | ||
83 | if not os.path.isdir(path): | ||
84 | try: | ||
85 | os.mkdir(path) | ||
86 | except (FileNotFoundError, PermissionError) as err: | ||
87 | log.error("Failed to mkdir %s: %s", path, err) | ||
88 | return False | ||
89 | if not os.listdir(path): | ||
90 | log.info("Initializing a new Git repo at %s", path) | ||
91 | GitRepo.init(path) | ||
92 | try: | ||
93 | GitRepo(path, is_topdir=True) | ||
94 | except GitError: | ||
95 | log.error("No Git repository but a non-empty directory found at %s.\n" | ||
96 | "Please specify a Git repository, an empty directory or " | ||
97 | "a non-existing directory", path) | ||
98 | return False | ||
99 | return True | ||
100 | |||
101 | |||
102 | def setup_file_logging(log_file): | 76 | def setup_file_logging(log_file): |
103 | """Setup loggin to file""" | 77 | """Setup loggin to file""" |
104 | log_dir = os.path.dirname(log_file) | 78 | log_dir = os.path.dirname(log_file) |
@@ -118,68 +92,6 @@ def archive_build_conf(out_dir): | |||
118 | shutil.copytree(src_dir, tgt_dir) | 92 | shutil.copytree(src_dir, tgt_dir) |
119 | 93 | ||
120 | 94 | ||
121 | def git_commit_results(repo_dir, results_dir, branch, tag, metadata): | ||
122 | """Commit results into a Git repository""" | ||
123 | repo = GitRepo(repo_dir, is_topdir=True) | ||
124 | distro_branch = metadata['layers']['meta']['branch'] | ||
125 | distro_commit = metadata['layers']['meta']['commit'] | ||
126 | distro_commit_count = metadata['layers']['meta']['commit_count'] | ||
127 | |||
128 | # Replace keywords | ||
129 | branch = branch.format(git_branch=distro_branch, | ||
130 | tester_host=metadata['hostname']) | ||
131 | |||
132 | log.info("Committing test results into %s %s", repo_dir, branch) | ||
133 | tmp_index = os.path.join(repo_dir, '.git', 'index.oe-build-perf') | ||
134 | try: | ||
135 | # Create new commit object from the new results | ||
136 | env_update = {'GIT_INDEX_FILE': tmp_index, | ||
137 | 'GIT_WORK_TREE': results_dir} | ||
138 | repo.run_cmd('add .', env_update) | ||
139 | tree = repo.run_cmd('write-tree', env_update) | ||
140 | parent = repo.rev_parse(branch) | ||
141 | msg = "Results of {}:{}\n".format(distro_branch, distro_commit) | ||
142 | git_cmd = ['commit-tree', tree, '-m', msg] | ||
143 | if parent: | ||
144 | git_cmd += ['-p', parent] | ||
145 | commit = repo.run_cmd(git_cmd, env_update) | ||
146 | |||
147 | # Update branch head | ||
148 | git_cmd = ['update-ref', 'refs/heads/' + branch, commit] | ||
149 | if parent: | ||
150 | git_cmd.append(parent) | ||
151 | repo.run_cmd(git_cmd) | ||
152 | |||
153 | # Update current HEAD, if we're on branch 'branch' | ||
154 | if repo.get_current_branch() == branch: | ||
155 | log.info("Updating %s HEAD to latest commit", repo_dir) | ||
156 | repo.run_cmd('reset --hard') | ||
157 | |||
158 | # Create (annotated) tag | ||
159 | if tag: | ||
160 | # Find tags matching the pattern | ||
161 | tag_keywords = dict(git_branch=distro_branch, | ||
162 | git_commit=distro_commit, | ||
163 | git_commit_count=distro_commit_count, | ||
164 | tester_host=metadata['hostname'], | ||
165 | tag_num='[0-9]{1,5}') | ||
166 | tag_re = re.compile(tag.format(**tag_keywords) + '$') | ||
167 | tag_keywords['tag_num'] = 0 | ||
168 | for existing_tag in repo.run_cmd('tag').splitlines(): | ||
169 | if tag_re.match(existing_tag): | ||
170 | tag_keywords['tag_num'] += 1 | ||
171 | |||
172 | tag = tag.format(**tag_keywords) | ||
173 | msg = "Test run #{} of {}:{}\n".format(tag_keywords['tag_num'], | ||
174 | distro_branch, | ||
175 | distro_commit) | ||
176 | repo.run_cmd(['tag', '-a', '-m', msg, tag, commit]) | ||
177 | |||
178 | finally: | ||
179 | if os.path.exists(tmp_index): | ||
180 | os.unlink(tmp_index) | ||
181 | |||
182 | |||
183 | def update_globalres_file(result_obj, filename, metadata): | 95 | def update_globalres_file(result_obj, filename, metadata): |
184 | """Write results to globalres csv file""" | 96 | """Write results to globalres csv file""" |
185 | # Map test names to time and size columns in globalres | 97 | # Map test names to time and size columns in globalres |
@@ -235,15 +147,6 @@ def parse_args(argv): | |||
235 | help="Log file of this script") | 147 | help="Log file of this script") |
236 | parser.add_argument('--run-tests', nargs='+', metavar='TEST', | 148 | parser.add_argument('--run-tests', nargs='+', metavar='TEST', |
237 | help="List of tests to run") | 149 | help="List of tests to run") |
238 | parser.add_argument('--commit-results', metavar='GIT_DIR', | ||
239 | type=os.path.abspath, | ||
240 | help="Commit result data to a (local) git repository") | ||
241 | parser.add_argument('--commit-results-branch', metavar='BRANCH', | ||
242 | default="{git_branch}", | ||
243 | help="Commit results to branch BRANCH.") | ||
244 | parser.add_argument('--commit-results-tag', metavar='TAG', | ||
245 | default="{git_branch}/{git_commit_count}-g{git_commit}/{tag_num}", | ||
246 | help="Tag results commit with TAG.") | ||
247 | 150 | ||
248 | return parser.parse_args(argv) | 151 | return parser.parse_args(argv) |
249 | 152 | ||
@@ -266,9 +169,6 @@ def main(argv=None): | |||
266 | 169 | ||
267 | if not pre_run_sanity_check(): | 170 | if not pre_run_sanity_check(): |
268 | return 1 | 171 | return 1 |
269 | if args.commit_results: | ||
270 | if not init_git_repo(args.commit_results): | ||
271 | return 1 | ||
272 | 172 | ||
273 | # Check our capability to drop caches and ask pass if needed | 173 | # Check our capability to drop caches and ask pass if needed |
274 | KernelDropCaches.check() | 174 | KernelDropCaches.check() |
@@ -311,10 +211,6 @@ def main(argv=None): | |||
311 | result.write_results_json() | 211 | result.write_results_json() |
312 | if args.globalres_file: | 212 | if args.globalres_file: |
313 | update_globalres_file(result, args.globalres_file, metadata) | 213 | update_globalres_file(result, args.globalres_file, metadata) |
314 | if args.commit_results: | ||
315 | git_commit_results(args.commit_results, out_dir, | ||
316 | args.commit_results_branch, args.commit_results_tag, | ||
317 | metadata) | ||
318 | if result.wasSuccessful(): | 214 | if result.wasSuccessful(): |
319 | return 0 | 215 | return 0 |
320 | 216 | ||