diff options
-rw-r--r-- | meta/lib/oeqa/oetest.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py index 8ad3715aec..7abd850f63 100644 --- a/meta/lib/oeqa/oetest.py +++ b/meta/lib/oeqa/oetest.py | |||
@@ -385,6 +385,43 @@ class RuntimeTestContext(TestContext): | |||
385 | if oeTest.hasPackage("procps"): | 385 | if oeTest.hasPackage("procps"): |
386 | oeRuntimeTest.pscmd = "ps -ef" | 386 | oeRuntimeTest.pscmd = "ps -ef" |
387 | 387 | ||
388 | def _getJsonFile(self, module): | ||
389 | """ | ||
390 | Returns the path of the JSON file for a module, empty if doesn't exitst. | ||
391 | """ | ||
392 | |||
393 | module_file = module.filename | ||
394 | json_file = "%s.json" % module_file.rsplit(".", 1)[0] | ||
395 | if os.path.isfile(module_file) and os.path.isfile(json_file): | ||
396 | return json_file | ||
397 | else: | ||
398 | return "" | ||
399 | |||
400 | def _getNeededPackages(self, json_file, test=None): | ||
401 | """ | ||
402 | Returns a dict with needed packages based on a JSON file. | ||
403 | |||
404 | |||
405 | If a test is specified it will return the dict just for that test. | ||
406 | """ | ||
407 | |||
408 | import json | ||
409 | |||
410 | needed_packages = {} | ||
411 | |||
412 | with open(json_file) as f: | ||
413 | test_packages = json.load(f) | ||
414 | for key,value in test_packages.items(): | ||
415 | needed_packages[key] = value | ||
416 | |||
417 | if test: | ||
418 | if test in needed_packages: | ||
419 | needed_packages = needed_packages[test] | ||
420 | else: | ||
421 | needed_packages = {} | ||
422 | |||
423 | return needed_packages | ||
424 | |||
388 | class ImageTestContext(RuntimeTestContext): | 425 | class ImageTestContext(RuntimeTestContext): |
389 | def __init__(self, d, target, host_dumper): | 426 | def __init__(self, d, target, host_dumper): |
390 | super(ImageTestContext, self).__init__(d, target) | 427 | super(ImageTestContext, self).__init__(d, target) |