9
9
VAR_USE_SUBDIR = "USE_SUBDIR" . freeze
10
10
VAR_EXPECT_EXAMPLES = "EXPECT_EXAMPLES" . freeze
11
11
VAR_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
12
14
13
15
@failure_count = 0
14
16
@passfail = proc { |result | result ? "✓" : "✗" }
@@ -62,6 +64,8 @@ def self.parse(options)
62
64
puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)"
63
65
puts " - #{ VAR_CUSTOM_INIT_SCRIPT_SHELL } - if set, this will override the"
64
66
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"
65
69
puts " - #{ VAR_USE_SUBDIR } - if set, the script will install the library from this subdirectory of the cwd"
66
70
puts " - #{ VAR_EXPECT_EXAMPLES } - if set, testing will fail if no example sketches are present"
67
71
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)
425
429
platforms . each do |p |
426
430
puts
427
431
compilers . each do |gcc_binary |
432
+ run_custom_script ( VAR_ARDUINO_CI_PRE_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
428
433
# before compiling the tests, build a shared library of everything except the test code
429
434
next unless build_shared_library ( gcc_binary , p , config , cpp_library )
430
435
@@ -444,6 +449,7 @@ def perform_unit_tests(cpp_library, file_config)
444
449
cpp_library . run_test_file ( exe )
445
450
end
446
451
end
452
+ run_custom_script ( VAR_ARDUINO_CI_POST_UNIT_TEST_RUN_SCRIPT , p , gcc_binary )
447
453
end
448
454
end
449
455
end
0 commit comments