aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/tests/test_runner.py
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-11-09 11:26:59 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:03:53 +0000
commit7d7d0dc3736fc12ae7848de2785f0066e6470cd1 (patch)
tree75ce289509c144145be42cb58f4b7a62f602a535 /meta/lib/oeqa/core/tests/test_runner.py
parent7dc519d20e835ee7693c31903e164c4bc0e5e598 (diff)
downloadopenembedded-core-contrib-7d7d0dc3736fc12ae7848de2785f0066e6470cd1.tar.gz
oeqa/core: Add tests for the OEQA framework
This test suite covers the current functionality for the OEQA framework. For run certain test suite, $ cd meta/lib/oeqa/core/tests $ ./test_data.py Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Diffstat (limited to 'meta/lib/oeqa/core/tests/test_runner.py')
-rwxr-xr-xmeta/lib/oeqa/core/tests/test_runner.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/tests/test_runner.py b/meta/lib/oeqa/core/tests/test_runner.py
new file mode 100755
index 0000000000..a3f3861fed
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/test_runner.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import unittest
+import logging
+import tempfile
+
+from common import setup_sys_path, TestBase
+setup_sys_path()
+
+from oeqa.core.runner import OEStreamLogger
+
+class TestRunner(TestBase):
+ def test_stream_logger(self):
+ fp = tempfile.TemporaryFile(mode='w+')
+
+ logging.basicConfig(format='%(message)s', stream=fp)
+ logger = logging.getLogger()
+ logger.setLevel(logging.INFO)
+
+ oeSL = OEStreamLogger(logger)
+
+ lines = ['init', 'bigline_' * 65535, 'morebigline_' * 65535 * 4, 'end']
+ for line in lines:
+ oeSL.write(line)
+
+ fp.seek(0)
+ fp_lines = fp.readlines()
+ for i, fp_line in enumerate(fp_lines):
+ fp_line = fp_line.strip()
+ self.assertEqual(lines[i], fp_line)
+
+ fp.close()
+
+if __name__ == '__main__':
+ unittest.main()