2020-04-17 09:51:00 +00:00
|
|
|
from __future__ import unicode_literals
|
2021-01-26 02:49:01 +00:00
|
|
|
|
2020-04-17 09:51:00 +00:00
|
|
|
import os
|
|
|
|
import re
|
2021-01-26 02:49:01 +00:00
|
|
|
|
2020-04-17 09:51:00 +00:00
|
|
|
import ttfw_idf
|
|
|
|
|
|
|
|
|
2021-01-26 02:49:01 +00:00
|
|
|
@ttfw_idf.idf_example_test(env_tag='test_jtag_arm')
|
2020-04-17 09:51:00 +00:00
|
|
|
def test_examples_app_trace_to_host(env, extra_data):
|
|
|
|
rel_project_path = os.path.join('examples', 'system', 'app_trace_to_host')
|
|
|
|
dut = env.get_dut('app_trace_to_host', rel_project_path)
|
|
|
|
idf_path = dut.app.get_sdk_path()
|
|
|
|
proj_path = os.path.join(idf_path, rel_project_path)
|
|
|
|
|
2020-05-19 12:27:31 +00:00
|
|
|
with ttfw_idf.OCDBackend(os.path.join(proj_path, 'openocd.log'), dut.app.target) as ocd:
|
|
|
|
dut.start_app()
|
|
|
|
dut.expect_all('example: Enabling ADC1 on channel 6 / GPIO34.',
|
|
|
|
'example: Enabling CW generator on DAC channel 1',
|
|
|
|
'example: Sampling ADC and sending data to the host...',
|
|
|
|
re.compile(r'example: Collected \d+ samples in 20 ms.'),
|
|
|
|
'example: Sampling ADC and sending data to the UART...',
|
|
|
|
re.compile(r'example: Sample:\d, Value:\d+'),
|
|
|
|
re.compile(r'example: Collected \d+ samples in 20 ms.'),
|
|
|
|
timeout=20)
|
|
|
|
|
2021-01-26 02:49:01 +00:00
|
|
|
ocd.apptrace_start('file://adc.log 0 9000 5 0 0')
|
2020-07-20 15:16:01 +00:00
|
|
|
ocd.apptrace_wait_stop(tmo=30)
|
2020-04-17 09:51:00 +00:00
|
|
|
|
|
|
|
with ttfw_idf.CustomProcess(' '.join([os.path.join(idf_path, 'tools/esp_app_trace/logtrace_proc.py'),
|
|
|
|
'adc.log',
|
2020-07-21 09:00:04 +00:00
|
|
|
os.path.join(dut.app.binary_path, 'app_trace_to_host.elf')]),
|
2020-04-17 09:51:00 +00:00
|
|
|
logfile='logtrace_proc.log') as logtrace:
|
|
|
|
logtrace.pexpect_proc.expect_exact('Parse trace file')
|
|
|
|
logtrace.pexpect_proc.expect_exact('Parsing completed.')
|
|
|
|
logtrace.pexpect_proc.expect_exact('====================================================================')
|
|
|
|
logtrace.pexpect_proc.expect(re.compile(r'example: Sample:\d+, Value:\d+'))
|
|
|
|
logtrace.pexpect_proc.expect_exact('====================================================================')
|
|
|
|
logtrace.pexpect_proc.expect(re.compile(r'Log records count: \d+'))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_examples_app_trace_to_host()
|