Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
870a48fc
Unverified
Commit
870a48fc
authored
Feb 21, 2024
by
Cristian Maglie
Committed by
GitHub
Feb 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed nil pointer excpetion in upload (#2548)
parent
65fb6e5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
commands/upload/upload.go
commands/upload/upload.go
+1
-1
internal/integrationtest/upload_mock/upload_mock_test.go
internal/integrationtest/upload_mock/upload_mock_test.go
+41
-0
No files found.
commands/upload/upload.go
View file @
870a48fc
...
...
@@ -150,7 +150,7 @@ func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, er
if
programmer
==
""
&&
pme
.
GetProfile
()
!=
nil
{
programmer
=
pme
.
GetProfile
()
.
Programmer
}
if
programmer
==
""
{
if
programmer
==
""
&&
sk
!=
nil
{
programmer
=
sk
.
GetDefaultProgrammer
()
}
...
...
internal/integrationtest/upload_mock/upload_mock_test.go
View file @
870a48fc
...
...
@@ -726,3 +726,44 @@ func generateBuildDir(sketchPath *paths.Path, t *testing.T) *paths.Path {
require
.
NoError
(
t
,
buildDir
.
ToAbs
())
return
buildDir
}
func
TestUploadWithInputDirFlag
(
t
*
testing
.
T
)
{
env
,
cli
:=
integrationtest
.
CreateArduinoCLIWithEnvironment
(
t
)
defer
env
.
CleanUp
()
_
,
_
,
err
:=
cli
.
Run
(
"core"
,
"install"
,
"arduino:mbed_opta"
)
require
.
NoError
(
t
,
err
)
sketchPath
:=
cli
.
SketchbookDir
()
.
Join
(
"TestSketchForUpload"
)
_
,
_
,
err
=
cli
.
Run
(
"sketch"
,
"new"
,
sketchPath
.
String
())
require
.
NoError
(
t
,
err
)
// Create a fake build directory
buildDir
:=
sketchPath
.
Join
(
"build"
)
require
.
NoError
(
t
,
buildDir
.
MkdirAll
())
require
.
NoError
(
t
,
buildDir
.
Join
(
"TestSketchForUpload.ino.bin"
)
.
WriteFile
(
nil
))
require
.
NoError
(
t
,
buildDir
.
Join
(
"TestSketchForUpload.ino.elf"
)
.
WriteFile
(
nil
))
require
.
NoError
(
t
,
buildDir
.
Join
(
"TestSketchForUpload.ino.hex"
)
.
WriteFile
(
nil
))
require
.
NoError
(
t
,
buildDir
.
Join
(
"TestSketchForUpload.ino.map"
)
.
WriteFile
(
nil
))
// Test with input-dir flag
_
,
_
,
err
=
cli
.
Run
(
"upload"
,
"-b"
,
"arduino:mbed_opta:opta"
,
"-i"
,
buildDir
.
String
(),
"-t"
,
"-p"
,
"/dev/ttyACM0"
,
"--dry-run"
,
"-v"
,
sketchPath
.
String
())
require
.
NoError
(
t
,
err
)
// Test with input-dir flag and no sketch
_
,
_
,
err
=
cli
.
Run
(
"upload"
,
"-b"
,
"arduino:mbed_opta:opta"
,
"-i"
,
buildDir
.
String
(),
"-t"
,
"-p"
,
"/dev/ttyACM0"
,
"--dry-run"
,
"-v"
)
require
.
NoError
(
t
,
err
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment