diff options
Diffstat (limited to 'scripts/oe-build-perf-test')
-rwxr-xr-x | scripts/oe-build-perf-test | 28 |
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""" |
17 | import argparse | 17 | import argparse |
18 | import logging | 18 | import logging |
19 | import os | ||
19 | import sys | 20 | import sys |
20 | 21 | ||
22 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib') | ||
23 | import scriptpath | ||
24 | scriptpath.add_oe_lib_path() | ||
25 | from oeqa.utils.commands import runCmd | ||
26 | |||
21 | 27 | ||
22 | # Set-up logging | 28 | # Set-up logging |
23 | LOG_FORMAT = '[%(asctime)s] %(levelname)s: %(message)s' | 29 | LOG_FORMAT = '[%(asctime)s] %(levelname)s: %(message)s' |
@@ -25,6 +31,25 @@ logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) | |||
25 | log = logging.getLogger() | 31 | log = logging.getLogger() |
26 | 32 | ||
27 | 33 | ||
34 | def 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 | |||
28 | def parse_args(argv): | 53 | def 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 | ||