@@ -66,7 +66,7 @@ var TestResolveData = []struct {
66
66
{"arduino:avr:leonardo" ,
67
67
"./upload_test.hex" ,
68
68
"" ,
69
- `{runtime.tools.avrdude.path}/bin/avrdude -C{runtime.tools.avrdude.path}/etc/avrdude.conf -v {upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"` ,
69
+ `{runtime.tools.avrdude.path}/bin/avrdude -C{runtime.tools.avrdude.path}/etc/avrdude.conf -v {upload.verify} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"` ,
70
70
Extra {Use1200bpsTouch : true , WaitForUploadPort : true },
71
71
`$loc$loc{runtime.tools.avrdude.path}/bin/avrdude -C{runtime.tools.avrdude.path}/etc/avrdude.conf -v $loc{upload.verify} -patmega32u4 -cavr109 -P$loc{serial.port} -b57600 -D "-Uflash:w:./upload_test.hex:i"` ,
72
72
},
@@ -81,7 +81,32 @@ var TestResolveData = []struct {
81
81
82
82
func TestResolve (t * testing.T ) {
83
83
for _ , test := range TestResolveData {
84
- result , _ := upload .PartiallyResolve (test .Board , test .File , test .PlatformPath , test .Commandline , test .Extra , mockTools {})
84
+ result , _ := PartiallyResolve (test .Board , test .File , test .PlatformPath , test .Commandline , test .Extra , mockTools {})
85
+ if result != test .Result {
86
+ t .Error ("expected " + test .Result + ", got " + result )
87
+ continue
88
+ }
89
+ }
90
+ }
91
+
92
+ var TestFixupData = []struct {
93
+ Port string
94
+ Commandline string
95
+ Result string
96
+ }{
97
+ {"/dev/ttyACM0" ,
98
+ `{runtime.tools.avrdude.path}/bin/avrdude -C{runtime.tools.avrdude.path}/etc/avrdude.conf -v {upload.verify} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"` ,
99
+ `{runtime.tools.avrdude.path}/bin/avrdude -C{runtime.tools.avrdude.path}/etc/avrdude.conf -v {upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"` ,
100
+ },
101
+ {"/dev/cu.usbmodemDC5475C5557C2" ,
102
+ `{runtime.tools.arduino-fwuploader.path}/arduino-fwuploader firmware flash -a {serial.port} -b arduino:renesas_uno:unor4wifi -v --retries 5"` ,
103
+ `{runtime.tools.arduino-fwuploader.path}/arduino-fwuploader firmware flash -a /dev/cu.usbmodemDC5475C5557C2 -b arduino:renesas_uno:unor4wifi -v --retries 5"` ,
104
+ },
105
+ }
106
+
107
+ func TestFixupPort (t * testing.T ) {
108
+ for _ , test := range TestFixupData {
109
+ result := fixupPort (test .Port , test .Commandline )
85
110
if result != test .Result {
86
111
t .Error ("expected " + test .Result + ", got " + result )
87
112
continue
0 commit comments