]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-selftest: Improved --list-classes when determining test names
authorDaniel Istrate <daniel.alexandrux.istrate@intel.com>
Mon, 4 Jan 2016 13:43:56 +0000 (15:43 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Jan 2016 13:40:04 +0000 (13:40 +0000)
--list-classes does a weak validation when determining test names:
(if method.startswith("test_") which could report any class attribute
that starts with 'test_' as a valid test case.

This fix checks that the class attribute that starts with 'test_'
is also callable (is a method).

Fix for [YOCTO #8862]

Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oe-selftest

index bd903f9e68fee6efdf724d60fc832ec0ac3b4d54..c32c419e19e5ae73b806fc9139fd9cdcd63bda75 100755 (executable)
@@ -453,7 +453,7 @@ def main():
                         if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest:
                             print " --", v
                             for method in dir(t):
-                                if method.startswith("test_"):
+                                if method.startswith("test_") and callable(vars(t)[method]):
                                     print " --  --", method
 
                 except (AttributeError, ImportError) as e: