Skip to content

Commit 9fbb4fa

Browse files
committed
add doc and test for CI
1 parent afc98c4 commit 9fbb4fa

File tree

6 files changed

+39
-2
lines changed

6 files changed

+39
-2
lines changed

docs/sketch-build-process.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ compiler:
2727
rare cases, prototype generation may fail for some functions. To work around this, you can provide your own prototypes
2828
for these functions.
2929
- `#line` directives are added to make warning or error messages reflect the original sketch layout.
30+
- Special and optional sketch variables named ARDUIFINE and ARDUINOGLOBAL are parsed, and their content is used to
31+
provide more arguments to the compiler commands. Those arguments are used for every compiled source file, including
32+
the core, internal and external libraries. Their content is displayed in the message area.
3033

3134
No pre-processing is done to files in a sketch with any extension other than .ino or .pde. Additionally, .h files in the
3235
sketch are not automatically #included from the main sketch file. Further, if you want to call functions defined in a .c

legacy/builder/test/builder_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,25 @@ func prepareBuilderTestContext(t *testing.T, sketchPath *paths.Path, fqbn string
4343
}
4444
}
4545

46+
func TestBuilderArduifine(t *testing.T) {
47+
DownloadCoresAndToolsAndLibraries(t)
48+
49+
ctx := prepareBuilderTestContext(t, paths.New("sketch_arduifine", "sketch_arduifine.ino"), "arduino:avr:uno")
50+
ctx.DebugLevel = 10
51+
52+
buildPath := SetupBuildPath(t, ctx)
53+
defer buildPath.RemoveAll()
54+
55+
// Run builder
56+
command := builder.Builder{}
57+
err := command.Run(ctx)
58+
NoError(t, err)
59+
60+
exist, err := buildPath.Join("sketch_arduifine.ino.hex").ExistCheck()
61+
NoError(t, err)
62+
require.True(t, exist)
63+
}
64+
4665
func TestBuilderEmptySketch(t *testing.T) {
4766
DownloadCoresAndToolsAndLibraries(t)
4867

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
#include <lib4arduifine.h>
3+
4+
#if MYVERSION == 1337
5+
#pragma message "arduifine: MYVERSION is correctly defined"
6+
#else
7+
#error arduifine: MYVERSION is not correctly defined
8+
#endif

legacy/builder/test/libraries/lib4arduifine/lib4arduifine.h

Whitespace-only changes.

legacy/builder/test/libraries_loader_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestLoadLibrariesAVR(t *testing.T) {
6666
require.True(t, Abs(t, paths.New("libraries")).EquivalentTo(librariesFolders[2].Path))
6767

6868
libs := extractLibraries(ctx)
69-
require.Equal(t, 24, len(libs))
69+
require.Equal(t, 25, len(libs))
7070

7171
sort.Sort(ByLibraryName(libs))
7272

@@ -176,7 +176,7 @@ func TestLoadLibrariesSAM(t *testing.T) {
176176
require.True(t, Abs(t, paths.New("libraries")).EquivalentTo(librariesFolders[2].Path))
177177

178178
libraries := extractLibraries(ctx)
179-
require.Equal(t, 22, len(libraries))
179+
require.Equal(t, 23, len(libraries))
180180

181181
sort.Sort(ByLibraryName(libraries))
182182

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
#include <lib4arduifine.h>
3+
4+
const char* ARDUIFINEtest = "MYVERSION = 1337";
5+
6+
void setup() {}
7+
void loop() {}

0 commit comments

Comments
 (0)