diff options
| -rwxr-xr-x | scripts/oe-selftest | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index bfcea66f1c..e166521238 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest | |||
| @@ -111,9 +111,13 @@ def get_args_parser(): | |||
| 111 | help='Submit test results to a repository') | 111 | help='Submit test results to a repository') |
| 112 | return parser | 112 | return parser |
| 113 | 113 | ||
| 114 | builddir = None | ||
| 115 | |||
| 114 | 116 | ||
| 115 | def preflight_check(): | 117 | def preflight_check(): |
| 116 | 118 | ||
| 119 | global builddir | ||
| 120 | |||
| 117 | log.info("Checking that everything is in order before running the tests") | 121 | log.info("Checking that everything is in order before running the tests") |
| 118 | 122 | ||
| 119 | if not os.environ.get("BUILDDIR"): | 123 | if not os.environ.get("BUILDDIR"): |
| @@ -135,7 +139,7 @@ def preflight_check(): | |||
| 135 | return True | 139 | return True |
| 136 | 140 | ||
| 137 | def add_include(): | 141 | def add_include(): |
| 138 | builddir = os.environ.get("BUILDDIR") | 142 | global builddir |
| 139 | if "#include added by oe-selftest.py" \ | 143 | if "#include added by oe-selftest.py" \ |
| 140 | not in ftools.read_file(os.path.join(builddir, "conf/local.conf")): | 144 | not in ftools.read_file(os.path.join(builddir, "conf/local.conf")): |
| 141 | log.info("Adding: \"include selftest.inc\" in local.conf") | 145 | log.info("Adding: \"include selftest.inc\" in local.conf") |
| @@ -149,7 +153,7 @@ def add_include(): | |||
| 149 | "\n#include added by oe-selftest.py\ninclude bblayers.inc") | 153 | "\n#include added by oe-selftest.py\ninclude bblayers.inc") |
| 150 | 154 | ||
| 151 | def remove_include(): | 155 | def remove_include(): |
| 152 | builddir = os.environ.get("BUILDDIR") | 156 | global builddir |
| 153 | if builddir is None: | 157 | if builddir is None: |
| 154 | return | 158 | return |
| 155 | if "#include added by oe-selftest.py" \ | 159 | if "#include added by oe-selftest.py" \ |
| @@ -165,18 +169,21 @@ def remove_include(): | |||
| 165 | "\n#include added by oe-selftest.py\ninclude bblayers.inc") | 169 | "\n#include added by oe-selftest.py\ninclude bblayers.inc") |
| 166 | 170 | ||
| 167 | def remove_inc_files(): | 171 | def remove_inc_files(): |
| 172 | global builddir | ||
| 173 | if builddir is None: | ||
| 174 | return | ||
| 168 | try: | 175 | try: |
| 169 | os.remove(os.path.join(os.environ.get("BUILDDIR"), "conf/selftest.inc")) | 176 | os.remove(os.path.join(builddir, "conf/selftest.inc")) |
| 170 | for root, _, files in os.walk(get_test_layer()): | 177 | for root, _, files in os.walk(get_test_layer()): |
| 171 | for f in files: | 178 | for f in files: |
| 172 | if f == 'test_recipe.inc': | 179 | if f == 'test_recipe.inc': |
| 173 | os.remove(os.path.join(root, f)) | 180 | os.remove(os.path.join(root, f)) |
| 174 | except (AttributeError, OSError,) as e: # AttributeError may happen if BUILDDIR is not set | 181 | except OSError as e: |
| 175 | pass | 182 | pass |
| 176 | 183 | ||
| 177 | for incl_file in ['conf/bblayers.inc', 'conf/machine.inc']: | 184 | for incl_file in ['conf/bblayers.inc', 'conf/machine.inc']: |
| 178 | try: | 185 | try: |
| 179 | os.remove(os.path.join(os.environ.get("BUILDDIR"), incl_file)) | 186 | os.remove(os.path.join(builddir, incl_file)) |
| 180 | except: | 187 | except: |
| 181 | pass | 188 | pass |
| 182 | 189 | ||
| @@ -394,7 +401,7 @@ def coverage_setup(coverage_source, coverage_include, coverage_omit): | |||
| 394 | """ Set up the coverage measurement for the testcases to be run """ | 401 | """ Set up the coverage measurement for the testcases to be run """ |
| 395 | import datetime | 402 | import datetime |
| 396 | import subprocess | 403 | import subprocess |
| 397 | builddir = os.environ.get("BUILDDIR") | 404 | global builddir |
| 398 | pokydir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | 405 | pokydir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) |
| 399 | curcommit= subprocess.check_output(["git", "--git-dir", os.path.join(pokydir, ".git"), "rev-parse", "HEAD"]).decode('utf-8') | 406 | curcommit= subprocess.check_output(["git", "--git-dir", os.path.join(pokydir, ".git"), "rev-parse", "HEAD"]).decode('utf-8') |
| 400 | coveragerc = "%s/.coveragerc" % builddir | 407 | coveragerc = "%s/.coveragerc" % builddir |
