Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ pyshtables.py
/bin/bitbakec
*.swp
tags
.coverage
htmlcov/
44 changes: 28 additions & 16 deletions bin/bitbake-selftest
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,36 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import os
import sys, logging
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
"""

Prerequirements:
% pip install nose
% pip install coverage

* bitbake-selftest Usage:

* Code coverage analysis

import unittest
try:
import bb
except RuntimeError as exc:
sys.exit(str(exc))
Run all tests with coverage from bitbake top dir:
% ./bin/bitbake-selftest --with-coverage

tests = ["bb.tests.codeparser",
"bb.tests.cow",
"bb.tests.data",
"bb.tests.fetch",
"bb.tests.utils"]
Generate HTML coverage reports under htmlcov (default):
% coverage html && firefox htmlcov/index.html

for t in tests:
__import__(t)
* Has same options as nosetests

unittest.main(argv=["bitbake-selftest"] + tests)
Specify a specific unit testsuite:
% ./bin/bitbake-selftest -v lib/bb/tests/test_data.py

Specify a specific testcase from a test suite:
% ./bin/bitbake-selftest -v lib/bb/tests/test_fetch.py:FetcherNetworkTest.test_gitfetch

"""

import os
import sys
import nose
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + '/lib')

if __name__ == '__main__':
nose.run(argv=sys.argv)
Loading