diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2014-02-24 18:50:03 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-28 14:50:43 +0000 |
commit | 2f8be92de684f848d74655654f06b8a64bd13320 (patch) | |
tree | 8ccfc8a3de035e175465f5b094edacbad8f1c39c /bitbake/bin | |
parent | 957c9a80bc698845475591912c8cb6ae42077d19 (diff) | |
download | poky-2f8be92de684f848d74655654f06b8a64bd13320.tar.gz |
bitbake: bitbake-selftest: enable specifying tests to run on command line
If you are just trying to fix one test at a time, it can be useful to be
able to specify an individual test(s) rather than running them all:
bitbake-selftest bb.tests.codeparser bb.tests.cow
You can even specify the test class or function to run, e.g.:
bitbake-selftest bb.tests.fetch.URITest
bitbake-selftest bb.tests.fetch.FetcherNetworkTest.test_fetch
(Bitbake rev: 4df9c72663e972437131a848e6ddcf3769ae1d2b)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-x | bitbake/bin/bitbake-selftest | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/bitbake/bin/bitbake-selftest b/bitbake/bin/bitbake-selftest index 48a58fef67..8c55f7ba15 100755 --- a/bitbake/bin/bitbake-selftest +++ b/bitbake/bin/bitbake-selftest | |||
@@ -25,13 +25,24 @@ try: | |||
25 | except RuntimeError as exc: | 25 | except RuntimeError as exc: |
26 | sys.exit(str(exc)) | 26 | sys.exit(str(exc)) |
27 | 27 | ||
28 | tests = ["bb.tests.codeparser", | 28 | def usage(): |
29 | "bb.tests.cow", | 29 | print('usage: %s [testname1 [testname2]...]') |
30 | "bb.tests.data", | 30 | |
31 | "bb.tests.fetch", | 31 | if len(sys.argv) > 1: |
32 | "bb.tests.utils"] | 32 | if '--help' in sys.argv[1:]: |
33 | usage() | ||
34 | sys.exit(0) | ||
35 | |||
36 | tests = sys.argv[1:] | ||
37 | else: | ||
38 | tests = ["bb.tests.codeparser", | ||
39 | "bb.tests.cow", | ||
40 | "bb.tests.data", | ||
41 | "bb.tests.fetch", | ||
42 | "bb.tests.utils"] | ||
33 | 43 | ||
34 | for t in tests: | 44 | for t in tests: |
45 | t = '.'.join(t.split('.')[:3]) | ||
35 | __import__(t) | 46 | __import__(t) |
36 | 47 | ||
37 | unittest.main(argv=["bitbake-selftest"] + tests) | 48 | unittest.main(argv=["bitbake-selftest"] + tests) |