]> granicus.if.org Git - esp-idf/blob - tools/tiny-test-fw/CIAssignExampleTest.py
Merge branch 'bugfix/btdm_fix_connect_interval_error_in_slave_adv_params' into 'master'
[esp-idf] / tools / tiny-test-fw / CIAssignExampleTest.py
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 """
16 Command line tool to assign example tests to CI test jobs.
17 """
18
19 # TODO: Need to handle running examples on different chips
20 import os
21 import sys
22 import re
23 import argparse
24
25 test_fw_path = os.getenv("TEST_FW_PATH")
26 if test_fw_path:
27     sys.path.insert(0, test_fw_path)
28
29 from Utility.CIAssignTest import AssignTest, Group
30
31
32 class ExampleGroup(Group):
33     SORT_KEYS = CI_JOB_MATCH_KEYS = ["env_tag", "chip"]
34
35
36 class CIExampleAssignTest(AssignTest):
37     CI_TEST_JOB_PATTERN = re.compile(r"^example_test_.+")
38
39
40 if __name__ == '__main__':
41     parser = argparse.ArgumentParser()
42     parser.add_argument("test_case",
43                         help="test case folder or file")
44     parser.add_argument("ci_config_file",
45                         help="gitlab ci config file")
46     parser.add_argument("output_path",
47                         help="output path of config files")
48     args = parser.parse_args()
49
50     assign_test = CIExampleAssignTest(args.test_case, args.ci_config_file, case_group=ExampleGroup)
51     assign_test.assign_cases()
52     assign_test.output_configs(args.output_path)