suite.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #
  5. import os
  6. import json
  7. class CTestSuiteBase(object):
  8. def __init__(self, name, suite_path, run_path):
  9. self.suite_path=suite_path
  10. self.run_path=run_path
  11. self.m_name = name
  12. self.settings = {}
  13. def get_settings_item(self, item):
  14. if item in self.settings:
  15. return self.settings[item]
  16. else:
  17. return None
  18. def load_settings(self):
  19. path = self.suite_path + "/settings.cfg"
  20. if os.path.isfile(path):
  21. try:
  22. fp = open(path, 'r')
  23. self.settings = json.load(fp)
  24. fp.close()
  25. except Exception, e:
  26. return False, 'Load settings fail: ' + e.message
  27. return True, 'OK'
  28. else:
  29. return True, 'No file'
  30. def on_suite_setup(self):
  31. return True, 'OK'
  32. def on_suite_cleanup(self):
  33. return True, 'OK'