mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
8efb2bb1ed
Add support for running example_GENERIC tests for C3 on label. Fix examples that fail.
29 lines
940 B
Python
29 lines
940 B
Python
from __future__ import print_function
|
|
|
|
import hashlib
|
|
import os
|
|
|
|
import ttfw_idf
|
|
|
|
|
|
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3'])
|
|
def test_examples_spiffsgen(env, extra_data):
|
|
# Test with default build configurations
|
|
dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen')
|
|
dut.start_app()
|
|
|
|
base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image')
|
|
|
|
# Expect hello.txt is read successfully
|
|
with open(os.path.join(base_dir, 'hello.txt'), 'r') as hello_txt:
|
|
dut.expect('Read from hello.txt: ' + hello_txt.read().rstrip())
|
|
|
|
# Expect alice.txt MD5 hash is computed accurately
|
|
with open(os.path.join(base_dir, 'sub', 'alice.txt'), 'rb') as alice_txt:
|
|
alice_md5 = hashlib.md5(alice_txt.read()).hexdigest()
|
|
dut.expect('Computed MD5 hash of alice.txt: ' + alice_md5)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
test_examples_spiffsgen()
|