testsdk.bbclass 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (C) 2013 - 2016 Intel Corporation
  2. #
  3. # Released under the MIT license (see COPYING.MIT)
  4. # testsdk.bbclass enables testing for SDK and Extensible SDK
  5. #
  6. # To run SDK tests, run the commands:
  7. # $ bitbake <image-name> -c populate_sdk
  8. # $ bitbake <image-name> -c testsdk
  9. #
  10. # To run eSDK tests, run the commands:
  11. # $ bitbake <image-name> -c populate_sdk_ext
  12. # $ bitbake <image-name> -c testsdkext
  13. #
  14. # where "<image-name>" is an image like core-image-sato.
  15. TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK"
  16. TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt"
  17. def import_and_run(name, d):
  18. import importlib
  19. class_name = d.getVar(name)
  20. if class_name:
  21. module, cls = class_name.rsplit('.', 1)
  22. m = importlib.import_module(module)
  23. c = getattr(m, cls)()
  24. c.run(d)
  25. else:
  26. bb.warn('No tests were run because %s did not define a class' % name)
  27. import_and_run[vardepsexclude] = "DATETIME BB_ORIGENV"
  28. python do_testsdk() {
  29. import_and_run('TESTSDK_CLASS_NAME', d)
  30. }
  31. addtask testsdk
  32. do_testsdk[nostamp] = "1"
  33. python do_testsdkext() {
  34. import_and_run('TESTSDKEXT_CLASS_NAME', d)
  35. }
  36. addtask testsdkext
  37. do_testsdkext[nostamp] = "1"
  38. python () {
  39. if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
  40. bb.build.addtask("testsdk", None, "do_populate_sdk", d)
  41. bb.build.addtask("testsdkext", None, "do_populate_sdk_ext", d)
  42. }