CIAssignExampleTest.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http:#www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """
  15. Command line tool to assign example tests to CI test jobs.
  16. """
  17. # TODO: Need to handle running examples on different chips
  18. import os
  19. import sys
  20. import re
  21. import argparse
  22. test_fw_path = os.getenv("TEST_FW_PATH")
  23. if test_fw_path:
  24. sys.path.insert(0, test_fw_path)
  25. from Utility.CIAssignTest import AssignTest
  26. class CIExampleAssignTest(AssignTest):
  27. CI_TEST_JOB_PATTERN = re.compile(r"^example_test_.+")
  28. if __name__ == '__main__':
  29. parser = argparse.ArgumentParser()
  30. parser.add_argument("test_case",
  31. help="test case folder or file")
  32. parser.add_argument("ci_config_file",
  33. help="gitlab ci config file")
  34. parser.add_argument("output_path",
  35. help="output path of config files")
  36. args = parser.parse_args()
  37. assign_test = CIExampleAssignTest(args.test_case, args.ci_config_file)
  38. assign_test.assign_cases()
  39. assign_test.output_configs(args.output_path)