@@ -214,10 +214,25 @@ def perform_unit_tests(file_config)
214
214
215
215
# iterate boards / tests
216
216
if !cpp_library . tests_dir . exist?
217
- inform_multiline ( "Skipping unit tests; no tests dir at #{ cpp_library . tests_dir } " ) do
218
- puts " In case that's an error, this is what was found in the library:"
219
- display_files ( cpp_library . tests_dir . parent )
220
- true
217
+ # alert future me about running the script from the wrong directory, instead of doing the huge file dump
218
+ # otherwise, assume that the user might be running the script on a library with no actual unit tests
219
+ if ( Pathname . new ( __dir__ ) . parent == Pathname . new ( Dir . pwd ) )
220
+ inform_multiline ( "arduino_ci seems to be trying to test itself" ) do
221
+ [
222
+ "arduino_ci (the ruby gem) isn't an arduino project itself, so running the CI test script against" ,
223
+ "the core library isn't really a valid thing to do... but it's easy for a developer (including the" ,
224
+ "owner) to mistakenly do just that. Hello future me, you probably meant to run this against one of" ,
225
+ "the sample projects in SampleProjects/ ... if not, please submit a bug report; what a wild case!"
226
+ ] . each { |l | puts " #{ l } " }
227
+ false
228
+ end
229
+ exit ( 1 )
230
+ else
231
+ inform_multiline ( "Skipping unit tests; no tests dir at #{ cpp_library . tests_dir } " ) do
232
+ puts " In case that's an error, this is what was found in the library:"
233
+ display_files ( cpp_library . tests_dir . parent )
234
+ true
235
+ end
221
236
end
222
237
elsif cpp_library . test_files . empty?
223
238
inform_multiline ( "Skipping unit tests; no test files were found in #{ cpp_library . tests_dir } " ) do
0 commit comments