Skip to content

Merge 2020-10-16_suggestions from infixes #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Layout/ExtraSpacing:
Layout/EndOfLine:
EnforcedStyle: lf

Layout/EndAlignment:
EnforcedStyleAlignWith: start_of_line

Layout/CaseIndentation:
EnforcedStyle: end

Metrics/LineLength:
Description: Limit lines to 80 characters.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
Expand Down
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Add stubs for `Client.h`, `IPAddress.h`, `Printable.h`, `Server.h`, and `Udp.h`
- Add support for `digitalPinToPort()`, `digitalPinToBitMask()`, and `portOutputRegister()`
- Support for mock EEPROM (but only if board supports it)
- `arduino_ci_remote.rb` CLI switch `--skip-examples-compilation`
- `CppLibrary.header_files` to find header files
- `LibraryProperties` to read metadata from Arduino libraries
- `CppLibrary.library_properties_path`, `CppLibrary.library_properties?`, `CppLibrary.library_properties` to expose library properties of a Cpp library
- `CppLibrary.arduino_library_dependencies` to list the dependent libraries specified by the library.properties file
- `CppLibrary.print_stack_dump` prints stack trace dumps (on Windows specifically) to the console if encountered

### Changed
- Move repository from https://github.com/ianfixes/arduino_ci to https://github.com/Arduino-CI/arduino_ci
- `CppLibrary` functions returning C++ header or code files now respect the 1.0/1.5 library specification
- Revise math macros to avoid name clashes

### Fixed
- Don't define `ostream& operator<<(nullptr_t)` if already defined by Apple
- `CppLibrary.in_tests_dir?` no longer produces an error if there is no tests directory
- The definition of the `_SFR_IO8` macro no longer produces errors about rvalues

### Deprecated
- Deprecated `arduino_ci_remote.rb` in favor of `arduino_ci.rb`
- `arduino_ci_remote.rb` in favor of `arduino_ci.rb`
- `arduino_ci_remote.rb` CLI switch `--skip-compilation`

### Removed

### Fixed
- Don't define `ostream& operator<<(nullptr_t)` if already defined by Apple

### Security


Expand Down
13 changes: 9 additions & 4 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ When testing locally, it's often advantageous to limit the number of tests that
This completely skips the unit testing portion of the CI script.


### `--skip-compilation` option
### `--skip-compilation` option (deprecated)

This completely skips the compilation tests (of library examples) portion of the CI script.
This completely skips the compilation tests (of library examples) portion of the CI script. It does not skip the compilation of unit tests.


### `--skip-examples-compilation` option

This completely skips the compilation tests (of library examples) portion of the CI script. It does not skip the compilation of unit tests.


### `--testfile-select` option
Expand Down Expand Up @@ -90,8 +95,8 @@ platforms:

### Control How Examples Are Compiled

Put a file `.arduino-ci.yml` in each example directory where you require a different configuration than default.
The `compile:` section controls the platforms on which the compilation will be attempted, as well as any external libraries that must be installed and included.
Put a file `.arduino-ci.yml` in each example directory where you require a different configuration than default.
The `compile:` section controls the platforms on which the compilation will be attempted, as well as any external libraries that must be installed and included.

```yaml
compile:
Expand Down
1 change: 1 addition & 0 deletions SampleProjects/DependOnSomething/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
depends=OnePointOhDummy,OnePointFiveDummy
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions SampleProjects/DependOnSomething/test/null.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <ArduinoUnitTests.h>

unittest(nothing)
{
}

unittest_main()
3 changes: 3 additions & 0 deletions SampleProjects/ExcludeSomething/.arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
unittest:
exclude_dirs:
- src/excludeThis
3 changes: 3 additions & 0 deletions SampleProjects/ExcludeSomething/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ExcludeSomething

This example exists to test directory-exclusion code of ArduinoCI
10 changes: 10 additions & 0 deletions SampleProjects/ExcludeSomething/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name=TestSomething
version=0.1.0
author=Ian Katz <[email protected]>
maintainer=Ian Katz <[email protected]>
sentence=Arduino CI unit test example
paragraph=A skeleton library demonstrating file exclusion
category=Other
url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/ExcludeSomething
architectures=avr,esp8266
includes=do-something.h
4 changes: 4 additions & 0 deletions SampleProjects/ExcludeSomething/src/exclude-something.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "exclude-something.h"
int excludeSomething(void) {
return -1;
};
3 changes: 3 additions & 0 deletions SampleProjects/ExcludeSomething/src/exclude-something.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once
#include <Arduino.h>
int excludeSomething(void);
7 changes: 7 additions & 0 deletions SampleProjects/ExcludeSomething/test/null.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <ArduinoUnitTests.h>

unittest(nothing)
{
}

unittest_main()
Empty file.
Empty file.
1 change: 1 addition & 0 deletions SampleProjects/OnePointFiveDummy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project resembles a "1.5 spec" library: it has `library.properties` and a `src/` directory that will be scanned recursively. `utility/`, if present, will be ignored.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions SampleProjects/OnePointFiveDummy/test/null.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <ArduinoUnitTests.h>

unittest(nothing)
{
}

unittest_main()
Empty file.
Empty file.
1 change: 1 addition & 0 deletions SampleProjects/OnePointFiveMalformed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project lacks a `library.properties` and so should be treated as a "1.0 spec" library -- the base and `utility` directories will be scanned for code, non-recursively. `src/`, if present, will be ignored.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions SampleProjects/OnePointOhDummy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project should resemble "1.0 spec" library -- the base and `utility` directories will be scanned for code, non-recursively. `src/`, if present, will be ignored.
Empty file.
Empty file.
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions SampleProjects/OnePointOhDummy/test/null.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <ArduinoUnitTests.h>

unittest(nothing)
{
}

unittest_main()
Empty file.
Empty file.
14 changes: 11 additions & 3 deletions SampleProjects/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Arduino Sample Projects
=======================

This directory contains projects that are meant to be built with and tested by this gem. Although this directory is named `SampleProjects`, it is by no means optional. These project test the testing framework itself, but also provide examples of how you might write your own tests (which should be placed in your system's Arduino `libraries` directory).
This directory contains projects that are intended solely for testing the various features of this gem -- to test the testing framework itself. The RSpec tests refer specifically to these projects.

* "DoSomething" is a simple test of the testing framework (arduino_ci) itself to verfy that passes and failures are properly identified and reported.
* "TestSomething" contains tests for all the mock features of arduino_ci.
Because of this, these projects include some intentional quirks that differ from what a well-formed an Arduino project for testing with `arduino_ci` might contain. See other projects in the "Arduino-CI" GitHub organization for practical examples.


* "TestSomething" contains a minimial library, but tests for all the C++ compilation feature-mocks of arduino_ci.
* "DoSomething" is a simple test of the testing framework (arduino_ci) itself to verfy that passes and failures are properly identified and reported. Because of this, it includes test files that are expected to fail -- they are prefixed with "bad-".
* "OnePointOhDummy" is a non-functional library meant to test file inclusion logic on libraries conforming to the "1.0" specification
* "OnePointFiveMalformed" is a non-functional library meant to test file inclusion logic on libraries that attempt to conform to the ["1.5" specfication](https://arduino.github.io/arduino-cli/latest/library-specification/) but fail to include a `src` directory
* "OnePointFiveDummy" is a non-functional library meant to test file inclusion logic on libraries conforming to the ["1.5" specfication](https://arduino.github.io/arduino-cli/latest/library-specification/)
* "DependOnSomething" is a non-functional library meant to test file inclusion logic with dependencies
* "ExcludeSomething" is a non-functional library meant to test directory exclusion logic
2 changes: 0 additions & 2 deletions SampleProjects/TestSomething/.arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
unittest:
exclude_dirs:
- excludeThis
platforms:
- uno
- due
Expand Down
2 changes: 1 addition & 1 deletion SampleProjects/TestSomething/test/library.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <ArduinoUnitTests.h>
#include "../test-something.h"
#include "../src/test-something.h"

unittest(library_tests_something)
{
Expand Down
3 changes: 1 addition & 2 deletions cpp/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Mock Arduino.h library.
Where possible, variable names from the Arduino library are used to avoid conflicts

*/

// Chars and strings

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

#define word(...) makeWord(__VA_ARGS__)


1 change: 1 addition & 0 deletions lib/arduino_ci.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require "arduino_ci/arduino_installation"
require "arduino_ci/cpp_library"
require "arduino_ci/ci_config"
require "arduino_ci/library_properties"

# ArduinoCI contains classes for automated testing of Arduino code on the command line
# @author Ian Katz <[email protected]>
Expand Down
10 changes: 5 additions & 5 deletions lib/arduino_ci/arduino_installation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def autolocate!(output = $stdout)
# Forcibly install Arduino from the web
# @return [bool] Whether the command succeeded
def force_install(output = $stdout, version = DESIRED_ARDUINO_IDE_VERSION)
worker_class = case Host.os
when :osx then ArduinoDownloaderOSX
when :windows then ArduinoDownloaderWindows
when :linux then ArduinoDownloaderLinux
end
worker_class = case Host.os
when :osx then ArduinoDownloaderOSX
when :windows then ArduinoDownloaderWindows
when :linux then ArduinoDownloaderLinux
end
worker = worker_class.new(version, output)
worker.execute
end
Expand Down
Loading