diff options
author | Ross Burton <ross.burton@intel.com> | 2015-06-22 17:20:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-27 22:42:52 +0100 |
commit | b053b81e68573f5b5822a3b61f8fdd4d0d366442 (patch) | |
tree | 4f281620e5436114b6becf7833b21662752e3dfd /scripts/oe-selftest | |
parent | 545ff77df6fba7d6391033c6eed3cb99680cb522 (diff) | |
download | openembedded-core-contrib-b053b81e68573f5b5822a3b61f8fdd4d0d366442.tar.gz |
oe-selftest: timestamp the test runs
The selftest can take a couple of hours to run, so add a custom result class to
timestamp the output to make it easy to spot any slow tests.
(From OE-Core rev: cce89c44948ee66ad0abb491be57e270038270e4)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-selftest')
-rwxr-xr-x | scripts/oe-selftest | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index a04e9fc96cc..fd58a66123e 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -176,7 +176,7 @@ def main(): suite = unittest.TestSuite() loader = unittest.TestLoader() loader.sortTestMethodsUsing = None - runner = unittest.TextTestRunner(verbosity=2) + runner = unittest.TextTestRunner(verbosity=2, resultclass=StampedResult) # we need to do this here, otherwise just loading the tests # will take 2 minutes (bitbake -e calls) oeSelfTest.testlayer_path = get_test_layer() @@ -196,6 +196,17 @@ def main(): else: return 1 +class StampedResult(unittest.TextTestResult): + """ + Custom TestResult that prints the time when a test starts. As oe-selftest + can take a long time (ie a few hours) to run, timestamps help us understand + what tests are taking a long time to execute. + """ + def startTest(self, test): + import time + self.stream.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + " - ") + super(StampedResult, self).startTest(test) + if __name__ == "__main__": try: ret = main() |