Skip to content

Commit 13c9b5d

Browse files
committed
Put upload test under upload package
1 parent 16f322f commit 13c9b5d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Diff for: upload/upload_test.go

+12-9
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
// You should have received a copy of the GNU Affero General Public License
1414
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
package upload_test
16+
package upload
1717

1818
import (
1919
"log"
2020
"strings"
2121
"testing"
2222

23-
"github.com/arduino/arduino-create-agent/upload"
2423
homedir "github.com/mitchellh/go-homedir"
2524
"github.com/sirupsen/logrus"
2625
)
@@ -36,11 +35,11 @@ var TestSerialData = []struct {
3635
Name string
3736
Port string
3837
Commandline string
39-
Extra upload.Extra
38+
Extra Extra
4039
}{
4140
{
4241
"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}},
4443
}
4544

4645
func TestSerial(t *testing.T) {
@@ -51,7 +50,7 @@ func TestSerial(t *testing.T) {
5150

5251
for _, test := range TestSerialData {
5352
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)
5554
log.Println(err)
5655
}
5756
}
@@ -61,12 +60,16 @@ var TestResolveData = []struct {
6160
File string
6261
PlatformPath string
6362
Commandline string
64-
Extra upload.Extra
63+
Extra Extra
6564
Result string
6665
}{
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+
},
7073
}
7174

7275
func TestResolve(t *testing.T) {

0 commit comments

Comments
 (0)