|
5 | 5 | #
|
6 | 6 | # How to use:
|
7 | 7 | #
|
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` |
10 | 11 | #
|
11 | 12 | # where - --port - a serial port for esptool operation
|
12 | 13 | # - --chip - ESP chip name
|
|
17 | 18 |
|
18 | 19 |
|
19 | 20 | @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", |
21 | 23 | )
|
22 | 24 | class TestSecureDownloadMode(EsptoolTestCase):
|
23 | 25 | expected_chip_name = esptool.util.expand_chip_name(arg_chip)
|
24 | 26 |
|
25 |
| - @pytest.mark.skipif( |
26 |
| - arg_chip in ("esp8266", "esp32"), |
27 |
| - reason="No get-security-info on ESP8266 and ESP32", |
28 |
| - ) |
29 | 27 | def test_auto_detect(self):
|
30 | 28 | output = self.run_esptool("get-security-info", chip="auto")
|
31 | 29 |
|
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 | + ) |
41 | 35 |
|
42 | 36 | # Commands not supported in SDM
|
43 | 37 | def test_sdm_incompatible_commands(self):
|
@@ -65,6 +59,5 @@ def test_sdm_compatible_commands(self):
|
65 | 59 | assert "Stub flasher is not supported in Secure Download Mode" in output
|
66 | 60 | assert "Flash memory region erased successfully" in output
|
67 | 61 |
|
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