diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-08-18 19:55:51 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-20 16:08:58 +0100 |
commit | 9139d75736a5c1576db8fc88a57a629cfe9bc6dc (patch) | |
tree | 920e8b04361147c1c921679cb6d2724b4f18d1d5 /bitbake/bin/bitbake-selftest | |
parent | 5471b2cdc58e90da8d4c2f510b416b9dbc1b86e8 (diff) | |
download | poky-9139d75736a5c1576db8fc88a57a629cfe9bc6dc.tar.gz |
bitbake: bitbake-selftest: utilize unittest.main better
This simplifies the script, and, gives new features. It is now possible
to run single test functions, for example. This is nice when writing new
test cases.
(Bitbake rev: 8c513580b9406b031674f799117eae7410f8e01c)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/bitbake-selftest')
-rwxr-xr-x | bitbake/bin/bitbake-selftest | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/bitbake/bin/bitbake-selftest b/bitbake/bin/bitbake-selftest index 1e6f35ef0c..1e615ccf7d 100755 --- a/bitbake/bin/bitbake-selftest +++ b/bitbake/bin/bitbake-selftest | |||
@@ -25,31 +25,17 @@ try: | |||
25 | except RuntimeError as exc: | 25 | except RuntimeError as exc: |
26 | sys.exit(str(exc)) | 26 | sys.exit(str(exc)) |
27 | 27 | ||
28 | def usage(): | 28 | tests = ["bb.tests.codeparser", |
29 | print('usage: [BB_SKIP_NETTESTS=yes] %s [-v] [testname1 [testname2]...]' % os.path.basename(sys.argv[0])) | 29 | "bb.tests.cow", |
30 | 30 | "bb.tests.data", | |
31 | verbosity = 1 | 31 | "bb.tests.fetch", |
32 | 32 | "bb.tests.parse", | |
33 | tests = sys.argv[1:] | 33 | "bb.tests.utils"] |
34 | if '-v' in sys.argv: | ||
35 | tests.remove('-v') | ||
36 | verbosity = 2 | ||
37 | |||
38 | if tests: | ||
39 | if '--help' in sys.argv[1:]: | ||
40 | usage() | ||
41 | sys.exit(0) | ||
42 | else: | ||
43 | tests = ["bb.tests.codeparser", | ||
44 | "bb.tests.cow", | ||
45 | "bb.tests.data", | ||
46 | "bb.tests.fetch", | ||
47 | "bb.tests.parse", | ||
48 | "bb.tests.utils"] | ||
49 | 34 | ||
50 | for t in tests: | 35 | for t in tests: |
51 | t = '.'.join(t.split('.')[:3]) | 36 | t = '.'.join(t.split('.')[:3]) |
52 | __import__(t) | 37 | __import__(t) |
53 | 38 | ||
54 | unittest.main(argv=["bitbake-selftest"] + tests, verbosity=verbosity) | ||
55 | 39 | ||
40 | if __name__ == '__main__': | ||
41 | unittest.main(defaultTest=tests) | ||