Skip to content

Commit 91c1fe1

Browse files
author
Federico Fissore
committed
Updating bundled ctags so that #27 is fixed. Added test to track it
Signed-off-by: Federico Fissore <[email protected]>
1 parent 3515ca1 commit 91c1fe1

File tree

3 files changed

+67
-5
lines changed

3 files changed

+67
-5
lines changed

src/arduino.cc/builder/test/helper_tools_downloader.go

+13-5
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ func DownloadCoresAndToolsAndLibraries(t *testing.T) {
106106
OsUrl{Os: "i686-mingw32", Url: "http://downloads.arduino.cc/tools/coan-5.2-i686-mingw32.zip"},
107107
OsUrl{Os: "x86_64-apple-darwin", Url: "http://downloads.arduino.cc/tools/coan-5.2-x86_64-apple-darwin.zip"},
108108
}},
109-
Tool{Name: "ctags", Version: "5.8-patched",
109+
Tool{Name: "ctags", Version: "5.8-arduino1",
110110
OsUrls: []OsUrl{
111-
OsUrl{Os: "i686-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-patched-i686-pc-linux-gnu.tar.bz2"},
112-
OsUrl{Os: "x86_64-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-patched-x86_64-pc-linux-gnu.tar.bz2"},
113-
OsUrl{Os: "i686-mingw32", Url: "http://downloads.arduino.cc/tools/ctags-5.8-patched-i686-mingw32.zip"},
114-
OsUrl{Os: "x86_64-apple-darwin", Url: "http://downloads.arduino.cc/tools/ctags-5.8-patched-x86_64-apple-darwin.zip"},
111+
OsUrl{Os: "i686-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-i686-pc-linux-gnu.tar.bz2"},
112+
OsUrl{Os: "x86_64-pc-linux-gnu", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-x86_64-pc-linux-gnu.tar.bz2"},
113+
OsUrl{Os: "i686-mingw32", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-i686-mingw32.zip"},
114+
OsUrl{Os: "x86_64-apple-darwin", Url: "http://downloads.arduino.cc/tools/ctags-5.8-arduino1-x86_64-apple-darwin.zip"},
115115
}},
116116
}
117117

@@ -536,6 +536,14 @@ func downloadAndUnpackTool(tool Tool, url string, targetPath string) error {
536536
}
537537
defer os.RemoveAll(unpackFolder)
538538

539+
_, err = os.Stat(filepath.Join(targetPath, tool.Name))
540+
if err == nil {
541+
err = os.RemoveAll(filepath.Join(targetPath, tool.Name))
542+
if err != nil {
543+
return utils.WrapError(err)
544+
}
545+
}
546+
539547
if len(files) == 1 && files[0].IsDir() {
540548
err = os.MkdirAll(filepath.Join(targetPath, tool.Name), os.FileMode(0755))
541549
if err != nil {

src/arduino.cc/builder/test/prototypes_adder_test.go

+40
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,43 @@ func TestPrototypesAdderSketchWithDefaultArgs(t *testing.T) {
522522
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
523523
require.Equal(t, "void setup();\nvoid loop();\n#line 1\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
524524
}
525+
526+
func TestPrototypesAdderSketchWithInlineFunction(t *testing.T) {
527+
DownloadCoresAndToolsAndLibraries(t)
528+
529+
context := make(map[string]interface{})
530+
531+
buildPath := SetupBuildPath(t, context)
532+
defer os.RemoveAll(buildPath)
533+
534+
context[constants.CTX_HARDWARE_FOLDERS] = []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}
535+
context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools"}
536+
context[constants.CTX_FQBN] = "arduino:avr:leonardo"
537+
context[constants.CTX_SKETCH_LOCATION] = filepath.Join("sketch_with_inline_function", "sketch.ino")
538+
context[constants.CTX_BUILD_PROPERTIES_RUNTIME_IDE_VERSION] = "10600"
539+
context[constants.CTX_LIBRARIES_FOLDERS] = []string{"libraries", "downloaded_libraries"}
540+
context[constants.CTX_VERBOSE] = true
541+
542+
commands := []types.Command{
543+
&builder.SetupHumanLoggerIfMissing{},
544+
545+
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
546+
547+
&builder.ContainerMergeCopySketchFiles{},
548+
549+
&builder.ContainerFindIncludes{},
550+
551+
&builder.PrintUsedLibrariesIfVerbose{},
552+
&builder.WarnAboutArchIncompatibleLibraries{},
553+
554+
&builder.ContainerAddPrototypes{},
555+
}
556+
557+
for _, command := range commands {
558+
err := command.Run(context)
559+
NoError(t, err)
560+
}
561+
562+
require.Equal(t, "#include <Arduino.h>\n#line 1\n", context[constants.CTX_INCLUDE_SECTION].(string))
563+
require.Equal(t, "void setup();\nvoid loop();\nshort unsigned int testInt();\nint8_t testInline();\nuint8_t testAttribute();\n#line 1\n", context[constants.CTX_PROTOTYPE_SECTION].(string))
564+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
void setup() {}
2+
void loop() {}
3+
4+
short unsigned int testInt(){
5+
6+
}
7+
8+
static inline int8_t testInline(){
9+
10+
}
11+
12+
__attribute__((always_inline)) uint8_t testAttribute() {
13+
14+
}

0 commit comments

Comments
 (0)