15
15
VAR_USE_SUBDIR = "USE_SUBDIR" . freeze
16
16
VAR_EXPECT_EXAMPLES = "EXPECT_EXAMPLES" . freeze
17
17
VAR_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
18
20
19
21
@failure_count = 0
20
22
@passfail = proc { |result | result ? "✓" : "✗" }
@@ -68,6 +70,8 @@ def self.parse(options)
68
70
puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)"
69
71
puts " - #{ VAR_CUSTOM_INIT_SCRIPT_SHELL } - if set, this will override the"
70
72
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"
71
75
puts " - #{ VAR_USE_SUBDIR } - if set, the script will install the library from this subdirectory of the cwd"
72
76
puts " - #{ VAR_EXPECT_EXAMPLES } - if set, testing will fail if no example sketches are present"
73
77
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)
438
442
platforms . each do |p |
439
443
puts
440
444
compilers . each do |gcc_binary |
445
+ run_custom_script ( VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
441
446
# before compiling the tests, build a shared library of everything except the test code
442
447
next unless build_shared_library ( gcc_binary , p , config , cpp_library )
443
448
@@ -457,6 +462,7 @@ def perform_unit_tests(cpp_library, file_config)
457
462
cpp_library . run_test_file ( exe )
458
463
end
459
464
end
465
+ run_custom_script ( VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
460
466
end
461
467
end
462
468
end
0 commit comments