1515VAR_USE_SUBDIR = "USE_SUBDIR" . freeze
1616VAR_EXPECT_EXAMPLES = "EXPECT_EXAMPLES" . freeze
1717VAR_EXPECT_UNITTESTS = "EXPECT_UNITTESTS" . freeze
18+ VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT = "ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT" . freeze
19+ VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT = "ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT" . freeze
1820
1921@failure_count = 0
2022@passfail = proc { |result | result ? "✓" : "✗" }
@@ -68,6 +70,8 @@ def self.parse(options)
6870 puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)"
6971 puts " - #{ VAR_CUSTOM_INIT_SCRIPT_SHELL } - if set, this will override the"
7072 puts " default shell (/bin/sh) used to execute #{ VAR_CUSTOM_INIT_SCRIPT } with."
73+ puts " - #{ VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT } and/or #{ VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT } "
74+ puts " if set, run the script before/after each unit test run"
7175 puts " - #{ VAR_USE_SUBDIR } - if set, the script will install the library from this subdirectory of the cwd"
7276 puts " - #{ VAR_EXPECT_EXAMPLES } - if set, testing will fail if no example sketches are present"
7377 puts " - #{ VAR_EXPECT_UNITTESTS } - if set, testing will fail if no unit tests are present"
@@ -438,6 +442,7 @@ def perform_unit_tests(cpp_library, file_config)
438442 platforms . each do |p |
439443 puts
440444 compilers . each do |gcc_binary |
445+ run_custom_script ( VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
441446 # before compiling the tests, build a shared library of everything except the test code
442447 next unless build_shared_library ( gcc_binary , p , config , cpp_library )
443448
@@ -457,6 +462,7 @@ def perform_unit_tests(cpp_library, file_config)
457462 cpp_library . run_test_file ( exe )
458463 end
459464 end
465+ run_custom_script ( VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
460466 end
461467 end
462468end
0 commit comments