1*** Variables ***
2${AUDIO_INPUT}                https://dl.antmicro.com/projects/renode/sine440_with_beep_aligned.pcm_s24le_44100_stereo.raw-s_793344-b37432aad6a22f36cb5c1e239c9bce4adbcd15fb
3
4*** Test Cases ***
5Should Echo Audio
6    ${input_file}=            Download File  ${AUDIO_INPUT}
7
8    Execute Command           mach create
9    Execute Command           machine LoadPlatformDescription @platforms/cpus/litex_zephyr_vexriscv_i2s.repl
10    Execute Command           showAnalyzer sysbus.uart
11    Execute Command           sysbus LoadELF @https://dl.antmicro.com/projects/renode/litex_i2s--zephyr-echo_sample.elf-s_1172756-db2f7eb8c6c8f396651b2f2d517cee13d79a9a69
12
13    ${output_file}=           Allocate Temporary File
14
15    Execute Command           sysbus.i2s_tx Output @${output_file}
16    Execute Command           sysbus.i2s_rx LoadPCM @${input_file}
17
18    # sample input file is around 3s long, but let's give some more time for processing
19    Execute Command           emulation RunFor "3.2"
20
21    # in order to make sure the output file is closed
22    Execute Command           sysbus.i2s_tx Dispose
23
24    ${input_file_size}=       Get File Size  ${input_file}
25    ${output_file_size}=      Get File Size  ${output_file}
26
27    Should Be Equal           ${input_file_size}  ${output_file_size}
28
29    ${input_file_content}=    Get Binary File  ${input_file}
30    ${output_file_content}=   Get Binary File  ${output_file}
31
32    Should Be Equal           ${input_file_content}  ${output_file_content}
33
34