99VAR_USE_SUBDIR = "USE_SUBDIR" . freeze
1010VAR_EXPECT_EXAMPLES = "EXPECT_EXAMPLES" . freeze
1111VAR_EXPECT_UNITTESTS = "EXPECT_UNITTESTS" . freeze
12+ VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT = "ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT" . freeze
13+ VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT = "ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT" . freeze
1214
1315@failure_count = 0
1416@passfail = proc { |result | result ? "✓" : "✗" }
@@ -62,6 +64,8 @@ def self.parse(options)
6264 puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)"
6365 puts " - #{ VAR_CUSTOM_INIT_SCRIPT_SHELL } - if set, this will override the"
6466 puts " default shell (/bin/sh) used to execute #{ VAR_CUSTOM_INIT_SCRIPT } with."
67+ puts " - #{ VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT } and/or #{ VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT } "
68+ puts " if set, run the script before/after each unit test run"
6569 puts " - #{ VAR_USE_SUBDIR } - if set, the script will install the library from this subdirectory of the cwd"
6670 puts " - #{ VAR_EXPECT_EXAMPLES } - if set, testing will fail if no example sketches are present"
6771 puts " - #{ VAR_EXPECT_UNITTESTS } - if set, testing will fail if no unit tests are present"
@@ -425,6 +429,7 @@ def perform_unit_tests(cpp_library, file_config)
425429 platforms . each do |p |
426430 puts
427431 compilers . each do |gcc_binary |
432+ run_custom_script ( VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
428433 # before compiling the tests, build a shared library of everything except the test code
429434 next unless build_shared_library ( gcc_binary , p , config , cpp_library )
430435
@@ -444,6 +449,7 @@ def perform_unit_tests(cpp_library, file_config)
444449 cpp_library . run_test_file ( exe )
445450 end
446451 end
452+ run_custom_script ( VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
447453 end
448454 end
449455end
0 commit comments