diff options
author | Simon Glass <sjg@chromium.org> | 2020-10-29 21:46:28 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-11-05 09:11:31 -0700 |
commit | 4af99874562f2ae26e84a9904009c7ce121d540d (patch) | |
tree | cf368df7e353963f8752651e590e6f655e38b2af /tools/patman/main.py | |
parent | 7457051e41be1058494bcb96f8ebd05176a3e6cc (diff) | |
download | u-boot-4af99874562f2ae26e84a9904009c7ce121d540d.tar.gz u-boot-4af99874562f2ae26e84a9904009c7ce121d540d.tar.xz u-boot-4af99874562f2ae26e84a9904009c7ce121d540d.zip |
patman: Add some tests for warnings
Add tests that check that warnings are generated when expected.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/main.py')
-rwxr-xr-x | tools/patman/main.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/patman/main.py b/tools/patman/main.py index b96000807e..d1a43c44fc 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -86,6 +86,8 @@ AddCommonArgs(send) send.add_argument('patchfiles', nargs='*') test_parser = subparsers.add_parser('test', help='Run tests') +test_parser.add_argument('testname', type=str, default=None, nargs='?', + help="Specify the test to run") AddCommonArgs(test_parser) # Parse options twice: first to get the project and second to handle @@ -111,15 +113,23 @@ if args.cmd == 'test': sys.argv = [sys.argv[0]] result = unittest.TestResult() + suite = unittest.TestSuite() + loader = unittest.TestLoader() for module in (test_checkpatch.TestPatch, func_test.TestFunctional): - suite = unittest.TestLoader().loadTestsFromTestCase(module) - suite.run(result) + if args.testname: + try: + suite.addTests(loader.loadTestsFromName(args.testname, module)) + except AttributeError: + continue + else: + suite.addTests(loader.loadTestsFromTestCase(module)) + suite.run(result) for module in ['gitutil', 'settings', 'terminal']: suite = doctest.DocTestSuite(module) suite.run(result) - sys.exit(test_util.ReportResult('patman', None, result)) + sys.exit(test_util.ReportResult('patman', args.testname, result)) # Process commits, produce patches files, check them, email them elif args.cmd == 'send': |