Args:
args: List of positional args provided to fdt. This can hold a test
name to execute (as in 'fdt -t testFdt', for example)
+
+ Returns:
+ Return code, 0 on success
"""
result = unittest.TestResult()
- sys.argv = [sys.argv[0]]
test_name = args and args[0] or None
- for module in (TestFdt, TestNode, TestProp, TestFdtUtil):
- if test_name:
- try:
- suite = unittest.TestLoader().loadTestsFromName(test_name, module)
- except AttributeError:
- continue
- else:
- suite = unittest.TestLoader().loadTestsFromTestCase(module)
- suite.run(result)
-
- print(result)
- for _, err in result.errors:
- print(err)
- for _, err in result.failures:
- print(err)
+ test_util.run_test_suites(
+ result, False, False, False, None, test_name, None,
+ [TestFdt, TestNode, TestProp, TestFdtUtil])
+
+ return test_util.report_result('fdt', test_name, result)
if __name__ != '__main__':
sys.exit(1)
# Run our meagre tests
if options.test:
- RunTests(args)
+ ret_code = RunTests(args)
+ sys.exit(ret_code)
elif options.test_coverage:
RunTestCoverage()