Commit 61323e01 authored by Cristian Maglie's avatar Cristian Maglie Committed by Cristian Maglie

Added check for missing 'recipe.output.tmp_file' during upload

parent ca0e468b
......@@ -248,6 +248,10 @@ func TestUploadCommands(t *testing.T) {
// sketch without build
exitCode, d = executeWithArgs(t, "upload", currSketchbookDir.Join("TestSketch2").String(), "-b", "test:avr:testboard", "-p", "/dev/ttyACM0")
require.NotZero(t, exitCode, "exit code")
// platform without 'recipe.output.tmp_file' property
exitCode, d = executeWithArgs(t, "upload", "-i", currSketchbookDir.Join("test.hex").String(), "-b", "test2:avr:testboard", "-p", "/dev/ttyACM0")
require.NotZero(t, exitCode, "exit code")
}
func TestLibSearch(t *testing.T) {
......
testboard.name=Test Board
testboard.vid.0=0x2341
testboard.pid.0=0x8888
testboard.upload.tool=avrdude-none
testboard.upload.protocol=arduino
testboard.upload.maximum_size=32256
testboard.upload.maximum_data_size=2048
testboard.upload.speed=115200
testboard.bootloader.tool=avrdude
testboard.bootloader.low_fuses=0xFF
testboard.bootloader.high_fuses=0xDE
testboard.bootloader.extended_fuses=0xFD
testboard.bootloader.unlock_bits=0x3F
testboard.bootloader.lock_bits=0x0F
testboard.bootloader.file=optiboot/optiboot_atmega328.hex
testboard.build.mcu=atmega328p
testboard.build.f_cpu=16000000L
testboard.build.board=AVR_UNO
testboard.build.core=arduino:arduino
testboard.build.variant=standard
name=Test AVR Boards
version=1.0.0
# Removed for testing purposes
#recipe.output.tmp_file={build.project_name}.hex
# Fake AVR programmer tool for testing
# ------------------------------------
tools.avrdude-none.upload.params.verbose=VERBOSE
tools.avrdude-none.upload.params.quiet=QUIET
tools.avrdude-none.upload.params.verify=VERIFY
tools.avrdude-none.upload.params.noverify=NOVERIFY
tools.avrdude-none.upload.pattern=echo {upload.verbose} {upload.verify} "{build.path}/{build.project_name}.hex"
......@@ -178,7 +178,12 @@ func run(command *cobra.Command, args []string) {
// Make the filename without the FQBN configs part
fqbn.Configs = properties.NewMap()
fqbnSuffix := strings.Replace(fqbn.String(), ":", ".", -1)
ext := filepath.Ext(uploadProperties.ExpandPropsInString("{recipe.output.tmp_file}"))
outputTmpFile, ok := uploadProperties.GetOk("recipe.output.tmp_file")
if !ok {
formatter.PrintErrorMessage("The platform does not define the required property 'recipe.output.tmp_file'.")
os.Exit(commands.ErrGeneric)
}
ext := filepath.Ext(outputTmpFile)
var importPath *paths.Path
var importFile string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment