13
13
// You should have received a copy of the GNU Affero General Public License
14
14
// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
15
16
- package upload_test
16
+ package upload
17
17
18
18
import (
19
19
"log"
20
20
"strings"
21
21
"testing"
22
22
23
- "github.com/arduino/arduino-create-agent/upload"
24
23
homedir "github.com/mitchellh/go-homedir"
25
24
"github.com/sirupsen/logrus"
26
25
)
@@ -36,11 +35,11 @@ var TestSerialData = []struct {
36
35
Name string
37
36
Port string
38
37
Commandline string
39
- Extra upload. Extra
38
+ Extra Extra
40
39
}{
41
40
{
42
41
"leonardo" , "/dev/ttyACM0" ,
43
- `"$HOME/.arduino-create/avrdude/6.3.0-arduino6/bin/avrdude" "-C$HOME/.arduino-create/avrdude/6.3.0-arduino6/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:./upload_test.hex:i"` , upload. Extra {Use1200bpsTouch : true , WaitForUploadPort : true }},
42
+ `"$HOME/.arduino-create/avrdude/6.3.0-arduino6/bin/avrdude" "-C$HOME/.arduino-create/avrdude/6.3.0-arduino6/etc/avrdude.conf" -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:./upload_test.hex:i"` , Extra {Use1200bpsTouch : true , WaitForUploadPort : true }},
44
43
}
45
44
46
45
func TestSerial (t * testing.T ) {
@@ -51,7 +50,7 @@ func TestSerial(t *testing.T) {
51
50
52
51
for _ , test := range TestSerialData {
53
52
commandline := strings .Replace (test .Commandline , "$HOME" , home , - 1 )
54
- err := upload . Serial (test .Port , commandline , test .Extra , logger )
53
+ err := Serial (test .Port , commandline , test .Extra , logger )
55
54
log .Println (err )
56
55
}
57
56
}
@@ -61,12 +60,16 @@ var TestResolveData = []struct {
61
60
File string
62
61
PlatformPath string
63
62
Commandline string
64
- Extra upload. Extra
63
+ Extra Extra
65
64
Result string
66
65
}{
67
- {"arduino:avr:leonardo" , "./upload_test.hex" , "" ,
68
- `"{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"` , upload.Extra {Use1200bpsTouch : true , WaitForUploadPort : true },
69
- `"$loc$loc{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v $loc{upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:./upload_test.hex:i"` },
66
+ {"arduino:avr:leonardo" ,
67
+ "./upload_test.hex" ,
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"` ,
70
+ Extra {Use1200bpsTouch : true , WaitForUploadPort : true },
71
+ `$loc$loc{runtime.tools.avrdude.path}/bin/avrdude -C{runtime.tools.avrdude.path}/etc/avrdude.conf -v $loc{upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:./upload_test.hex:i"` ,
72
+ },
70
73
}
71
74
72
75
func TestResolve (t * testing.T ) {
0 commit comments