@@ -28,6 +28,7 @@ def generate_build_dir(sketch_path):
28
28
29
29
testdata = [
30
30
(
31
+ "" ,
31
32
"arduino:avr:uno" ,
32
33
"arduino:avr@1.8.3" ,
33
34
"/dev/ttyACM0" ,
@@ -36,23 +37,71 @@ def generate_build_dir(sketch_path):
36
37
+ '-v -V -patmega328p -carduino "-P{upload_port}" -b115200 -D "-Uflash:w:{build_dir}/{sketch_name}.ino.hex:i"' ,
37
38
),
38
39
(
40
+ "" ,
39
41
"arduino:avr:leonardo" ,
40
42
"arduino:avr@1.8.3" ,
41
43
"/dev/ttyACM999" ,
42
44
'"{data_dir}/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" '
43
45
+ '"-C{data_dir}/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" '
44
46
+ '-v -V -patmega32u4 -cavr109 "-P{upload_port}0" -b57600 -D "-Uflash:w:{build_dir}/{sketch_name}.ino.hex:i"' ,
45
47
),
48
+ (
49
+ "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json" ,
50
+ "adafruit:avr:flora8" ,
51
+ "adafruit:avr@1.4.13" ,
52
+ "/dev/ttyACM0" ,
53
+ '"{data_dir}/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" '
54
+ + '"-C{data_dir}/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" '
55
+ + '-v -patmega32u4 -cavr109 -P{upload_port} -b57600 -D "-Uflash:w:{build_dir}/{sketch_name}.ino.hex:i"' ,
56
+ ),
57
+ (
58
+ "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json" ,
59
+ "adafruit:avr:flora8" ,
60
+ "adafruit:avr@1.4.13" ,
61
+ "/dev/ttyACM999" ,
62
+ '"{data_dir}/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" '
63
+ + '"-C{data_dir}/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" '
64
+ + '-v -patmega32u4 -cavr109 -P{upload_port}0 -b57600 -D "-Uflash:w:{build_dir}/{sketch_name}.ino.hex:i"' ,
65
+ ),
66
+ (
67
+ "https://dl.espressif.com/dl/package_esp32_index.json" ,
68
+ "esp32:esp32:esp32thing" ,
69
+ "esp32:esp32@1.0.6" ,
70
+ "/dev/ttyACM0" ,
71
+ 'python "{data_dir}/packages/esp32/tools/esptool_py/3.0.0/esptool.py" '
72
+ + '--chip esp32 --port "{upload_port}" --baud 921600 --before default_reset '
73
+ + "--after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 "
74
+ + '"{data_dir}/packages/esp32/hardware/esp32/1.0.6/tools/partitions/boot_app0.bin" 0x1000 '
75
+ + '"{data_dir}/packages/esp32/hardware/esp32/1.0.6/tools/sdk/bin/bootloader_dio_80m.bin" 0x10000 '
76
+ + '"{build_dir}/{sketch_name}.ino.bin" 0x8000 "{build_dir}/{sketch_name}.ino.partitions.bin"' ,
77
+ ),
78
+ (
79
+ "http://arduino.esp8266.com/stable/package_esp8266com_index.json" ,
80
+ "esp8266:esp8266:generic" ,
81
+ "esp8266:esp8266@3.0.1" ,
82
+ "/dev/ttyACM0" ,
83
+ '"{data_dir}/packages/esp8266/tools/python3/3.7.2-post1/python3" '
84
+ + '"{data_dir}/packages/esp8266/hardware/esp8266/3.0.1/tools/upload.py" '
85
+ + '--chip esp8266 --port "{upload_port}" --baud "115200" "" '
86
+ + "--before default_reset --after hard_reset write_flash 0x0 "
87
+ + '"{build_dir}/{sketch_name}.ino.bin"' ,
88
+ ),
46
89
]
47
90
48
91
49
- @pytest .mark .parametrize ("fqbn, core, upload_port, expected_output" , testdata )
50
- def test_upload_sketch (run_command , session_data_dir , downloads_dir , fqbn , core , upload_port , expected_output ):
92
+ @pytest .mark .parametrize ("index, fqbn, core, upload_port, expected_output" , testdata )
93
+ def test_upload_sketch (run_command , session_data_dir , downloads_dir , index , fqbn , core , upload_port , expected_output ):
51
94
env = {
52
95
"ARDUINO_DATA_DIR" : session_data_dir ,
53
96
"ARDUINO_DOWNLOADS_DIR" : downloads_dir ,
54
97
"ARDUINO_SKETCHBOOK_DIR" : session_data_dir ,
55
98
}
99
+
100
+ if index :
101
+ assert run_command ("config init --overwrite" , custom_env = env )
102
+ assert run_command (f"config add board_manager.additional_urls { index } " , custom_env = env )
103
+ assert run_command ("update" , custom_env = env )
104
+
56
105
assert run_command (f"core install { core } " , custom_env = env )
57
106
58
107
# Create a sketch
0 commit comments