1.host_test_template:
2  extends: .rules:test:host_test
3  stage: host_test
4  image: $ESP_ENV_IMAGE
5  variables:
6    PYTHON_VER: 3.6.13
7  tags:
8    - host_test
9  dependencies: []
10  needs: []  # run host_test jobs immediately
11
12test_nvs_on_host:
13  extends: .host_test_template
14  script:
15    - cd components/nvs_flash/test_nvs_host
16    - make test
17
18test_nvs_coverage:
19  extends:
20    - .host_test_template
21    - .rules:labels:nvs_coverage
22  artifacts:
23    paths:
24      - components/nvs_flash/test_nvs_host/coverage_report
25    expire_in: 1 week
26  script:
27    - cd components/nvs_flash/test_nvs_host
28    - make coverage_report
29  # the 'long' host tests take approx 11 hours on our current runners. Adding some margin here for possible CPU contention
30  timeout: 18 hours
31
32test_partition_table_on_host:
33  extends: .host_test_template
34  tags:
35    - build
36  script:
37    - cd components/partition_table/test_gen_esp32part_host
38    - ./gen_esp32part_tests.py
39
40test_wl_on_host:
41  extends: .host_test_template
42  artifacts:
43    paths:
44      - components/wear_levelling/test_wl_host/coverage_report.zip
45    expire_in: 1 week
46  script:
47    - cd components/wear_levelling/test_wl_host
48    - make test
49
50test_fatfs_on_host:
51  extends: .host_test_template
52  script:
53    - cd components/fatfs/test_fatfs_host/
54    - make test
55
56test_ldgen_on_host:
57  extends: .host_test_template
58  script:
59    - cd tools/ldgen/test
60    - ./test_fragments.py
61    - ./test_generation.py
62    - ./test_entity.py
63    - ./test_output_commands.py
64  variables:
65    LC_ALL: C.UTF-8
66
67.host_fuzzer_test_template:
68  extends:
69    - .host_test_template
70    - .rules:labels:fuzzer_test-weekend_test
71  image: $AFL_FUZZER_TEST_IMAGE
72  artifacts:
73    when: always
74    paths:
75      - ${FUZZER_TEST_DIR}/out/crashes
76      - ${FUZZER_TEST_DIR}/fuzz_output.log
77    expire_in: 1 week
78  script:
79    - export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 && export AFL_SKIP_CPUFREQ=1
80    - cd ${FUZZER_TEST_DIR}
81    # run AFL fuzzer for one hour
82    - ( ( make ${FUZZER_PARAMS} fuzz | tee fuzz_output.log | grep -v '\(Fuzzing test case\|Entering queue cycle\)' ) || pkill sleep ) &
83    - ( sleep 3600 || mkdir -p out/crashes/env_failed ) && pkill afl-fuz
84    # check no crashes found
85    - test -z "$(ls out/crashes/)" || exit 1
86
87test_mdns_fuzzer_on_host:
88  extends: .host_fuzzer_test_template
89  variables:
90    FUZZER_TEST_DIR: components/mdns/test_afl_fuzz_host
91
92test_lwip_dns_fuzzer_on_host:
93  extends: .host_fuzzer_test_template
94  variables:
95    FUZZER_TEST_DIR: components/lwip/test_afl_host
96    FUZZER_PARAMS: MODE=dns
97
98test_lwip_dhcp_fuzzer_on_host:
99  extends: .host_fuzzer_test_template
100  variables:
101    FUZZER_TEST_DIR: components/lwip/test_afl_host
102    FUZZER_PARAMS: MODE=dhcp_client
103
104test_lwip_dhcps_fuzzer_on_host:
105  extends: .host_fuzzer_test_template
106  variables:
107    FUZZER_TEST_DIR: components/lwip/test_afl_host
108    FUZZER_PARAMS: MODE=dhcp_server
109
110test_spiffs_on_host:
111  extends: .host_test_template
112  script:
113    - cd components/spiffs/test_spiffs_host/
114    - make test
115    - cd ../test_spiffsgen
116    - ./test_spiffsgen.py
117
118test_multi_heap_on_host:
119  extends: .host_test_template
120  script:
121    - cd components/heap/test_multi_heap_host
122    - ./test_all_configs.sh
123
124test_certificate_bundle_on_host:
125  extends: .host_test_template
126  tags:
127    - build
128  script:
129    - cd components/mbedtls/esp_crt_bundle/test_gen_crt_bundle/
130    - ./test_gen_crt_bundle.py
131
132test_confserver:
133  extends: .host_test_template
134  script:
135    - cd tools/kconfig_new/test/confserver
136    - ./test_confserver.py
137
138test_gen_kconfig_doc:
139  extends: .host_test_template
140  script:
141    - cd tools/kconfig_new/test/gen_kconfig_doc/
142    - ./test_target_visibility.py
143    - ./test_kconfig_out.py
144
145test_confgen:
146  extends: .host_test_template
147  script:
148    - cd tools/kconfig_new/test/confgen/
149    - ./test_confgen.py
150
151test_idf_monitor:
152  extends: .host_test_template
153  artifacts:
154    # save artifacts always in order to access results which were retried without consequent failure
155    when: always
156    paths:
157      - tools/test_idf_monitor/outputs/*
158    expire_in: 1 week
159  script:
160    - cd ${IDF_PATH}/tools/test_idf_monitor
161    - ./run_test_idf_monitor.py
162
163test_idf_size:
164  extends: .host_test_template
165  artifacts:
166    when: on_failure
167    paths:
168      - tools/test_idf_size/output
169      - tools/test_idf_size/.coverage
170    expire_in: 1 week
171  script:
172    - cd ${IDF_PATH}/tools/test_idf_size
173    - ./test.sh
174
175test_idf_py:
176  extends: .host_test_template
177  variables:
178    LC_ALL: C.UTF-8
179  script:
180    - cd ${IDF_PATH}/tools/test_idf_py
181    - ./test_idf_py.py
182
183test_idf_tools:
184  extends: .host_test_template
185  artifacts:
186    when: on_failure
187    paths:
188      - tools/tools.new.json
189    expire_in: 1 week
190  script:
191    # Remove Xtensa and ULP toolchains from the PATH, tests will expect a clean environment
192    - export PATH=$(p=$(echo $PATH | tr ":" "\n" | grep -v "/root/.espressif/tools\|/opt/espressif" | tr "\n" ":"); echo ${p%:})
193    - cd ${IDF_PATH}/tools/test_idf_tools
194    - ./test_idf_tools.py
195    # Test for create virtualenv. It must be invoked from Python, not from virtualenv.
196    - cd ${IDF_PATH}/tools
197    - python3 ./idf_tools.py install-python-env
198
199.test_efuse_table_on_host_template:
200  extends: .host_test_template
201  variables:
202    IDF_TARGET: "esp32"
203  artifacts:
204    when: on_failure
205    paths:
206      - components/efuse/${IDF_TARGET}/esp_efuse_table.c
207    expire_in: 1 week
208  script:
209    - cd ${IDF_PATH}/components/efuse/
210    - ./efuse_table_gen.py -t "${IDF_TARGET}" ${IDF_PATH}/components/efuse/${IDF_TARGET}/esp_efuse_table.csv
211    - git diff --exit-code -- ${IDF_TARGET}/esp_efuse_table.c || { echo 'Differences found for ${IDF_TARGET} target. Please run make efuse_common_table or idf.py efuse-common-table and commit the changes.'; exit 1; }
212    - cd ${IDF_PATH}/components/efuse/test_efuse_host
213    - ./efuse_tests.py
214
215test_efuse_table_on_host_esp32:
216  extends: .test_efuse_table_on_host_template
217
218test_efuse_table_on_host_esp32s2:
219  extends: .test_efuse_table_on_host_template
220  variables:
221    IDF_TARGET: esp32s2
222
223test_efuse_table_on_host_esp32s3:
224  extends: .test_efuse_table_on_host_template
225  variables:
226    IDF_TARGET: esp32s3
227
228test_efuse_table_on_host_esp32c3:
229  extends: .test_efuse_table_on_host_template
230  variables:
231    IDF_TARGET: esp32c3
232
233test_efuse_table_on_host_esp32h2:
234  extends: .test_efuse_table_on_host_template
235  variables:
236    IDF_TARGET: esp32h2
237
238test_espcoredump:
239  extends: .host_test_template
240  artifacts:
241    when: always
242    paths:
243      - components/espcoredump/test/**/.coverage
244      - components/espcoredump/test/**/output
245    expire_in: 1 week
246  variables:
247    IDF_COREDUMP_ELF_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/idf/idf-coredump-elf.git"
248    IDF_COREDUMP_ELF_TAG: idf-20210915
249    # install CMake version specified in tools.json
250    SETUP_TOOLS_LIST: "all"
251  script:
252    - retry_failed git clone ${IDF_COREDUMP_ELF_REPO} -b $IDF_COREDUMP_ELF_TAG
253    - cd ${IDF_PATH}/components/espcoredump/test/
254    - ./test_espcoredump.sh ${CI_PROJECT_DIR}/idf-coredump-elf
255
256test_logtrace_proc:
257  extends: .host_test_template
258  artifacts:
259    when: on_failure
260    paths:
261      - tools/esp_app_trace/test/logtrace/output
262      - tools/esp_app_trace/test/logtrace/.coverage
263    expire_in: 1 week
264  script:
265    - cd ${IDF_PATH}/tools/esp_app_trace/test/logtrace
266    - ./test.sh
267
268test_sysviewtrace_proc:
269  extends: .host_test_template
270  artifacts:
271    when: on_failure
272    paths:
273      - tools/esp_app_trace/test/sysview/output
274      - tools/esp_app_trace/test/sysview/.coverage
275    expire_in: 1 week
276  script:
277    - cd ${IDF_PATH}/tools/esp_app_trace/test/sysview
278    - ./test.sh
279
280test_mkdfu:
281  extends: .host_test_template
282  variables:
283    LC_ALL: C.UTF-8
284  script:
285    - cd ${IDF_PATH}/tools/test_mkdfu
286    - ./test_mkdfu.py
287
288test_mkuf2:
289  extends: .host_test_template
290  script:
291    - cd ${IDF_PATH}/tools/test_mkuf2
292    - ./test_mkuf2.py
293
294test_autocomplete:
295  extends: .host_test_template
296  image: $CI_DOCKER_REGISTRY/linux-shells:1
297  artifacts:
298    when: on_failure
299    paths:
300      - ${IDF_PATH}/*.out
301    expire_in: 1 week
302  script:
303    - ${IDF_PATH}/tools/ci/test_autocomplete.py
304
305test_detect_python:
306  extends: .host_test_template
307  image: $CI_DOCKER_REGISTRY/linux-shells:1
308  script:
309    - cd ${IDF_PATH}
310    - shellcheck -s sh tools/detect_python.sh
311    - shellcheck -s bash tools/detect_python.sh
312    - shellcheck -s dash tools/detect_python.sh
313    - "bash -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'"
314    - "dash -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'"
315    - "zsh -c '. tools/detect_python.sh && echo Our Python: ${ESP_PYTHON?Python is not set}'"
316    - "fish -c 'source tools/detect_python.fish && echo Our Python: $ESP_PYTHON'"
317
318test_nvs_page:
319  extends: .host_test_template
320  script:
321    - cd ${IDF_PATH}/components/nvs_flash/host_test/nvs_page_test
322    - idf.py build
323    - build/test_nvs_page_host.elf
324
325test_log:
326  extends: .host_test_template
327  script:
328    - cd ${IDF_PATH}/components/log/host_test/log_test
329    - idf.py build
330    - build/test_log_host.elf
331
332test_esp_event:
333  extends: .host_test_template
334  script:
335    - cd ${IDF_PATH}/components/esp_event/host_test/esp_event_unit_test
336    - idf.py build
337    - build/test_esp_event_host.elf
338
339test_esp_timer_cxx:
340  extends: .host_test_template
341  script:
342    - cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/esp_timer
343    - idf.py build
344    - build/test_esp_timer_cxx_host.elf
345
346test_eh_frame_parser:
347  extends: .host_test_template
348  script:
349    - cd ${IDF_PATH}/components/esp_system/test_eh_frame_parser
350    - make
351    - ./eh_frame_test
352
353test_rom_on_linux_works:
354  extends: .host_test_template
355  script:
356    - cd ${IDF_PATH}/components/esp_rom/host_test/rom_test
357    - idf.py build
358    - build/test_rom_host.elf
359
360test_cxx_gpio:
361  extends: .host_test_template
362  script:
363    - cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/gpio
364    - idf.py build
365    - build/test_gpio_cxx_host.elf
366
367test_linux_example:
368  extends: .host_test_template
369  script:
370    - cd ${IDF_PATH}/examples/build_system/cmake/linux_host_app
371    - idf.py build
372    - timeout 5 ./build/linux_host_app.elf >test.log || true
373    - grep "Restarting" test.log
374