Skip to content

Commit 2a92320

Browse files
Dzarda7radimkarnis
authored andcommitted
test: improve secure download mode test for ESP32-S2
1 parent 637f0e6 commit 2a92320

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

test/test_esptool_sdm.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#
66
# How to use:
77
#
8-
# Run with a physical connection to a chip:
9-
# - `pytest test_esptool_sdm.py --chip esp32 --port /dev/ttyUSB0 --baud 115200`
8+
# Run with a physical connection to a chip (ESP8266 and ESP32 do not support
9+
# secure download mode):
10+
# - `pytest test_esptool_sdm.py --chip esp32s2 --port /dev/ttyUSB0 --baud 115200`
1011
#
1112
# where - --port - a serial port for esptool operation
1213
# - --chip - ESP chip name
@@ -17,27 +18,20 @@
1718

1819

1920
@pytest.mark.skipif(
20-
arg_chip == "esp8266", reason="ESP8266 does not support Secure Download Mode"
21+
arg_chip in ("esp8266", "esp32"),
22+
reason="ESP8266 and ESP32 do not support secure download mode",
2123
)
2224
class TestSecureDownloadMode(EsptoolTestCase):
2325
expected_chip_name = esptool.util.expand_chip_name(arg_chip)
2426

25-
@pytest.mark.skipif(
26-
arg_chip in ("esp8266", "esp32"),
27-
reason="No get-security-info on ESP8266 and ESP32",
28-
)
2927
def test_auto_detect(self):
3028
output = self.run_esptool("get-security-info", chip="auto")
3129

32-
if arg_chip == "esp32s2": # no autodetection from security info, only magic no.
33-
assert "Secure Download Mode is enabled" in output
34-
assert "autodetection will not work" in output
35-
else:
36-
assert f"Detecting chip type... {self.expected_chip_name}" in output
37-
assert (
38-
f"{'Chip type:':<20}{self.expected_chip_name} "
39-
"in Secure Download Mode" in output
40-
)
30+
assert f"Detecting chip type... {self.expected_chip_name}" in output
31+
assert (
32+
f"{'Chip type:':<20}{self.expected_chip_name} "
33+
"in Secure Download Mode" in output
34+
)
4135

4236
# Commands not supported in SDM
4337
def test_sdm_incompatible_commands(self):
@@ -65,6 +59,5 @@ def test_sdm_compatible_commands(self):
6559
assert "Stub flasher is not supported in Secure Download Mode" in output
6660
assert "Flash memory region erased successfully" in output
6761

68-
if arg_chip != "esp32": # esp32 does not support get-security-info
69-
output = self.run_esptool("get-security-info")
70-
assert "Security Information:" in output
62+
output = self.run_esptool("get-security-info")
63+
assert "Security Information:" in output

0 commit comments

Comments
 (0)