1# for parallel jobs, CI_JOB_NAME will be "job_name index/total" (for example, "IT_001 1/2")
2# we need to convert to pattern "job_name_index.yml"
3.define_config_file_name: &define_config_file_name |
4  JOB_NAME_PREFIX=$(echo ${CI_JOB_NAME} | awk '{print $1}')
5  JOB_FULL_NAME="${JOB_NAME_PREFIX}_${CI_NODE_INDEX}"
6  CONFIG_FILE="${CONFIG_FILE_PATH}/${JOB_FULL_NAME}.yml"
7
8.target_test_job_template:
9  stage: target_test
10  needs:
11    - assign_test
12  artifacts:
13    when: always
14    paths:
15      - $LOG_PATH
16    expire_in: 1 week
17    reports:
18      junit: $LOG_PATH/*/XUNIT_RESULT.xml
19  variables:
20    TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
21    LOG_PATH: "$CI_PROJECT_DIR/TEST_LOGS"
22    ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
23    SUBMODULES_TO_FETCH: "components/esptool_py/esptool"
24  script:
25    - *define_config_file_name
26    # first test if config file exists, if not exist, exit 0
27    - |
28      { [[ -e $CONFIG_FILE ]]; } || { echo 'No config file found. Consider decreasing the parallel count of this job in ".gitlab/ci/target-test.yml"'; exit 0; }
29    # clone test env configs
30    - retry_failed git clone $TEST_ENV_CONFIG_REPO
31    - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
32    # git clone the known failure cases repo, run test
33    - retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases
34    # run test
35    - cd tools/ci/python_packages/tiny_test_fw/bin
36    - run_cmd python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE --known_failure_cases_file $CI_PROJECT_DIR/known_failure_cases/known_failure_cases.txt
37
38.example_test_template:
39  extends:
40    - .target_test_job_template
41    - .rules:tests:example_test-schedule
42  variables:
43    TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
44    CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/examples/test_configs"
45
46.example_debug_template:
47  extends: .example_test_template
48  variables:
49    SUBMODULES_TO_FETCH: "all"
50
51.test_app_template:
52  extends:
53    - .target_test_job_template
54    - .rules:tests:custom_test-schedule
55  variables:
56    TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/test_apps"
57    CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/test_apps/test_configs"
58
59.component_ut_template:
60  extends:
61    - .target_test_job_template
62    - .rules:tests:unit_test
63  variables:
64    CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/component_ut/test_configs"
65  script:
66    - *define_config_file_name
67    # first test if config file exists, if not exist, exit 0
68    - test -e $CONFIG_FILE || exit 0
69    - set_component_ut_vars
70    # clone test env configs
71    - retry_failed git clone $TEST_ENV_CONFIG_REPO
72    - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
73    # git clone the known failure cases repo, run test
74    - retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases
75    # run test
76    - cd tools/ci/python_packages/tiny_test_fw/bin
77    - run_cmd python Runner.py $COMPONENT_UT_DIRS -c $CONFIG_FILE -e $ENV_FILE  --known_failure_cases_file $CI_PROJECT_DIR/known_failure_cases/known_failure_cases.txt
78
79.component_ut_32_template:
80  extends:
81    - .component_ut_template
82    - .rules:tests:unit_test_32
83
84.component_ut_s2_template: # unused yet
85  extends:
86    - .component_ut_template
87    - .rules:tests:unit_test_s2
88
89.unit_test_template:
90  extends:
91    - .target_test_job_template
92    - .rules:tests:unit_test
93  variables:
94    TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
95    CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/unit_test/CIConfigs"
96
97.unit_test_32_template:
98  extends:
99    - .unit_test_template
100    - .rules:tests:unit_test_32
101
102.unit_test_s2_template:
103  extends:
104    - .unit_test_template
105    - .rules:tests:unit_test_s2
106
107.unit_test_c3_template:
108  extends:
109    - .unit_test_template
110    - .rules:tests:unit_test_c3 # due to the lack of runners, c3 tests will only be triggered by label
111
112.integration_test_template:
113  extends:
114    - .target_test_job_template
115    - .rules:tests:integration_test
116  needs:
117    - assign_test
118    - build_ssc_esp32
119  variables:
120    LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
121    LOG_PATH: "${CI_PROJECT_DIR}/${CI_COMMIT_SHA}"
122    TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
123    MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
124    CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
125    KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/components/idf_test/integration_test/KnownIssues"
126    CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py"
127    PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
128    # auto_test_script only supports python 3.7.x
129    PYTHON_VER: 3.7.7
130  script:
131    - *define_config_file_name
132    # first test if config file exists, if not exist, exit 0
133    - test -e $CONFIG_FILE || exit 0
134    # clone local test env configs
135    - retry_failed git clone $TEST_ENV_CONFIG_REPO
136    - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
137    # clone test bench
138    # can not retry if downing git lfs files failed, so using empty_branch first.
139    - retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
140    - retry_failed git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
141    - python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
142    - cat ${KNOWN_ISSUE_FILE} >> ${TEST_CASE_FILE_PATH}/KnownIssues
143    # run test
144    - python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
145
146test_weekend_mqtt:
147  extends:
148    - .example_test_template
149    - .rules:labels:weekend_test-only
150  tags:
151    - ESP32
152    - Example_WIFI
153  variables:
154    ENV_FILE: "$CI_PROJECT_DIR/components/mqtt/weekend_test/env.yml"
155    TEST_CASE_PATH: "$CI_PROJECT_DIR/components/mqtt/weekend_test"
156    CONFIG_FILE_PATH: "$CI_PROJECT_DIR/components/mqtt/weekend_test"
157
158test_weekend_network:
159  extends:
160    - .example_test_template
161    - .rules:labels:weekend_test-only
162  image: $CI_DOCKER_REGISTRY/rpi-net-suite$BOT_DOCKER_IMAGE_TAG
163  tags:
164    - ESP32
165    - Example_WIFI
166  variables:
167    ENV_FILE: "$CI_PROJECT_DIR/components/lwip/weekend_test/env.yml"
168    TEST_CASE_PATH: "$CI_PROJECT_DIR/components/lwip/weekend_test"
169    CONFIG_FILE_PATH: "$CI_PROJECT_DIR/components/lwip/weekend_test"
170
171example_test_001A:
172  extends: .example_test_template
173  parallel: 4
174  tags:
175    - ESP32
176    - Example_WIFI
177
178example_test_001B:
179  extends: .example_test_template
180  tags:
181    - ESP32
182    - Example_EthKitV1
183
184example_test_001B_V3:
185  extends: .example_test_template
186  tags:
187    - ESP32
188    - Example_EthKitV12
189
190example_test_001C:
191  extends: .example_test_template
192  parallel: 3
193  tags:
194    - ESP32
195    - Example_GENERIC
196
197example_test_001D:
198  extends: .example_test_template
199  tags:
200    - ESP32
201    - Example_8Mflash_Ethernet
202
203example_test_002:
204  extends: .example_test_template
205  image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
206  tags:
207    - ESP32
208    - Example_ShieldBox_Basic
209
210.example_test_003:
211  extends: .example_test_template
212  tags:
213    - ESP32
214    - Example_SDIO
215
216example_test_004A:
217  extends: .example_test_template
218  tags:
219    - ESP32
220    - Example_TWAI1
221
222example_test_004B:
223  extends: .example_test_template
224  tags:
225    - ESP32
226    - Example_TWAI2
227
228example_test_005:
229  extends: .example_test_template
230  tags:
231    - ESP32
232    - Example_WIFI_BT
233
234example_test_006:
235  extends:
236    - .example_test_template
237    - .rules:labels:iperf_stress_test-only
238  image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
239  tags:
240    - ESP32
241    - Example_ShieldBox
242
243example_test_007:
244  extends: .example_test_template
245  tags:
246    - ESP32
247    - Example_I2C_CCS811_SENSOR
248
249example_test_008A:
250  extends: .example_test_template
251  tags:
252    - ESP32
253    - Example_Flash_Encryption
254
255example_test_008B:
256  extends: .example_test_template
257  tags:
258    - ESP32
259    - Example_Flash_Encryption_OTA
260
261example_test_009:
262  extends: .example_test_template
263  tags:
264    - ESP32
265    - test_jtag_arm
266  artifacts:
267    paths:
268      - $CI_PROJECT_DIR/examples/*/*/*.log
269  variables:
270    SETUP_TOOLS: "1"
271    PYTHON_VER: 3
272
273example_test_010:
274  extends: .example_test_template
275  tags:
276    - ESP32
277    - Example_ExtFlash
278
279example_test_011:
280  extends: .example_debug_template
281  tags:
282    - ESP32
283    - Example_T2_RS485
284  artifacts:
285    paths:
286      - $CI_PROJECT_DIR/examples/protocols/modbus/serial/*.log
287      - $LOG_PATH
288  variables:
289    SETUP_TOOLS: "1"
290
291example_test_012:
292  extends: .example_test_template
293  tags:
294    - ESP32
295    - Example_RMT_IR_PROTOCOLS
296
297example_test_013:
298  extends: .example_test_template
299  tags:
300    - ESP32
301    - UT_T1_SDMODE
302
303example_test_014:
304  extends: .example_test_template
305  tags:
306    - ESP32
307    - 8Mpsram
308
309example_test_015:
310  extends: .example_test_template
311  tags:
312    - ESP32
313    - Example_PPP
314  artifacts:
315    paths:
316      - $CI_PROJECT_DIR/examples/*/*/*.log
317      - $LOG_PATH
318
319example_test_016:
320  extends: .example_test_template
321  tags:
322    - ESP32
323    - Example_Modbus_TCP
324  artifacts:
325    paths:
326      - $CI_PROJECT_DIR/examples/*/*/*.log
327      - $LOG_PATH
328
329test_app_test_001:
330  extends: .test_app_template
331  tags:
332    - ESP32
333    - test_jtag_arm
334  artifacts:
335    paths:
336      - $CI_PROJECT_DIR/tools/test_apps/system/*/*.log
337  variables:
338    SETUP_TOOLS: "1"
339
340test_app_test_002:
341  extends: .test_app_template
342  tags:
343    - ESP32
344    - Example_WIFI
345
346test_app_test_003:
347  extends: .test_app_template
348  tags:
349    - ESP32
350    - Example_PPP
351
352test_app_test_004:
353  extends: .test_app_template
354  tags:
355    - ESP32S2
356    - Example_GENERIC
357
358test_app_test_005:
359  extends: .test_app_template
360  tags:
361    - ESP32C3
362    - Example_GENERIC
363
364test_app_test_esp32_generic:
365  extends: .test_app_template
366  parallel: 4
367  tags:
368    - ESP32
369    - Example_GENERIC
370  variables:
371    SETUP_TOOLS: "1"
372
373component_ut_test_001:
374  extends: .component_ut_32_template
375  tags:
376    - ESP32
377    - COMPONENT_UT_GENERIC
378
379UT_001:
380  extends: .unit_test_32_template
381  parallel: 48
382  tags:
383    - ESP32_IDF
384    - UT_T1_1
385
386# Max. allowed value of 'parallel' is 50.
387
388UT_002:
389  extends: .unit_test_32_template
390  parallel: 13
391  tags:
392    - ESP32_IDF
393    - UT_T1_1
394    - psram
395
396UT_003:
397  extends: .unit_test_32_template
398  parallel: 2
399  tags:
400    - ESP32_IDF
401    - UT_T1_SDMODE
402
403UT_004:
404  extends: .unit_test_32_template
405  tags:
406    - ESP32_IDF
407    - UT_T1_SPIMODE
408
409UT_005:
410  extends: .unit_test_32_template
411  tags:
412    - ESP32_IDF
413    - UT_T1_SDMODE
414    - psram
415
416UT_006:
417  extends: .unit_test_32_template
418  tags:
419    - ESP32_IDF
420    - UT_T1_SPIMODE
421    - psram
422
423UT_008:
424  extends: .unit_test_32_template
425  tags:
426    - ESP32_IDF
427    - UT_T1_GPIO
428    - psram
429
430UT_012:
431  extends: .unit_test_32_template
432  tags:
433    - ESP32_IDF
434    - UT_T1_LEDC
435    - psram
436
437UT_014:
438  extends: .unit_test_32_template
439  tags:
440    - ESP32_IDF
441    - UT_T2_RS485
442    - psram
443
444UT_015:
445  extends: .unit_test_32_template
446  tags:
447    - ESP32_IDF
448    - UT_T1_RMT
449
450UT_016:
451  extends: .unit_test_32_template
452  tags:
453    - ESP32_IDF
454    - UT_T1_RMT
455    - psram
456
457UT_017:
458  extends: .unit_test_32_template
459  tags:
460    - ESP32_IDF
461    - EMMC
462
463UT_018:
464  extends: .unit_test_32_template
465  parallel: 2
466  tags:
467    - ESP32_IDF
468    - UT_T1_1
469    - 8Mpsram
470
471UT_020:
472  extends: .unit_test_32_template
473  tags:
474    - ESP32_IDF
475    - Example_SPI_Multi_device
476    - psram
477
478UT_021:
479  extends: .unit_test_32_template
480  parallel: 2
481  tags:
482    - ESP32_IDF
483    - psram
484    - UT_T1_FlashEncryption
485
486UT_022:
487  extends: .unit_test_32_template
488  tags:
489    - ESP32_IDF
490    - UT_T2_I2C
491    - psram
492
493UT_023:
494  extends: .unit_test_32_template
495  parallel: 2
496  tags:
497    - ESP32_IDF
498    - UT_T1_MCPWM
499
500UT_024:
501  extends: .unit_test_32_template
502  tags:
503    - ESP32_IDF
504    - UT_T1_MCPWM
505    - psram
506
507UT_028:
508  extends: .unit_test_32_template
509  tags:
510    - ESP32_IDF
511    - UT_T2_1
512    - psram
513
514UT_031:
515  extends: .unit_test_32_template
516  tags:
517    - ESP32_IDF
518    - UT_T1_FlashEncryption
519
520UT_033:
521  extends: .unit_test_32_template
522  tags:
523    - ESP32_IDF
524    - UT_T2_Ethernet
525    - psram
526
527UT_034:
528  extends: .unit_test_32_template
529  parallel: 3
530  tags:
531    - ESP32_IDF
532    - UT_T1_ESP_FLASH
533
534UT_035:
535  extends: .unit_test_s2_template
536  parallel: 50
537  tags:
538    - ESP32S2_IDF
539    - UT_T1_1
540
541UT_036:
542  extends: .unit_test_32_template
543  tags:
544    - ESP32_IDF
545    - UT_T1_PSRAMV0
546    - psram
547
548# ToDo: re-enable this job when ESP32-S2 LEDC runner installed
549# UT_037:
550#   extends: .unit_test_s2_template
551#   tags:
552#     - ESP32S2_IDF
553#     - UT_T1_LEDC
554
555UT_038:
556  extends: .unit_test_s2_template
557  parallel: 3
558  tags:
559    - ESP32S2_IDF
560    - UT_T1_ESP_FLASH
561
562UT_041:
563  extends: .unit_test_32_template
564  tags:
565    - ESP32_IDF
566    - UT_T1_no32kXTAL
567    - psram
568
569UT_043:
570  extends: .unit_test_32_template
571  tags:
572    - ESP32_IDF
573    - UT_T1_32kXTAL
574    - psram
575
576UT_044:
577  extends: .unit_test_32_template
578  tags:
579    - ESP32_IDF
580    - UT_SDIO
581
582UT_045:
583  extends: .unit_test_32_template
584  tags:
585    - ESP32_IDF
586    - UT_SDIO
587    - psram
588
589UT_046:
590  extends: .unit_test_32_template
591  tags:
592    - ESP32_IDF
593    - UT_T1_GPIO
594
595UT_C3:
596  extends: .unit_test_c3_template
597  parallel: 29
598  tags:
599    - ESP32C3_IDF
600    - UT_T1_1
601
602UT_C3_FLASH:
603  extends: .unit_test_c3_template
604  parallel: 2
605  tags:
606    - ESP32C3_IDF
607    - UT_T1_ESP_FLASH
608
609UT_C3_SPI_DUAL:
610  extends: .unit_test_c3_template
611  parallel: 2
612  tags:
613    - ESP32C3_IDF
614    - Example_SPI_Multi_device
615
616UT_C3_I2C:
617  extends: .unit_test_c3_template
618  tags:
619    - ESP32C3_IDF
620    - UT_T2_I2C
621
622nvs_compatible_test:
623  extends: .integration_test_template
624  artifacts:
625    when: always
626    paths:
627      - $LOG_PATH
628      - nvs_wifi.bin
629    expire_in: 1 mos
630  tags:
631    - ESP32_IDF
632    - NVS_Compatible
633  script:
634    - *define_config_file_name
635    # first test if config file exists, if not exist, exit 0
636    - test -e $CONFIG_FILE || exit 0
637    # clone local test env configs
638    - retry_failed git clone $TEST_ENV_CONFIG_REPO
639    - python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
640    # clone test bench
641    # can not retry if downing git lfs files failed, so using empty_branch first.
642    - retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
643    - retry_failed git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
644    - python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script --customized_only
645    # prepare nvs bins
646    - cd auto_test_script
647    - ./tools/prepare_nvs_bin.sh
648    # run test
649    - python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
650
651IT_001:
652  extends: .integration_test_template
653  parallel: 3
654  tags:
655    - ESP32_IDF
656    - SSC_T1_4
657
658IT_002:
659  extends: .integration_test_template
660  tags:
661    - ESP32_IDF
662    - SSC_T1_2
663
664IT_003:
665  extends: .integration_test_template
666  parallel: 14
667  tags:
668    - ESP32_IDF
669    - SSC_T2_5
670
671IT_004:
672  extends: .integration_test_template
673  tags:
674    - ESP32_IDF
675    - SSC_T1_APC
676
677IT_005:
678  extends: .integration_test_template
679  parallel: 2
680  tags:
681    - ESP32_IDF
682    - SSC_T1_5
683
684IT_006:
685  extends: .integration_test_template
686  parallel: 12
687  tags:
688    - ESP32_IDF
689    - SSC_T1_6
690
691IT_007:
692  extends: .integration_test_template
693  parallel: 3
694  tags:
695    - ESP32_IDF
696    - SSC_T1_7
697
698IT_008:
699  extends: .integration_test_template
700  tags:
701    - ESP32_IDF
702    - SSC_T1_8
703
704IT_009:
705  extends: .integration_test_template
706  tags:
707    - ESP32_IDF
708    - SSC_T1_3
709
710IT_011:
711  extends: .integration_test_template
712  tags:
713    - ESP32_IDF
714    - SSC_T1_MESH1
715
716IT_012:
717  extends: .integration_test_template
718  parallel: 2
719  tags:
720    - ESP32_IDF
721    - SSC_T2_MESH1
722
723IT_013:
724  extends: .integration_test_template
725  tags:
726    - ESP32_IDF
727    - SSC_T3_MESH1
728
729IT_014:
730  extends: .integration_test_template
731  tags:
732    - ESP32_IDF
733    - SSC_T6_MESH1
734
735IT_015:
736  extends: .integration_test_template
737  tags:
738    - ESP32_IDF
739    - SSC_T12_MESH1
740
741IT_016:
742  extends: .integration_test_template
743  allow_failure: true
744  tags:
745    - ESP32_IDF
746    - SSC_T50_MESH1
747
748IT_017:
749  extends: .integration_test_template
750  tags:
751    - ESP32_IDF
752    - SSC_T1_MESH2
753
754IT_018:
755  extends: .integration_test_template
756  tags:
757    - ESP32_IDF
758    - SSC_T1_9
759
760IT_019:
761  extends: .integration_test_template
762  parallel: 2
763  tags:
764    - ESP32_IDF
765    - SSC_T2_2
766
767IT_020:
768  extends: .integration_test_template
769  tags:
770    - ESP32_IDF
771    - SSC_T2_3
772
773IT_021:
774  extends: .integration_test_template
775  tags:
776    - ESP32_IDF
777    - SSC_T2_4
778