1#!/usr/bin/env python
2
3import glob
4import os
5import re
6
7import ttfw_idf
8from tiny_test_fw import Utility
9from ttfw_idf.IDFDUT import ESP32DUT
10
11
12@ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', group='test-apps')
13def test_startup(env, extra_data):
14    config_files = glob.glob(os.path.join(os.path.dirname(__file__), 'sdkconfig.ci.*'))
15    config_names = [os.path.basename(s).replace('sdkconfig.ci.', '') for s in config_files]
16    for name in config_names:
17        Utility.console_log("Checking config \"{}\"... ".format(name), end='')
18        dut = env.get_dut('startup', 'tools/test_apps/system/startup', app_config_name=name)
19        dut.start_app()
20
21        if (name == 'single_core_variant' and isinstance(dut, ESP32DUT)):
22            dut.allow_dut_exception = True
23            dut.expect('Running on single core variant of a chip, but app is built with multi-core support.')
24            dut.expect(re.compile(r'abort\(\) was called at PC [0-9xa-f]+ on core 0'))
25        else:
26            dut.expect('app_main running')
27
28        env.close_dut(dut.name)
29        Utility.console_log('done')
30
31
32if __name__ == '__main__':
33    test_startup()
34