examples: sd_card: fix example test not getting the expected name

SD card example prints the line which looks like:

   Name: 00000

If only part of the line is received, the regular expression in the
test still matches, and partial name is obtained. Later the example
test expects to see the same name in the file read from the SD card.
This check fails, because only partial name was received earlier.

Fix by adding a CR to the regular expression so that the entire name
is matched.
This commit is contained in:
Ivan Grokhotkov
2022-05-11 21:50:11 +02:00
parent 20fdf3bdf1
commit 27e1490bfc
2 changed files with 2 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ def test_examples_sd_card_sdmmc(env, extra_data): # type: (ttfw_idf.Env.Env, No
dut.expect('Filesystem mounted', timeout=60)
# These lines are matched separately because of ASCII color codes in the output
name = dut.expect(re.compile(r'Name: (\w+)'), timeout=10)[0]
name = dut.expect(re.compile(r'Name: (\w+)\r'), timeout=10)[0]
_type = dut.expect(re.compile(r'Type: (\S+)'), timeout=10)[0]
speed = dut.expect(re.compile(r'Speed: (\S+)'), timeout=10)[0]
size = dut.expect(re.compile(r'Size: (\S+)'), timeout=10)[0]

View File

@@ -16,7 +16,7 @@ def test_examples_sd_card_sdspi(env, extra_data): # type: (ttfw_idf.Env.Env, No
dut.expect('Filesystem mounted', timeout=60)
# These lines are matched separately because of ASCII color codes in the output
name = dut.expect(re.compile(r'Name: (\w+)'), timeout=20)[0]
name = dut.expect(re.compile(r'Name: (\w+)\r'), timeout=20)[0]
_type = dut.expect(re.compile(r'Type: (\S+)'), timeout=20)[0]
speed = dut.expect(re.compile(r'Speed: (\S+)'), timeout=20)[0]
size = dut.expect(re.compile(r'Size: (\S+)'), timeout=20)[0]