diff options
Diffstat (limited to 'scripts/oe-build-perf-test')
-rwxr-xr-x | scripts/oe-build-perf-test | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/oe-build-perf-test b/scripts/oe-build-perf-test index 390e4c9519..437611c856 100755 --- a/scripts/oe-build-perf-test +++ b/scripts/oe-build-perf-test | |||
@@ -31,6 +31,7 @@ import oeqa.buildperf | |||
31 | from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult, | 31 | from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult, |
32 | BuildPerfTestRunner, KernelDropCaches) | 32 | BuildPerfTestRunner, KernelDropCaches) |
33 | from oeqa.utils.commands import runCmd | 33 | from oeqa.utils.commands import runCmd |
34 | from oeqa.utils.git import GitRepo, GitError | ||
34 | 35 | ||
35 | 36 | ||
36 | # Set-up logging | 37 | # Set-up logging |
@@ -68,7 +69,30 @@ def pre_run_sanity_check(): | |||
68 | if ret.status: | 69 | if ret.status: |
69 | log.error("bitbake command not found") | 70 | log.error("bitbake command not found") |
70 | return False | 71 | return False |
72 | return True | ||
71 | 73 | ||
74 | def init_git_repo(path): | ||
75 | """Check/create Git repository where to store results""" | ||
76 | path = os.path.abspath(path) | ||
77 | if os.path.isfile(path): | ||
78 | log.error("Invalid Git repo %s: path exists but is not a directory", path) | ||
79 | return False | ||
80 | if not os.path.isdir(path): | ||
81 | try: | ||
82 | os.mkdir(path) | ||
83 | except (FileNotFoundError, PermissionError) as err: | ||
84 | log.error("Failed to mkdir %s: %s", path, err) | ||
85 | return False | ||
86 | if not os.listdir(path): | ||
87 | log.info("Initializing a new Git repo at %s", path) | ||
88 | GitRepo.init(path) | ||
89 | try: | ||
90 | GitRepo(path, is_topdir=True) | ||
91 | except GitError: | ||
92 | log.error("No Git repository but a non-empty directory found at %s.\n" | ||
93 | "Please specify a Git repository, an empty directory or " | ||
94 | "a non-existing directory", path) | ||
95 | return False | ||
72 | return True | 96 | return True |
73 | 97 | ||
74 | 98 | ||
@@ -137,6 +161,9 @@ def main(argv=None): | |||
137 | 161 | ||
138 | if not pre_run_sanity_check(): | 162 | if not pre_run_sanity_check(): |
139 | return 1 | 163 | return 1 |
164 | if args.commit_results: | ||
165 | if not init_git_repo(args.commit_results): | ||
166 | return 1 | ||
140 | 167 | ||
141 | # Check our capability to drop caches and ask pass if needed | 168 | # Check our capability to drop caches and ask pass if needed |
142 | KernelDropCaches.check() | 169 | KernelDropCaches.check() |