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"
@@ -444,6 +448,7 @@ def perform_unit_tests(cpp_library, file_config)
444
448
platforms . each do |p |
445
449
puts
446
450
compilers . each do |gcc_binary |
451
+ run_custom_script ( VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
447
452
# before compiling the tests, build a shared library of everything except the test code
448
453
next @failure_count += 1 unless build_shared_library ( gcc_binary , p , config , cpp_library )
449
454
@@ -463,6 +468,7 @@ def perform_unit_tests(cpp_library, file_config)
463
468
cpp_library . run_test_file ( exe )
464
469
end
465
470
end
471
+ run_custom_script ( VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
466
472
end
467
473
end
468
474
end
0 commit comments