diff options
| author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2017-05-25 14:25:39 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-06 19:02:43 +0100 |
| commit | 628ba5801b2a7bcf1a3fb7249667976c342abe43 (patch) | |
| tree | 6fdb6048b20ff77f6bc3a6a3d59a4e582eaa02f2 /scripts/oe-selftest | |
| parent | a80aa4c025cb9af621fae474e8f1361cdf7b124f (diff) | |
| download | poky-628ba5801b2a7bcf1a3fb7249667976c342abe43.tar.gz | |
scripts/oe-selftest: Move {add,remove}_include files to case
The oe-selftest creates include files to store custom configuration to
make specific tests, every class executes a different test and may be
uses custom configuration.
So move to case class in order to simplify oe-selftest script and later
implement later a build folder per class.
(From OE-Core rev: 1130b40c3dfa65e7ece08a95b3941e4d1d20bcf0)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-selftest')
| -rwxr-xr-x | scripts/oe-selftest | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index 52366b1c8d..490915759f 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest | |||
| @@ -159,56 +159,6 @@ def preflight_check(): | |||
| 159 | 159 | ||
| 160 | return True | 160 | return True |
| 161 | 161 | ||
| 162 | def add_include(): | ||
| 163 | global builddir | ||
| 164 | if "#include added by oe-selftest.py" \ | ||
| 165 | not in ftools.read_file(os.path.join(builddir, "conf/local.conf")): | ||
| 166 | log.info("Adding: \"include selftest.inc\" in local.conf") | ||
| 167 | ftools.append_file(os.path.join(builddir, "conf/local.conf"), \ | ||
| 168 | "\n#include added by oe-selftest.py\ninclude machine.inc\ninclude selftest.inc") | ||
| 169 | |||
| 170 | if "#include added by oe-selftest.py" \ | ||
| 171 | not in ftools.read_file(os.path.join(builddir, "conf/bblayers.conf")): | ||
| 172 | log.info("Adding: \"include bblayers.inc\" in bblayers.conf") | ||
| 173 | ftools.append_file(os.path.join(builddir, "conf/bblayers.conf"), \ | ||
| 174 | "\n#include added by oe-selftest.py\ninclude bblayers.inc") | ||
| 175 | |||
| 176 | def remove_include(): | ||
| 177 | global builddir | ||
| 178 | if builddir is None: | ||
| 179 | return | ||
| 180 | if "#include added by oe-selftest.py" \ | ||
| 181 | in ftools.read_file(os.path.join(builddir, "conf/local.conf")): | ||
| 182 | log.info("Removing the include from local.conf") | ||
| 183 | ftools.remove_from_file(os.path.join(builddir, "conf/local.conf"), \ | ||
| 184 | "\n#include added by oe-selftest.py\ninclude machine.inc\ninclude selftest.inc") | ||
| 185 | |||
| 186 | if "#include added by oe-selftest.py" \ | ||
| 187 | in ftools.read_file(os.path.join(builddir, "conf/bblayers.conf")): | ||
| 188 | log.info("Removing the include from bblayers.conf") | ||
| 189 | ftools.remove_from_file(os.path.join(builddir, "conf/bblayers.conf"), \ | ||
| 190 | "\n#include added by oe-selftest.py\ninclude bblayers.inc") | ||
| 191 | |||
| 192 | def remove_inc_files(): | ||
| 193 | global builddir | ||
| 194 | if builddir is None: | ||
| 195 | return | ||
| 196 | try: | ||
| 197 | os.remove(os.path.join(builddir, "conf/selftest.inc")) | ||
| 198 | for root, _, files in os.walk(get_test_layer()): | ||
| 199 | for f in files: | ||
| 200 | if f == 'test_recipe.inc': | ||
| 201 | os.remove(os.path.join(root, f)) | ||
| 202 | except OSError as e: | ||
| 203 | pass | ||
| 204 | |||
| 205 | for incl_file in ['conf/bblayers.inc', 'conf/machine.inc']: | ||
| 206 | try: | ||
| 207 | os.remove(os.path.join(builddir, incl_file)) | ||
| 208 | except: | ||
| 209 | pass | ||
| 210 | |||
| 211 | |||
| 212 | def get_tests_modules(include_hidden=False): | 162 | def get_tests_modules(include_hidden=False): |
| 213 | modules_list = list() | 163 | modules_list = list() |
| 214 | for modules_path in oeqa.selftest.__path__: | 164 | for modules_path in oeqa.selftest.__path__: |
| @@ -583,7 +533,6 @@ def main(): | |||
| 583 | log.error("Failed to import %s" % test) | 533 | log.error("Failed to import %s" % test) |
| 584 | log.error(e) | 534 | log.error(e) |
| 585 | return 1 | 535 | return 1 |
| 586 | add_include() | ||
| 587 | 536 | ||
| 588 | if args.machine: | 537 | if args.machine: |
| 589 | # Custom machine sets only weak default values (??=) for MACHINE in machine.inc | 538 | # Custom machine sets only weak default values (??=) for MACHINE in machine.inc |
| @@ -808,7 +757,4 @@ if __name__ == "__main__": | |||
| 808 | ret = 1 | 757 | ret = 1 |
| 809 | import traceback | 758 | import traceback |
| 810 | traceback.print_exc() | 759 | traceback.print_exc() |
| 811 | finally: | ||
| 812 | remove_include() | ||
| 813 | remove_inc_files() | ||
| 814 | sys.exit(ret) | 760 | sys.exit(ret) |
