Skip to content

Commit

Permalink
ported SketchWithFastledsLibrary from legacy into integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Sep 13, 2023
1 parent f3ef21e commit c8d1195
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 54 deletions.
19 changes: 19 additions & 0 deletions internal/integrationtest/compile_4/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func TestCompileOfProblematicSketches(t *testing.T) {
require.NoError(t, err)
_, _, err = cli.Run("lib", "install", "[email protected]")
require.NoError(t, err)
_, _, err = cli.Run("lib", "install", "[email protected]")
require.NoError(t, err)

// Install custom hardware required for tests
customHwDir, err := paths.New("..", "testdata", "user_hardware").Abs()
Expand Down Expand Up @@ -114,6 +116,7 @@ func TestCompileOfProblematicSketches(t *testing.T) {
{"SketchWithMultilineTemplate", testBuilderSketchWithMultilineTemplate},
{"SketchWithFakeFunctionPointer", testBuilderSketchWithFakeFunctionPointer},
{"SketchWithMinMaxDefinitions", testBuilderSketchWithMinMaxDefinitions},
{"SketchWithFastledsLibrary", testBuilderSketchWithFastledsLibrary},
}.Run(t, env, cli)
}

Expand Down Expand Up @@ -757,6 +760,22 @@ func testBuilderSketchWithMinMaxDefinitions(t *testing.T, env *integrationtest.E
})
}

func testBuilderSketchWithFastledsLibrary(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
t.Run("Build", func(t *testing.T) {
// Build
_, err := tryBuild(t, env, cli, "arduino:samd:arduino_zero_native")
require.NoError(t, err)
})

t.Run("Preprocess", func(t *testing.T) {
// Preprocess
sketchPath, preprocessedSketch, err := tryPreprocess(t, env, cli, "arduino:samd:arduino_zero_native")
require.NoError(t, err)
comparePreprocessGoldenFile(t, sketchPath, preprocessedSketch)
})
}


type builderOutput struct {
CompilerOut string `json:"compiler_out"`
CompilerErr string `json:"compiler_err"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ SimplePatternList gPatterns = {sinelon};

void sinelon()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <Arduino.h>
#line 1 {{QuoteCppString .sketchMainFile}}
#include "FastLED.h"

#define DATA_PIN 7
#define CLK_PIN 6
#define LED_TYPE APA102
#define COLOR_ORDER GRB
#define NUM_LEDS 79
CRGB leds[NUM_LEDS];

#define BRIGHTNESS 96
#define FRAMES_PER_SECOND 120
#line 12 {{QuoteCppString .sketchMainFile}}
void setup();
#line 17 {{QuoteCppString .sketchMainFile}}
void loop();
#line 25 {{QuoteCppString .sketchMainFile}}
void sinelon();
#line 12 {{QuoteCppString .sketchMainFile}}
void setup() {

FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
}

void loop() {

}

typedef void (*SimplePatternList[])();
//SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
SimplePatternList gPatterns = {sinelon};

void sinelon()
{
}

53 changes: 0 additions & 53 deletions legacy/builder/test/try_build_of_problematic_sketch_test.go

This file was deleted.

0 comments on commit c8d1195

Please sign in to comment.