summaryrefslogtreecommitdiffstats
path: root/scripts/oe-build-perf-test
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-08-15 13:38:43 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-25 23:03:47 +0100
commit28333b3a2d17a9d623751a6c4daa92beadb8fdb6 (patch)
tree5c279e3ce8a1fb0b5330065b83d73db081d682f9 /scripts/oe-build-perf-test
parent6d9c52fe4b6c8789bb81bbc469c9f418edaef244 (diff)
downloadpoky-28333b3a2d17a9d623751a6c4daa92beadb8fdb6.tar.gz
oe-build-perf-test: pre-check Git repo when using --commit-results
Do a pre-check on the path that is specified with --commit-results before running any tests. The script will create and/or initialize a fresh Git repository if the given directory does not exist or if it is an empty directory. It fails if it finds a non-empty directory that is not a Git repository. (From OE-Core rev: 759357a3bdbe75a3409b9e58979ab8b45d9b6ae8) 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>
Diffstat (limited to 'scripts/oe-build-perf-test')
-rwxr-xr-xscripts/oe-build-perf-test27
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
31from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult, 31from oeqa.buildperf import (BuildPerfTestLoader, BuildPerfTestResult,
32 BuildPerfTestRunner, KernelDropCaches) 32 BuildPerfTestRunner, KernelDropCaches)
33from oeqa.utils.commands import runCmd 33from oeqa.utils.commands import runCmd
34from 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
74def 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()