Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3e55331
Moved out from legacy some TryBuild* integration tests
cmaglie Sep 3, 2023
7e0899c
Ported sketch_with_config integration tests out of legacy
cmaglie Sep 2, 2023
8a62b12
Ported sketch_no_functions integration tests out of legacy
cmaglie Sep 2, 2023
b064f2a
Ported sketch_with_backup_files integration tests out of legacy
cmaglie Sep 2, 2023
8513196
Ported sketch_with_old_lib integration tests out of legacy
cmaglie Sep 2, 2023
f0c9848
Ported sketch_with_subfolders integration tests out of legacy
cmaglie Sep 2, 2023
4e582a4
Ported sketch_with_class integration tests out of legacy
cmaglie Sep 2, 2023
7597e88
Simplified integrationtest of preprocessor
cmaglie Sep 2, 2023
cce795e
Ported sketch_with_typename integration tests out of legacy
cmaglie Sep 2, 2023
e819701
Ported sketch_with_namespace integration tests out of legacy
cmaglie Sep 2, 2023
9e3a3fe
Ported sketch_with_default_args integration tests out of legacy
cmaglie Sep 3, 2023
3533da2
Ported sketch_with_inline_function_args integration tests out of legacy
cmaglie Sep 3, 2023
6c472c0
Ported sketch_with_function_signature_inside_ifdef integration tests …
cmaglie Sep 3, 2023
297235b
Ported sketch_with_usbcon integration tests out of legacy
cmaglie Sep 3, 2023
a3f2fa1
Ported sketch_with_const integration tests out of legacy
cmaglie Sep 3, 2023
fd7b7e1
Ported sketch_with_templates_and_shift integration tests out of legacy
cmaglie Sep 3, 2023
9d22542
Ported sketch eol_processing integration tests out of legacy
cmaglie Sep 3, 2023
d8f64de
Ported SketchWithIfdef integration tests out of legacy
cmaglie Sep 3, 2023
4cf01fa
Ported sketch_with_ifdef integration tests out of legacy
cmaglie Sep 3, 2023
3e96ac6
Ported Bridge integration tests out of legacy
cmaglie Sep 3, 2023
2fda19f
Ported more Bridge integration tests out of legacy
cmaglie Sep 3, 2023
ca21942
Ported even more Bridge integration tests out of legacy
cmaglie Sep 3, 2023
e447ba9
Better subtesting categorization
cmaglie Sep 3, 2023
3b354ad
Ported yet another Bridge integration tests out of legacy
cmaglie Sep 3, 2023
d66c875
Ported Balanduino integration tests out of legacy
cmaglie Sep 3, 2023
1866cd8
Ported CharWithEscapedDoubleQuote integration tests out of legacy
cmaglie Sep 3, 2023
c0941c0
Ported IncludeBetweenMultilineComment integration tests out of legacy
cmaglie Sep 3, 2023
f4f6f25
Ported LineContinuations integration tests out of legacy
cmaglie Sep 3, 2023
c5dc578
Ported StringWithComment integration tests out of legacy
cmaglie Sep 3, 2023
b73e411
Ported SketchWithStruct integration tests out of legacy
cmaglie Sep 3, 2023
1de6112
Ported SketchNoFunctionsTwoFiles integration tests out of legacy
cmaglie Sep 4, 2023
f88ee92
Ported SketchWithClassAndMethodSubstring integration tests out of legacy
cmaglie Sep 4, 2023
dac334e
Ported SketchThatChecksIfSPIHasTransactions integration tests out of …
cmaglie Sep 4, 2023
8bc29c7
Ported sketch_with_dependend_libraries integration tests out of legacy
cmaglie Sep 4, 2023
8f0a4ca
Ported sketch_with_function_pointer integration tests out of legacy
cmaglie Sep 4, 2023
180dba1
Ported sketch_usbhost integration tests out of legacy
cmaglie Sep 4, 2023
e4d2845
Removed sketch1 from try_build* test
cmaglie Sep 4, 2023
4500280
Ported sketch9 integration tests out of legacy
cmaglie Sep 4, 2023
c954899
Removing no more used functions
cmaglie Sep 4, 2023
0206ffc
Ported USBHost test
cmaglie Sep 4, 2023
a8f1d88
Removed no more useful test from legacy
cmaglie Sep 4, 2023
c4f9601
Removed no more needed tests
cmaglie Sep 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ported sketch_with_typename integration tests out of legacy
  • Loading branch information
cmaglie committed Sep 4, 2023
commit cce795e554965efb9f562d15d43b4d7bed430a1c
17 changes: 16 additions & 1 deletion internal/integrationtest/compile_4/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
{"SketchWithoutFunctions", testBuilderSketchWithoutFunctions},
{"SketchWithConfig", testBuilderSketchWithConfig},
{"SketchWithUsbcon", tryBuildAvrLeonardo},
//{"SketchWithTypename", tryBuildAvrLeonardo}, // XXX: Failing sketch, typename not supported
{"SketchWithTypename", testBuilderSketchWithTypename},
{"SketchWithMacosxGarbage", tryBuildAvrLeonardo},
{"SketchWithNamespace", tryBuildAvrLeonardo},
{"SketchWithDefaultArgs", tryBuildAvrLeonardo},
Expand Down Expand Up @@ -147,6 +147,21 @@ func testBuilderSketchWithClass(t *testing.T, env *integrationtest.Environment,
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
}

func testBuilderSketchWithTypename(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
// XXX: Failing sketch, typename not supported.
// This test will be skipped until a better C++ parser is adopted
t.SkipNow()

// Build
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)

// Preprocess
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
}

func tryBuildAvrLeonardo(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
_, err := tryBuild(t, env, cli, "arduino:avr:leonardo")
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <Arduino.h>
#line 1 {{QuoteCppString .sketchMainFile}}
template< typename T >
struct Foo{
typedef T Bar;
};

#line 6 {{QuoteCppString .sketchMainFile}}
void setup();
#line 10 {{QuoteCppString .sketchMainFile}}
void loop();
#line 12
Foo<char>::Bar func();
#line 6 {{QuoteCppString .sketchMainFile}}
void setup() {
func();
}

void loop() {}

typename Foo<char>::Bar func(){

}

12 changes: 0 additions & 12 deletions legacy/builder/test/ctags_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ func TestCTagsRunner(t *testing.T) {
require.Equal(t, expectedOutput, strings.Replace(string(ctagsOutput), "\r\n", "\n", -1))
}

func TestCTagsRunnerSketchWithTypename(t *testing.T) {
sketchLocation := Abs(t, paths.New("sketch_with_typename", "sketch_with_typename.ino"))
ctagsOutput := ctagsRunnerTestTemplate(t, sketchLocation)

quotedSketchLocation := strings.Replace(sketchLocation.String(), "\\", "\\\\", -1)
expectedOutput := "Foo\t" + quotedSketchLocation + "\t/^ struct Foo{$/;\"\tkind:struct\tline:2\n" +
"setup\t" + quotedSketchLocation + "\t/^void setup() {$/;\"\tkind:function\tline:6\tsignature:()\treturntype:void\n" +
"loop\t" + quotedSketchLocation + "\t/^void loop() {}$/;\"\tkind:function\tline:10\tsignature:()\treturntype:void\n" +
"func\t" + quotedSketchLocation + "\t/^typename Foo<char>::Bar func(){$/;\"\tkind:function\tline:12\tsignature:()\treturntype:Foo::Bar\n"
require.Equal(t, expectedOutput, strings.Replace(string(ctagsOutput), "\r\n", "\n", -1))
}

func TestCTagsRunnerSketchWithNamespace(t *testing.T) {
sketchLocation := Abs(t, paths.New("sketch_with_namespace", "sketch_with_namespace.ino"))
ctagsOutput := ctagsRunnerTestTemplate(t, sketchLocation)
Expand Down
39 changes: 0 additions & 39 deletions legacy/builder/test/prototypes_adder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,45 +413,6 @@ func TestPrototypesAdderSketchWithUSBCON(t *testing.T) {
require.Contains(t, preprocessedSketch, "#line 5 "+quotedSketchLocation+"\nvoid ciao();\n#line 10 "+quotedSketchLocation+"\nvoid setup();\n#line 15 "+quotedSketchLocation+"\nvoid loop();\n#line 5 "+quotedSketchLocation+"\n")
}

func TestPrototypesAdderSketchWithTypename(t *testing.T) {
sketchLocation := paths.New("sketch_with_typename", "sketch_with_typename.ino")
quotedSketchLocation := cpp.QuoteString(Abs(t, sketchLocation).String())

ctx := &types.Context{
HardwareDirs: paths.NewPathList(filepath.Join("..", "hardware"), "downloaded_hardware"),
BuiltInLibrariesDirs: paths.New("libraries", "downloaded_libraries"),
BuiltInToolsDirs: paths.NewPathList("downloaded_tools"),
Verbose: true,
}
ctx = prepareBuilderTestContext(t, ctx, sketchLocation, "arduino:avr:leonardo")
defer cleanUpBuilderTestContext(t, ctx)

var _err error
commands := []types.Command{
&builder.ContainerSetupHardwareToolsLibsSketchAndProps{},
types.BareCommand(func(ctx *types.Context) error {
ctx.LineOffset, _err = bldr.PrepareSketchBuildPath(ctx.Sketch, ctx.SourceOverride, ctx.SketchBuildPath)
return _err
}),
&builder.ContainerFindIncludes{},
}
for _, command := range commands {
err := command.Run(ctx)
NoError(t, err)
}
NoError(t, builder.PreprocessSketch(ctx))

preprocessedSketch := loadPreprocessedSketch(t, ctx)
require.Contains(t, preprocessedSketch, "#include <Arduino.h>\n#line 1 "+quotedSketchLocation+"\n")
expected := "#line 6 " + quotedSketchLocation + "\nvoid setup();\n#line 10 " + quotedSketchLocation + "\nvoid loop();\n#line 12 " + quotedSketchLocation + "\ntypename Foo<char>::Bar func();\n#line 6 " + quotedSketchLocation + "\n"
obtained := preprocessedSketch
// ctags based preprocessing ignores line with typename
// TODO: remove this exception when moving to a more powerful parser
expected = strings.Replace(expected, "#line 12 "+quotedSketchLocation+"\ntypename Foo<char>::Bar func();\n", "", -1)
obtained = strings.Replace(obtained, "#line 12 "+quotedSketchLocation+"\ntypename Foo<char>::Bar func();\n", "", -1)
require.Contains(t, obtained, expected)
}

func TestPrototypesAdderSketchWithIfDef2(t *testing.T) {
sketchLocation := paths.New("sketch_with_ifdef", "sketch_with_ifdef.ino")
quotedSketchLocation := cpp.QuoteString(Abs(t, sketchLocation).String())
Expand Down
14 changes: 0 additions & 14 deletions legacy/builder/test/sketch_with_typename/sketch_with_typename.ino

This file was deleted.