arduino / ArduinoCore-API

Hardware independent layer of the Arduino cores defining the official API
https://www.arduino.cc/reference/en/
GNU Lesser General Public License v2.1
215 stars 119 forks source link

Allow tests to run on systems with case-insensitive filesystems and newer compilers. #208

Closed jboynes closed 1 year ago

jboynes commented 1 year ago

This change allows the test suite to run on desktop machines with case-insenstive filesystems (e.g. macOS and Windows) without needing a Linux VM or special mount point.

The main issue is the conflict between "String.h" in the api directory and the standard "string.h" include; the API's one gets matched when included with #include <String.h>" which does not happen in a core because the include path points to the parent of the api directory. So the main change here is to alter the include path for the tests to the parent of the api directory to match. Unfortunately this meant modifying all the tests to include api/ in the header filename.

Testing this on macOS with XCode 13.3 (native cc which is clang 14.x) and GCC 13 also tripped over stricter warnings related to the deprecation of sprintf and the self-move test for String. The PR includes #pragma statements to suppress those warnings as I didn't want to change production code in this PR, saving it for separate patch.

I confirmed the tests still pass on Ubuntu with GCC 12.

codecov-commenter commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (f77c4b5) 95.52% compared to head (da415e6) 95.52%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #208 +/- ## ======================================= Coverage 95.52% 95.52% ======================================= Files 16 16 Lines 1072 1072 ======================================= Hits 1024 1024 Misses 48 48 ``` | [Files Changed](https://app.codecov.io/gh/arduino/ArduinoCore-API/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=arduino) | Coverage Δ | | |---|---|---| | [api/IPAddress.cpp](https://app.codecov.io/gh/arduino/ArduinoCore-API/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=arduino#diff-YXBpL0lQQWRkcmVzcy5jcHA=) | `94.52% <ø> (ø)` | | | [api/deprecated-avr-comp/avr/dtostrf.c.impl](https://app.codecov.io/gh/arduino/ArduinoCore-API/pull/208?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=arduino#diff-YXBpL2RlcHJlY2F0ZWQtYXZyLWNvbXAvYXZyL2R0b3N0cmYuYy5pbXBs) | `100.00% <ø> (ø)` | |

:umbrella: View full report in Codecov by Sentry.

:loudspeaker: Have feedback on the report? Share it here.