summaryrefslogtreecommitdiffstats
path: root/scripts/oe-build-perf-test
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-04-27 14:12:00 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-01 16:22:46 +0100
commitc855cb807d178a3f285ec6dbd0dc853e0fb25edb (patch)
tree8f16ea7e1db4a634dd92166fa1ad945754c90ab3 /scripts/oe-build-perf-test
parent14108a88abed082f840f076b92bc9c10d47bca1c (diff)
downloadpoky-c855cb807d178a3f285ec6dbd0dc853e0fb25edb.tar.gz
oe-build-perf-test: add pre-run sanity check
The script will be required to be run in an initialized bitbake build environment. (From OE-Core rev: 1bce7b10283255a4498d11ead920c1f3b1dec4de) 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-test28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/oe-build-perf-test b/scripts/oe-build-perf-test
index 66477ebe0b..9fb431045b 100755
--- a/scripts/oe-build-perf-test
+++ b/scripts/oe-build-perf-test
@@ -16,8 +16,14 @@
16"""Build performance test script""" 16"""Build performance test script"""
17import argparse 17import argparse
18import logging 18import logging
19import os
19import sys 20import sys
20 21
22sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib')
23import scriptpath
24scriptpath.add_oe_lib_path()
25from oeqa.utils.commands import runCmd
26
21 27
22# Set-up logging 28# Set-up logging
23LOG_FORMAT = '[%(asctime)s] %(levelname)s: %(message)s' 29LOG_FORMAT = '[%(asctime)s] %(levelname)s: %(message)s'
@@ -25,6 +31,25 @@ logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
25log = logging.getLogger() 31log = logging.getLogger()
26 32
27 33
34def pre_run_sanity_check():
35 """Sanity check of build environment"""
36 build_dir = os.environ.get("BUILDDIR")
37 if not build_dir:
38 log.error("BUILDDIR not set. Please run the build environmnent setup "
39 "script.")
40 return False
41 if os.getcwd() != build_dir:
42 log.error("Please run this script under BUILDDIR (%s)", build_dir)
43 return False
44
45 ret = runCmd('which bitbake', ignore_status=True)
46 if ret.status:
47 log.error("bitbake command not found")
48 return False
49
50 return True
51
52
28def parse_args(argv): 53def parse_args(argv):
29 """Parse command line arguments""" 54 """Parse command line arguments"""
30 parser = argparse.ArgumentParser( 55 parser = argparse.ArgumentParser(
@@ -43,6 +68,9 @@ def main(argv=None):
43 if args.debug: 68 if args.debug:
44 log.setLevel(logging.DEBUG) 69 log.setLevel(logging.DEBUG)
45 70
71 if not pre_run_sanity_check():
72 return 1
73
46 return 0 74 return 0
47 75
48 76