diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a7da7df..3815308c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added +- Special handling of attempts to run the `arduino_ci.rb` CI script against the ruby library instead of an actual Arduino project +- Explicit checks for attemping to test `arduino_ci` itself as if it were a library, resolving a minor annoyance to this developer. ### Changed - Arduino backend is now `arduino-cli` version `0.13.0` diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 110ca71d..07878014 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -214,10 +214,25 @@ def perform_unit_tests(file_config) # iterate boards / tests if !cpp_library.tests_dir.exist? - inform_multiline("Skipping unit tests; no tests dir at #{cpp_library.tests_dir}") do - puts " In case that's an error, this is what was found in the library:" - display_files(cpp_library.tests_dir.parent) - true + # alert future me about running the script from the wrong directory, instead of doing the huge file dump + # otherwise, assume that the user might be running the script on a library with no actual unit tests + if (Pathname.new(__dir__).parent == Pathname.new(Dir.pwd)) + inform_multiline("arduino_ci seems to be trying to test itself") do + [ + "arduino_ci (the ruby gem) isn't an arduino project itself, so running the CI test script against", + "the core library isn't really a valid thing to do... but it's easy for a developer (including the", + "owner) to mistakenly do just that. Hello future me, you probably meant to run this against one of", + "the sample projects in SampleProjects/ ... if not, please submit a bug report; what a wild case!" + ].each { |l| puts " #{l}" } + false + end + exit(1) + else + inform_multiline("Skipping unit tests; no tests dir at #{cpp_library.tests_dir}") do + puts " In case that's an error, this is what was found in the library:" + display_files(cpp_library.tests_dir.parent) + true + end end elsif cpp_library.test_files.empty? inform_multiline("Skipping unit tests; no test files were found in #{cpp_library.tests_dir}") do