Skip to content

Commit b7016a8

Browse files
James Fosterianfixes
James Foster
andauthored
Merge 2020-10-16_suggestions from infixes (#11)
* Increase clarity of command line tool: The command line option --skip-compilation can be confusing, because unit tests must be compiled before they can run. This adds some text to the flag such that the fact that examples are compiled is acknowledged. * Use proper 1.5 library format * Obey 1.0 / 1.5 library specification when finding C++ library source * Appease rubocop * avoid error when testing for membership in a nonexistent directory * Add library.properties parsing * Add recursive library dependency compilation * Fix unit tests for source directory exclusion * reorder changelog sections * Fix _SFR_IO8 macro definition -- use volatile keyword to prevent optimization * Add dummy test files to sample projects to ensure they aren't included in C++ file listings * Print unit test stack traces if encountered * Fix definition of SFR macro to prevent linker errors about duplicate symbol * Explore possible fix for Arduino-CI#187. * Tests now pass (but only because of a horrible hack by someone who doesn't understand what is happening!). Co-authored-by: Ian Katz <[email protected]>
1 parent fbc5987 commit b7016a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+544
-107
lines changed

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Layout/ExtraSpacing:
3131
Layout/EndOfLine:
3232
EnforcedStyle: lf
3333

34+
Layout/EndAlignment:
35+
EnforcedStyleAlignWith: start_of_line
36+
37+
Layout/CaseIndentation:
38+
EnforcedStyle: end
39+
3440
Metrics/LineLength:
3541
Description: Limit lines to 80 characters.
3642
StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits

CHANGELOG.md

Lines changed: 14 additions & 4 deletions

REFERENCE.md

Lines changed: 9 additions & 4 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
depends=OnePointOhDummy,OnePointFiveDummy

SampleProjects/DependOnSomething/src/YesDeps.cpp

Whitespace-only changes.

SampleProjects/DependOnSomething/src/YesDeps.h

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <ArduinoUnitTests.h>
2+
3+
unittest(nothing)
4+
{
5+
}
6+
7+
unittest_main()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
unittest:
2+
exclude_dirs:
3+
- src/excludeThis
Lines changed: 3 additions & 0 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name=TestSomething
2+
version=0.1.0
3+
author=Ian Katz <[email protected]>
4+
maintainer=Ian Katz <[email protected]>
5+
sentence=Arduino CI unit test example
6+
paragraph=A skeleton library demonstrating file exclusion
7+
category=Other
8+
url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/ExcludeSomething
9+
architectures=avr,esp8266
10+
includes=do-something.h
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include "exclude-something.h"
2+
int excludeSomething(void) {
3+
return -1;
4+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
#include <Arduino.h>
3+
int excludeSomething(void);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <ArduinoUnitTests.h>
2+
3+
unittest(nothing)
4+
{
5+
}
6+
7+
unittest_main()

SampleProjects/OnePointFiveDummy/NoBase.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveDummy/NoBase.h

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions

SampleProjects/OnePointFiveDummy/library.properties

Whitespace-only changes.

SampleProjects/OnePointFiveDummy/src/YesSrc.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveDummy/src/YesSrc.h

Whitespace-only changes.

SampleProjects/OnePointFiveDummy/src/subdir/YesSubdir.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveDummy/src/subdir/YesSubdir.h

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <ArduinoUnitTests.h>
2+
3+
unittest(nothing)
4+
{
5+
}
6+
7+
unittest_main()

SampleProjects/OnePointFiveDummy/utility/ImNotHere.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveDummy/utility/ImNotHere.h

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions

SampleProjects/OnePointFiveMalformed/YesBase.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveMalformed/YesBase.h

Whitespace-only changes.

SampleProjects/OnePointFiveMalformed/src/ImNotHere.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveMalformed/src/ImNotHere.h

Whitespace-only changes.

SampleProjects/OnePointFiveMalformed/utility/YesUtil.cpp

Whitespace-only changes.

SampleProjects/OnePointFiveMalformed/utility/YesUtil.h

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions

SampleProjects/OnePointOhDummy/YesBase.cpp

Whitespace-only changes.

SampleProjects/OnePointOhDummy/YesBase.h

Whitespace-only changes.

SampleProjects/OnePointOhDummy/src/ImNotHere.cpp

Whitespace-only changes.

SampleProjects/OnePointOhDummy/src/ImNotHere.h

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <ArduinoUnitTests.h>
2+
3+
unittest(nothing)
4+
{
5+
}
6+
7+
unittest_main()

SampleProjects/OnePointOhDummy/utility/YesUtil.cpp

Whitespace-only changes.

SampleProjects/OnePointOhDummy/utility/YesUtil.h

Whitespace-only changes.

SampleProjects/README.md

Lines changed: 11 additions & 3 deletions

SampleProjects/TestSomething/.arduino-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
unittest:
2-
exclude_dirs:
3-
- excludeThis
42
platforms:
53
- uno
64
- due

SampleProjects/TestSomething/test/library.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <ArduinoUnitTests.h>
2-
#include "../test-something.h"
2+
#include "../src/test-something.h"
33

44
unittest(library_tests_something)
55
{

cpp/arduino/Arduino.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Mock Arduino.h library.
55
Where possible, variable names from the Arduino library are used to avoid conflicts
66
77
*/
8+
89
// Chars and strings
910

1011
#include "ArduinoDefines.h"
@@ -72,5 +73,3 @@ inline unsigned int makeWord(unsigned int w) { return w; }
7273
inline unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; }
7374

7475
#define word(...) makeWord(__VA_ARGS__)
75-
76-

lib/arduino_ci.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
require "arduino_ci/arduino_installation"
33
require "arduino_ci/cpp_library"
44
require "arduino_ci/ci_config"
5+
require "arduino_ci/library_properties"
56

67
# ArduinoCI contains classes for automated testing of Arduino code on the command line
78
# @author Ian Katz <[email protected]>

lib/arduino_ci/arduino_installation.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def autolocate!(output = $stdout)
110110
# Forcibly install Arduino from the web
111111
# @return [bool] Whether the command succeeded
112112
def force_install(output = $stdout, version = DESIRED_ARDUINO_IDE_VERSION)
113-
worker_class = case Host.os
114-
when :osx then ArduinoDownloaderOSX
115-
when :windows then ArduinoDownloaderWindows
116-
when :linux then ArduinoDownloaderLinux
117-
end
113+
worker_class = case Host.os
114+
when :osx then ArduinoDownloaderOSX
115+
when :windows then ArduinoDownloaderWindows
116+
when :linux then ArduinoDownloaderLinux
117+
end
118118
worker = worker_class.new(version, output)
119119
worker.execute
120120
end

0 commit comments

Comments
 (0)