ceedling 0.15.1 → 0.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +9 -13
- data/README.md +21 -3
- data/{rakefile.rb → Rakefile} +0 -0
- data/lib/ceedling/version.rb +4 -4
- data/lib/ceedling/version.rb.erb +1 -1
- data/release/version.info +1 -1
- data/vendor/c_exception/Gemfile +1 -1
- data/vendor/c_exception/Gemfile.lock +12 -0
- data/vendor/c_exception/{docs/license.txt → LICENSE.txt} +9 -9
- data/vendor/c_exception/README.md +146 -0
- data/vendor/c_exception/{rakefile.rb → Rakefile} +6 -5
- data/vendor/c_exception/lib/CException.c +9 -6
- data/vendor/c_exception/release/build.info +1 -1
- data/vendor/c_exception/release/version.info +1 -1
- data/vendor/c_exception/test/CExceptionConfig.h +2 -0
- data/vendor/c_exception/test/TestException.c +4 -1
- data/vendor/cmock/README.md +24 -0
- data/vendor/cmock/{rakefile.rb → Rakefile} +12 -12
- data/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/vendor/cmock/docs/CMock Summary.pdf +0 -0
- data/vendor/cmock/docs/CMock_Summary.md +130 -111
- data/vendor/cmock/docs/license.txt +1 -1
- data/vendor/cmock/lib/cmock.rb +36 -12
- data/vendor/cmock/lib/cmock_config.rb +39 -36
- data/vendor/cmock/lib/cmock_generator.rb +33 -25
- data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +68 -0
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +18 -42
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -2
- data/vendor/cmock/lib/cmock_generator_utils.rb +39 -29
- data/vendor/cmock/lib/cmock_header_parser.rb +46 -39
- data/vendor/cmock/rakefile_helper.rb +38 -38
- data/vendor/cmock/src/cmock.c +20 -4
- data/vendor/cmock/src/cmock.h +6 -1
- data/vendor/cmock/src/cmock_internals.h +26 -3
- data/vendor/cmock/targets/clang_strict.yml +85 -0
- data/vendor/cmock/targets/gcc.yml +4 -2
- data/vendor/cmock/targets/gcc_64.yml +55 -0
- data/vendor/cmock/test/c/TestCMockC.c +3 -3
- data/vendor/cmock/test/c/TestCMockCDynamic.c +11 -11
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +4 -2
- data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -1
- data/vendor/cmock/test/system/systest_generator.rb +38 -26
- data/vendor/cmock/test/system/test_compilation/const.h +8 -3
- data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +92 -58
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +53 -48
- data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +58 -56
- data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +19 -18
- data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +13 -13
- data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +20 -20
- data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +238 -0
- data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +36 -34
- data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +24 -15
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +11 -11
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +235 -0
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +22 -26
- data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +31 -31
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +141 -109
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +82 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +17 -81
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +10 -10
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +47 -41
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +290 -227
- data/vendor/unity/{rakefile.rb → Rakefile} +13 -6
- data/vendor/unity/auto/colour_prompt.rb +33 -12
- data/vendor/unity/auto/generate_test_runner.rb +67 -63
- data/vendor/unity/auto/parseOutput.rb +189 -0
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/makefile +41 -40
- data/vendor/unity/examples/example_1/readme.txt +5 -0
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode.c +24 -24
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode.h +3 -3
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode2.c +9 -9
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode2.h +2 -2
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/test/TestProductionCode.c +62 -62
- data/vendor/unity/examples/{test → example_1/test}/TestProductionCode2.c +31 -31
- data/vendor/unity/examples/{test/no_ruby → example_1/test/test_runners}/TestProductionCode2_Runner.c +46 -46
- data/vendor/unity/examples/{test/no_ruby → example_1/test/test_runners}/TestProductionCode_Runner.c +50 -50
- data/vendor/unity/examples/example_2/makefile +45 -0
- data/vendor/unity/examples/example_2/readme.txt +5 -0
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode.c +24 -24
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode.h +3 -3
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode2.c +9 -9
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode2.h +2 -2
- data/vendor/unity/examples/{test → example_2/test}/TestProductionCode.c +64 -62
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_2}/test/TestProductionCode2.c +33 -31
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
- data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
- data/vendor/unity/examples/{helper → example_3/helper}/UnityHelper.c +10 -10
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/helper/UnityHelper.h +12 -12
- data/vendor/unity/examples/{makefile → example_3/makefile} +41 -40
- data/vendor/unity/examples/{rakefile.rb → example_3/rakefile.rb} +44 -43
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/rakefile_helper.rb +256 -256
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/readme.txt +18 -17
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode.c +24 -24
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode.h +3 -3
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode2.c +9 -9
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode2.h +2 -2
- data/vendor/{c_exception/vendor/unity/targets/gcc_64.yml → unity/examples/example_3/target_gcc_32.yml} +46 -44
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/TestProductionCode.c +62 -62
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/TestProductionCode2.c +31 -31
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/no_ruby/TestProductionCode2_Runner.c +46 -46
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/test/no_ruby/TestProductionCode_Runner.c +50 -50
- data/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +4 -1
- data/vendor/unity/extras/fixture/src/unity_fixture.h +17 -16
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +7 -7
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +17 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +1 -0
- data/vendor/unity/makefile +6 -4
- data/vendor/unity/rakefile_helper.rb +36 -27
- data/vendor/unity/src/unity.c +180 -181
- data/vendor/unity/src/unity.h +64 -2
- data/vendor/unity/src/unity_internals.h +188 -102
- data/vendor/unity/targets/clang_strict.yml +83 -0
- data/vendor/unity/targets/gcc_32.yml +5 -0
- data/vendor/unity/targets/gcc_64.yml +5 -0
- data/vendor/{c_exception/vendor/unity/targets/gcc.yml → unity/targets/gcc_auto_limits.yml} +5 -2
- data/vendor/{cmock/vendor/unity/targets/gcc_64.yml → unity/targets/gcc_auto_sizeof.yml} +6 -3
- data/vendor/{cmock/vendor/unity/targets/gcc.yml → unity/targets/gcc_auto_stdint.yml} +4 -2
- data/vendor/unity/test/expectdata/testsample_cmd.c +57 -54
- data/vendor/unity/test/expectdata/testsample_def.c +53 -50
- data/vendor/unity/test/expectdata/testsample_mock_cmd.c +79 -76
- data/vendor/unity/test/expectdata/testsample_mock_def.c +75 -72
- data/vendor/unity/test/expectdata/testsample_mock_new1.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_new2.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_param.c +76 -73
- data/vendor/unity/test/expectdata/testsample_mock_run1.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_run2.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_yaml.c +89 -86
- data/vendor/unity/test/expectdata/testsample_new1.c +63 -60
- data/vendor/unity/test/expectdata/testsample_new2.c +66 -63
- data/vendor/unity/test/expectdata/testsample_param.c +54 -51
- data/vendor/unity/test/expectdata/testsample_run1.c +63 -60
- data/vendor/unity/test/expectdata/testsample_run2.c +66 -63
- data/vendor/unity/test/expectdata/testsample_yaml.c +67 -64
- data/vendor/unity/test/test_generate_test_runner.rb +66 -72
- data/vendor/unity/test/testunity.c +591 -111
- metadata +58 -195
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +0 -94
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +0 -39
- data/vendor/c_exception/vendor/unity/auto/generate_config.yml +0 -36
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +0 -202
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +0 -313
- data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +0 -23
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +0 -139
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -217
- data/vendor/c_exception/vendor/unity/docs/license.txt +0 -31
- data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c +0 -10
- data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h +0 -12
- data/vendor/c_exception/vendor/unity/examples/makefile +0 -40
- data/vendor/c_exception/vendor/unity/examples/rakefile.rb +0 -32
- data/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb +0 -256
- data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +0 -50
- data/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk +0 -331
- data/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh +0 -61
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +0 -37
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +0 -178
- data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +0 -9
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +0 -381
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +0 -81
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +0 -44
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +0 -16
- data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +0 -21
- data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +0 -39
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +0 -321
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -40
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +0 -56
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +0 -17
- data/vendor/c_exception/vendor/unity/makefile +0 -35
- data/vendor/c_exception/vendor/unity/rakefile.rb +0 -59
- data/vendor/c_exception/vendor/unity/rakefile_helper.rb +0 -240
- data/vendor/c_exception/vendor/unity/release/build.info +0 -2
- data/vendor/c_exception/vendor/unity/release/version.info +0 -2
- data/vendor/c_exception/vendor/unity/src/unity.c +0 -979
- data/vendor/c_exception/vendor/unity/src/unity.h +0 -232
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +0 -424
- data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +0 -101
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +0 -89
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +0 -79
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +0 -79
- data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -93
- data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +0 -83
- data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +0 -94
- data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +0 -54
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +0 -50
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +0 -76
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +0 -72
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +0 -73
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +0 -86
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +0 -60
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +0 -63
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +0 -51
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +0 -60
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +0 -63
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +0 -64
- data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +0 -94
- data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
- data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
- data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -51
- data/vendor/c_exception/vendor/unity/test/testparameterized.c +0 -101
- data/vendor/c_exception/vendor/unity/test/testunity.c +0 -2024
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/docs/license.txt +0 -30
- data/vendor/cmock/vendor/c_exception/docs/readme.txt +0 -236
- data/vendor/cmock/vendor/c_exception/lib/CException.c +0 -39
- data/vendor/cmock/vendor/c_exception/lib/CException.h +0 -70
- data/vendor/cmock/vendor/c_exception/makefile +0 -24
- data/vendor/cmock/vendor/c_exception/rakefile.rb +0 -41
- data/vendor/cmock/vendor/c_exception/release/build.info +0 -2
- data/vendor/cmock/vendor/c_exception/release/version.info +0 -2
- data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +0 -27
- data/vendor/cmock/vendor/c_exception/test/TestException.c +0 -291
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +0 -62
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +0 -94
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +0 -39
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +0 -36
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +0 -202
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +0 -313
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +0 -23
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +0 -139
- data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +0 -217
- data/vendor/cmock/vendor/unity/docs/license.txt +0 -31
- data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c +0 -10
- data/vendor/cmock/vendor/unity/examples/rakefile.rb +0 -32
- data/vendor/cmock/vendor/unity/examples/readme.txt +0 -18
- data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +0 -46
- data/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk +0 -331
- data/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh +0 -61
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +0 -37
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +0 -178
- data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +0 -9
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +0 -381
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +0 -81
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +0 -44
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +0 -16
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +0 -21
- data/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c +0 -39
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +0 -321
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -40
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +0 -56
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +0 -17
- data/vendor/cmock/vendor/unity/makefile +0 -35
- data/vendor/cmock/vendor/unity/rakefile.rb +0 -48
- data/vendor/cmock/vendor/unity/rakefile_helper.rb +0 -240
- data/vendor/cmock/vendor/unity/release/build.info +0 -2
- data/vendor/cmock/vendor/unity/release/version.info +0 -2
- data/vendor/cmock/vendor/unity/src/unity.c +0 -979
- data/vendor/cmock/vendor/unity/src/unity.h +0 -232
- data/vendor/cmock/vendor/unity/src/unity_internals.h +0 -424
- data/vendor/cmock/vendor/unity/targets/hitech_picc18.yml +0 -101
- data/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml +0 -89
- data/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml +0 -79
- data/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml +0 -79
- data/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -93
- data/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml +0 -83
- data/vendor/cmock/vendor/unity/targets/iar_msp430.yml +0 -94
- data/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +0 -54
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +0 -50
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +0 -76
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +0 -72
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +0 -73
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +0 -86
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +0 -60
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +0 -63
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +0 -51
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +0 -60
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +0 -63
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +0 -64
- data/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb +0 -94
- data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +0 -51
- data/vendor/cmock/vendor/unity/test/testdata/sample.yml +0 -9
- data/vendor/cmock/vendor/unity/test/testdata/testsample.c +0 -51
- data/vendor/cmock/vendor/unity/test/testparameterized.c +0 -101
- data/vendor/cmock/vendor/unity/test/testunity.c +0 -2024
- data/vendor/unity/Gemfile +0 -4
- data/vendor/unity/examples/helper/UnityHelper.h +0 -12
- data/vendor/unity/examples/rakefile_helper.rb +0 -256
- data/vendor/unity/examples/readme.txt +0 -18
@@ -2,7 +2,7 @@
|
|
2
2
|
# Unity Project - A Test Framework for C
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
-
# ==========================================
|
5
|
+
# ==========================================
|
6
6
|
|
7
7
|
UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/'
|
8
8
|
|
@@ -24,8 +24,13 @@ task :prepare_for_tests => TEMP_DIRS
|
|
24
24
|
|
25
25
|
include RakefileHelpers
|
26
26
|
|
27
|
-
# Load
|
28
|
-
|
27
|
+
# Load proper GCC as defult configuration
|
28
|
+
if 1.size == 8 # 8 bytes => 64-bits
|
29
|
+
DEFAULT_CONFIG_FILE = 'gcc_64.yml'
|
30
|
+
else # Assume 32-bit otherwise
|
31
|
+
DEFAULT_CONFIG_FILE = 'gcc_32.yml'
|
32
|
+
end
|
33
|
+
|
29
34
|
configure_toolchain(DEFAULT_CONFIG_FILE)
|
30
35
|
|
31
36
|
desc "Test unity with its own unit tests"
|
@@ -33,9 +38,11 @@ task :unit => [:prepare_for_tests] do
|
|
33
38
|
run_tests get_unit_test_files
|
34
39
|
end
|
35
40
|
|
36
|
-
|
37
|
-
|
38
|
-
|
41
|
+
desc "Test unity's helper scripts"
|
42
|
+
task :scripts => [:prepare_for_tests] do
|
43
|
+
Dir['test/test_*.rb'].each do |scriptfile|
|
44
|
+
require "./"+scriptfile
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
desc "Generate test summary"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Unity Project - A Test Framework for C
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
-
# ==========================================
|
5
|
+
# ==========================================
|
6
6
|
|
7
7
|
if RUBY_PLATFORM =~/(win|w)32$/
|
8
8
|
begin
|
@@ -21,14 +21,14 @@ end
|
|
21
21
|
|
22
22
|
class ColourCommandLine
|
23
23
|
def initialize
|
24
|
-
if RUBY_PLATFORM =~/(win|w)32$/
|
24
|
+
if RUBY_PLATFORM =~/(win|w)32$/
|
25
25
|
get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L')
|
26
26
|
@set_console_txt_attrb =
|
27
|
-
|
27
|
+
Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I')
|
28
28
|
@hout = get_std_handle.call(-11)
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def change_to(new_colour)
|
33
33
|
if RUBY_PLATFORM =~/(win|w)32$/
|
34
34
|
@set_console_txt_attrb.call(@hout,self.win32_colour(new_colour))
|
@@ -36,10 +36,10 @@ class ColourCommandLine
|
|
36
36
|
"\033[30;#{posix_colour(new_colour)};22m"
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def win32_colour(colour)
|
41
41
|
case colour
|
42
|
-
when :black then 0
|
42
|
+
when :black then 0
|
43
43
|
when :dark_blue then 1
|
44
44
|
when :dark_green then 2
|
45
45
|
when :dark_cyan then 3
|
@@ -59,22 +59,43 @@ class ColourCommandLine
|
|
59
59
|
0
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def posix_colour(colour)
|
64
|
+
# ANSI Escape Codes - Foreground colors
|
65
|
+
# | Code | Color |
|
66
|
+
# | 39 | Default foreground color |
|
67
|
+
# | 30 | Black |
|
68
|
+
# | 31 | Red |
|
69
|
+
# | 32 | Green |
|
70
|
+
# | 33 | Yellow |
|
71
|
+
# | 34 | Blue |
|
72
|
+
# | 35 | Magenta |
|
73
|
+
# | 36 | Cyan |
|
74
|
+
# | 37 | Light gray |
|
75
|
+
# | 90 | Dark gray |
|
76
|
+
# | 91 | Light red |
|
77
|
+
# | 92 | Light green |
|
78
|
+
# | 93 | Light yellow |
|
79
|
+
# | 94 | Light blue |
|
80
|
+
# | 95 | Light magenta |
|
81
|
+
# | 96 | Light cyan |
|
82
|
+
# | 97 | White |
|
83
|
+
|
64
84
|
case colour
|
65
|
-
when :black then 30
|
85
|
+
when :black then 30
|
66
86
|
when :red, :failure then 31
|
67
87
|
when :green, :success then 32
|
68
88
|
when :yellow then 33
|
69
89
|
when :blue, :narrative then 34
|
70
90
|
when :purple, :magenta then 35
|
71
91
|
when :cyan, :output then 36
|
72
|
-
when :white, :default_white
|
92
|
+
when :white, :default_white then 37
|
93
|
+
when :default then 39
|
73
94
|
else
|
74
|
-
|
95
|
+
39
|
75
96
|
end
|
76
97
|
end
|
77
|
-
|
98
|
+
|
78
99
|
def out_c(mode, colour, str)
|
79
100
|
case RUBY_PLATFORM
|
80
101
|
when /(win|w)32$/
|
@@ -85,7 +106,7 @@ class ColourCommandLine
|
|
85
106
|
else
|
86
107
|
$stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts
|
87
108
|
$stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
|
88
|
-
end
|
109
|
+
end
|
89
110
|
end
|
90
111
|
end # ColourCommandLine
|
91
112
|
|
@@ -2,8 +2,9 @@
|
|
2
2
|
# Unity Project - A Test Framework for C
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
-
# ==========================================
|
5
|
+
# ==========================================
|
6
6
|
|
7
|
+
$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }
|
7
8
|
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
|
8
9
|
|
9
10
|
class UnityTestRunnerGenerator
|
@@ -17,7 +18,7 @@ class UnityTestRunnerGenerator
|
|
17
18
|
else raise "If you specify arguments, it should be a filename or a hash of options"
|
18
19
|
end
|
19
20
|
end
|
20
|
-
|
21
|
+
|
21
22
|
def self.grab_config(config_file)
|
22
23
|
options = { :includes => [], :plugins => [], :framework => :unity }
|
23
24
|
unless (config_file.nil? or config_file.empty?)
|
@@ -33,46 +34,44 @@ class UnityTestRunnerGenerator
|
|
33
34
|
tests = []
|
34
35
|
testfile_includes = []
|
35
36
|
used_mocks = []
|
36
|
-
|
37
|
+
|
37
38
|
@options.merge!(options) unless options.nil?
|
38
39
|
module_name = File.basename(input_file)
|
39
|
-
|
40
|
+
|
40
41
|
#pull required data from source file
|
41
|
-
File.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
source = File.read(input_file)
|
43
|
+
source = source.force_encoding("ISO-8859-1").encode("utf-8", :replace => nil) if ($QUICK_RUBY_VERSION > 10900)
|
44
|
+
tests = find_tests(source)
|
45
|
+
testfile_includes = find_includes(source)
|
46
|
+
used_mocks = find_mocks(testfile_includes)
|
46
47
|
|
47
48
|
#build runner file
|
48
|
-
generate(input_file, output_file, tests, used_mocks)
|
49
|
-
|
49
|
+
generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
50
|
+
|
50
51
|
#determine which files were used to return them
|
51
52
|
all_files_used = [input_file, output_file]
|
52
53
|
all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
|
53
54
|
all_files_used += @options[:includes] unless @options[:includes].empty?
|
54
55
|
return all_files_used.uniq
|
55
56
|
end
|
56
|
-
|
57
|
-
def generate(input_file, output_file, tests, used_mocks)
|
57
|
+
|
58
|
+
def generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
58
59
|
File.open(output_file, 'w') do |output|
|
59
|
-
create_header(output, used_mocks)
|
60
|
+
create_header(output, used_mocks, testfile_includes)
|
60
61
|
create_externs(output, tests, used_mocks)
|
61
62
|
create_mock_management(output, used_mocks)
|
62
63
|
create_suite_setup_and_teardown(output)
|
63
64
|
create_reset(output, used_mocks)
|
64
|
-
create_main(output, input_file, tests)
|
65
|
+
create_main(output, input_file, tests, used_mocks)
|
65
66
|
end
|
66
67
|
end
|
67
|
-
|
68
|
-
def find_tests(
|
68
|
+
|
69
|
+
def find_tests(source)
|
69
70
|
tests_raw = []
|
70
71
|
tests_args = []
|
71
72
|
tests_and_line_numbers = []
|
72
|
-
|
73
|
-
|
74
|
-
source_raw = input_file.read
|
75
|
-
source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments
|
73
|
+
|
74
|
+
source_scrubbed = source.gsub(/\/\/.*$/, '') # remove line comments
|
76
75
|
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
77
76
|
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
|
78
77
|
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
|
@@ -94,7 +93,7 @@ class UnityTestRunnerGenerator
|
|
94
93
|
end
|
95
94
|
|
96
95
|
#determine line numbers and create tests to run
|
97
|
-
source_lines =
|
96
|
+
source_lines = source.split("\n")
|
98
97
|
source_index = 0;
|
99
98
|
tests_and_line_numbers.size.times do |i|
|
100
99
|
source_lines[source_index..-1].each_with_index do |line, index|
|
@@ -105,34 +104,33 @@ class UnityTestRunnerGenerator
|
|
105
104
|
end
|
106
105
|
end
|
107
106
|
end
|
108
|
-
|
107
|
+
|
109
108
|
return tests_and_line_numbers
|
110
109
|
end
|
111
110
|
|
112
|
-
def find_includes(
|
113
|
-
|
114
|
-
|
115
|
-
#read in file
|
116
|
-
source = input_file.read
|
117
|
-
|
111
|
+
def find_includes(source)
|
112
|
+
|
118
113
|
#remove comments (block and line, in three steps to ensure correct precedence)
|
119
114
|
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
120
|
-
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
115
|
+
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
121
116
|
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
122
|
-
|
117
|
+
|
123
118
|
#parse out includes
|
124
|
-
|
119
|
+
includes = source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten
|
120
|
+
brackets_includes = source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten
|
121
|
+
brackets_includes.each { |inc| includes << '<' + inc +'>' }
|
122
|
+
return includes
|
125
123
|
end
|
126
|
-
|
124
|
+
|
127
125
|
def find_mocks(includes)
|
128
126
|
mock_headers = []
|
129
127
|
includes.each do |include_file|
|
130
128
|
mock_headers << File.basename(include_file) if (include_file =~ /^mock/i)
|
131
129
|
end
|
132
|
-
return mock_headers
|
130
|
+
return mock_headers
|
133
131
|
end
|
134
|
-
|
135
|
-
def create_header(output, mocks)
|
132
|
+
|
133
|
+
def create_header(output, mocks, testfile_includes)
|
136
134
|
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
137
135
|
create_runtest(output, mocks)
|
138
136
|
output.puts("\n//=======Automagically Detected Files To Include=====")
|
@@ -144,17 +142,22 @@ class UnityTestRunnerGenerator
|
|
144
142
|
output.puts('#include <setjmp.h>')
|
145
143
|
output.puts('#include <stdio.h>')
|
146
144
|
output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
|
145
|
+
testfile_includes.delete("unity").delete("cmock")
|
146
|
+
testrunner_includes = testfile_includes - mocks
|
147
|
+
testrunner_includes.each do |inc|
|
148
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
149
|
+
end
|
147
150
|
mocks.each do |mock|
|
148
151
|
output.puts("#include \"#{mock.gsub('.h','')}.h\"")
|
149
152
|
end
|
150
153
|
if @options[:enforce_strict_ordering]
|
151
|
-
output.puts('')
|
152
|
-
output.puts('int GlobalExpectCount;')
|
153
|
-
output.puts('int GlobalVerifyOrder;')
|
154
|
-
output.puts('char* GlobalOrderError;')
|
154
|
+
output.puts('')
|
155
|
+
output.puts('int GlobalExpectCount;')
|
156
|
+
output.puts('int GlobalVerifyOrder;')
|
157
|
+
output.puts('char* GlobalOrderError;')
|
155
158
|
end
|
156
159
|
end
|
157
|
-
|
160
|
+
|
158
161
|
def create_externs(output, tests, mocks)
|
159
162
|
output.puts("\n//=======External Functions This Runner Calls=====")
|
160
163
|
output.puts("extern void setUp(void);")
|
@@ -164,7 +167,7 @@ class UnityTestRunnerGenerator
|
|
164
167
|
end
|
165
168
|
output.puts('')
|
166
169
|
end
|
167
|
-
|
170
|
+
|
168
171
|
def create_mock_management(output, mocks)
|
169
172
|
unless (mocks.empty?)
|
170
173
|
output.puts("\n//=======Mock Management=====")
|
@@ -172,8 +175,8 @@ class UnityTestRunnerGenerator
|
|
172
175
|
output.puts("{")
|
173
176
|
if @options[:enforce_strict_ordering]
|
174
177
|
output.puts(" GlobalExpectCount = 0;")
|
175
|
-
output.puts(" GlobalVerifyOrder = 0;")
|
176
|
-
output.puts(" GlobalOrderError = NULL;")
|
178
|
+
output.puts(" GlobalVerifyOrder = 0;")
|
179
|
+
output.puts(" GlobalOrderError = NULL;")
|
177
180
|
end
|
178
181
|
mocks.each do |mock|
|
179
182
|
mock_clean = mock.gsub(/(?:-|\s+)/, "_")
|
@@ -198,7 +201,7 @@ class UnityTestRunnerGenerator
|
|
198
201
|
output.puts("}\n")
|
199
202
|
end
|
200
203
|
end
|
201
|
-
|
204
|
+
|
202
205
|
def create_suite_setup_and_teardown(output)
|
203
206
|
unless (@options[:suite_setup].nil?)
|
204
207
|
output.puts("\n//=======Suite Setup=====")
|
@@ -215,37 +218,37 @@ class UnityTestRunnerGenerator
|
|
215
218
|
output.puts("}")
|
216
219
|
end
|
217
220
|
end
|
218
|
-
|
221
|
+
|
219
222
|
def create_runtest(output, used_mocks)
|
220
223
|
cexception = @options[:plugins].include? :cexception
|
221
224
|
va_args1 = @options[:use_param_tests] ? ', ...' : ''
|
222
225
|
va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
|
223
226
|
output.puts("\n//=======Test Runner Used To Run Each Test Below=====")
|
224
|
-
output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests]
|
227
|
+
output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests]
|
225
228
|
output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
|
226
229
|
output.puts("{ \\")
|
227
230
|
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
|
228
231
|
output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\")
|
229
232
|
output.puts(" Unity.NumberOfTests++; \\")
|
233
|
+
output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
|
230
234
|
output.puts(" if (TEST_PROTECT()) \\")
|
231
235
|
output.puts(" { \\")
|
232
236
|
output.puts(" CEXCEPTION_T e; \\") if cexception
|
233
237
|
output.puts(" Try { \\") if cexception
|
234
|
-
output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
|
235
238
|
output.puts(" setUp(); \\")
|
236
239
|
output.puts(" TestFunc(#{va_args2}); \\")
|
237
|
-
output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
|
238
240
|
output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception
|
239
241
|
output.puts(" } \\")
|
240
|
-
output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
|
241
242
|
output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\")
|
242
243
|
output.puts(" { \\")
|
243
244
|
output.puts(" tearDown(); \\")
|
245
|
+
output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
|
244
246
|
output.puts(" } \\")
|
247
|
+
output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
|
245
248
|
output.puts(" UnityConcludeTest(); \\")
|
246
249
|
output.puts("}\n")
|
247
250
|
end
|
248
|
-
|
251
|
+
|
249
252
|
def create_reset(output, used_mocks)
|
250
253
|
output.puts("\n//=======Test Reset Option=====")
|
251
254
|
output.puts("void resetTest()")
|
@@ -253,18 +256,18 @@ class UnityTestRunnerGenerator
|
|
253
256
|
output.puts(" CMock_Verify();") unless (used_mocks.empty?)
|
254
257
|
output.puts(" CMock_Destroy();") unless (used_mocks.empty?)
|
255
258
|
output.puts(" tearDown();")
|
256
|
-
output.puts(" CMock_Init();") unless (used_mocks.empty?)
|
259
|
+
output.puts(" CMock_Init();") unless (used_mocks.empty?)
|
257
260
|
output.puts(" setUp();")
|
258
261
|
output.puts("}")
|
259
262
|
end
|
260
|
-
|
261
|
-
def create_main(output, filename, tests)
|
263
|
+
|
264
|
+
def create_main(output, filename, tests, used_mocks)
|
262
265
|
output.puts("\n\n//=======MAIN=====")
|
263
266
|
output.puts("int main(void)")
|
264
267
|
output.puts("{")
|
265
268
|
output.puts(" suite_setup();") unless @options[:suite_setup].nil?
|
266
|
-
output.puts(" Unity.TestFile = \"#{filename}\";")
|
267
269
|
output.puts(" UnityBegin();")
|
270
|
+
output.puts(" Unity.TestFile = \"#{filename}\";")
|
268
271
|
if (@options[:use_param_tests])
|
269
272
|
tests.each do |test|
|
270
273
|
if ((test[:args].nil?) or (test[:args].empty?))
|
@@ -277,6 +280,7 @@ class UnityTestRunnerGenerator
|
|
277
280
|
tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
|
278
281
|
end
|
279
282
|
output.puts()
|
283
|
+
output.puts(" CMock_Guts_MemFreeFinal();") unless used_mocks.empty?
|
280
284
|
output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());")
|
281
285
|
output.puts("}")
|
282
286
|
end
|
@@ -286,18 +290,18 @@ end
|
|
286
290
|
if ($0 == __FILE__)
|
287
291
|
options = { :includes => [] }
|
288
292
|
yaml_file = nil
|
289
|
-
|
293
|
+
|
290
294
|
#parse out all the options first
|
291
|
-
ARGV.reject! do |arg|
|
295
|
+
ARGV.reject! do |arg|
|
292
296
|
case(arg)
|
293
|
-
when '-cexception'
|
297
|
+
when '-cexception'
|
294
298
|
options[:plugins] = [:cexception]; true
|
295
299
|
when /\.*\.yml/
|
296
300
|
options = UnityTestRunnerGenerator.grab_config(arg); true
|
297
301
|
else false
|
298
302
|
end
|
299
|
-
end
|
300
|
-
|
303
|
+
end
|
304
|
+
|
301
305
|
#make sure there is at least one parameter left (the input file)
|
302
306
|
if !ARGV[0]
|
303
307
|
puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)",
|
@@ -305,12 +309,12 @@ if ($0 == __FILE__)
|
|
305
309
|
" -cexception - include cexception support"].join("\n")
|
306
310
|
exit 1
|
307
311
|
end
|
308
|
-
|
312
|
+
|
309
313
|
#create the default test runner name if not specified
|
310
314
|
ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1])
|
311
|
-
|
315
|
+
|
312
316
|
#everything else is an include file
|
313
317
|
options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2)
|
314
|
-
|
318
|
+
|
315
319
|
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
316
320
|
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
#============================================================
|
2
|
+
# Author: John Theofanopoulos
|
3
|
+
# A simple parser. Takes the output files generated during the build process and
|
4
|
+
# extracts information relating to the tests.
|
5
|
+
#
|
6
|
+
# Notes:
|
7
|
+
# To capture an output file under VS builds use the following:
|
8
|
+
# devenv [build instructions] > Output.txt & type Output.txt
|
9
|
+
#
|
10
|
+
# To capture an output file under GCC/Linux builds use the following:
|
11
|
+
# make | tee Output.txt
|
12
|
+
#
|
13
|
+
# To use this parser use the following command
|
14
|
+
# ruby parseOutput.rb [options] [file]
|
15
|
+
# options: -xml : produce a JUnit compatible XML file
|
16
|
+
# file : file to scan for results
|
17
|
+
#============================================================
|
18
|
+
|
19
|
+
|
20
|
+
class ParseOutput
|
21
|
+
# The following flag is set to true when a test is found or false otherwise.
|
22
|
+
@testFlag
|
23
|
+
@xmlOut
|
24
|
+
@arrayList
|
25
|
+
@totalTests
|
26
|
+
@classIndex
|
27
|
+
|
28
|
+
# Set the flag to indicate if there will be an XML output file or not
|
29
|
+
def setXmlOutput()
|
30
|
+
@xmlOut = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# if write our output to XML
|
34
|
+
def writeXmlOuput()
|
35
|
+
output = File.open("report.xml", "w")
|
36
|
+
output << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
37
|
+
@arrayList.each do |item|
|
38
|
+
output << item << "\n"
|
39
|
+
end
|
40
|
+
output << "</testsuite>\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
# This function will try and determine when the suite is changed. This is
|
44
|
+
# is the name that gets added to the classname parameter.
|
45
|
+
def testSuiteVerify(testSuiteName)
|
46
|
+
if @testFlag == false
|
47
|
+
@testFlag = true;
|
48
|
+
# Split the path name
|
49
|
+
testName = testSuiteName.split("/")
|
50
|
+
# Remove the extension
|
51
|
+
baseName = testName[testName.size - 1].split(".")
|
52
|
+
@testSuite = "test." + baseName[0]
|
53
|
+
printf "New Test: %s\n", @testSuite
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# Test was flagged as having passed so format the output
|
59
|
+
def testPassed(array)
|
60
|
+
lastItem = array.length - 1
|
61
|
+
testName = array[lastItem - 1]
|
62
|
+
testSuiteVerify(array[@className])
|
63
|
+
printf "%-40s PASS\n", testName
|
64
|
+
if @xmlOut == true
|
65
|
+
@arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\"/>"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Test was flagged as being ingored so format the output
|
70
|
+
def testIgnored(array)
|
71
|
+
lastItem = array.length - 1
|
72
|
+
testName = array[lastItem - 2]
|
73
|
+
reason = array[lastItem].chomp
|
74
|
+
testSuiteVerify(array[@className])
|
75
|
+
printf "%-40s IGNORED\n", testName
|
76
|
+
if @xmlOut == true
|
77
|
+
@arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">"
|
78
|
+
@arrayList.push " <skipped type=\"TEST IGNORED\"> " + reason + " </skipped>"
|
79
|
+
@arrayList.push " </testcase>"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Test was flagged as having failed so format the line
|
84
|
+
def testFailed(array)
|
85
|
+
lastItem = array.length - 1
|
86
|
+
testName = array[lastItem - 2]
|
87
|
+
reason = array[lastItem].chomp + " at line: " + array[lastItem - 3]
|
88
|
+
testSuiteVerify(array[@className])
|
89
|
+
printf "%-40s FAILED\n", testName
|
90
|
+
if @xmlOut == true
|
91
|
+
@arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">"
|
92
|
+
@arrayList.push " <failure type=\"ASSERT FAILED\"> " + reason + " </failure>"
|
93
|
+
@arrayList.push " </testcase>"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
# Figure out what OS we are running on. For now we are assuming if it's not Windows it must
|
99
|
+
# be Unix based.
|
100
|
+
def detectOS()
|
101
|
+
myOS = RUBY_PLATFORM.split("-")
|
102
|
+
if myOS.size == 2
|
103
|
+
if myOS[1] == "mingw32"
|
104
|
+
@className = 1
|
105
|
+
else
|
106
|
+
@className = 0
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
# Main function used to parse the file that was captured.
|
113
|
+
def process(name)
|
114
|
+
@testFlag = false
|
115
|
+
@arrayList = Array.new
|
116
|
+
|
117
|
+
detectOS()
|
118
|
+
|
119
|
+
puts "Parsing file: " + name
|
120
|
+
|
121
|
+
|
122
|
+
testPass = 0
|
123
|
+
testFail = 0
|
124
|
+
testIgnore = 0
|
125
|
+
puts ""
|
126
|
+
puts "=================== RESULTS ====================="
|
127
|
+
puts ""
|
128
|
+
File.open(name).each do |line|
|
129
|
+
# Typical test lines look like this:
|
130
|
+
# <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0
|
131
|
+
# <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented
|
132
|
+
# <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS
|
133
|
+
#
|
134
|
+
# where path is different on Unix vs Windows devices (Windows leads with a drive letter)
|
135
|
+
lineArray = line.split(":")
|
136
|
+
lineSize = lineArray.size
|
137
|
+
# If we were able to split the line then we can look to see if any of our target words
|
138
|
+
# were found. Case is important.
|
139
|
+
if lineSize >= 4
|
140
|
+
# Determine if this test passed
|
141
|
+
if line.include? ":PASS"
|
142
|
+
testPassed(lineArray)
|
143
|
+
testPass += 1
|
144
|
+
elsif line.include? ":FAIL:"
|
145
|
+
testFailed(lineArray)
|
146
|
+
testFail += 1
|
147
|
+
elsif line.include? ":IGNORE:"
|
148
|
+
testIgnored(lineArray)
|
149
|
+
testIgnore += 1
|
150
|
+
# If none of the keywords are found there are no more tests for this suite so clear
|
151
|
+
# the test flag
|
152
|
+
else
|
153
|
+
@testFlag = false
|
154
|
+
end
|
155
|
+
else
|
156
|
+
@testFlag = false
|
157
|
+
end
|
158
|
+
end
|
159
|
+
puts ""
|
160
|
+
puts "=================== SUMMARY ====================="
|
161
|
+
puts ""
|
162
|
+
puts "Tests Passed : " + testPass.to_s
|
163
|
+
puts "Tests Failed : " + testFail.to_s
|
164
|
+
puts "Tests Ignored : " + testIgnore.to_s
|
165
|
+
@totalTests = testPass + testFail + testIgnore
|
166
|
+
if @xmlOut == true
|
167
|
+
heading = "<testsuite tests=\"" + @totalTests.to_s + "\" failures=\"" + testFail.to_s + "\"" + " skips=\"" + testIgnore.to_s + "\">"
|
168
|
+
@arrayList.insert(0, heading)
|
169
|
+
writeXmlOuput()
|
170
|
+
end
|
171
|
+
|
172
|
+
# return result
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
# If the command line has no values in, used a default value of Output.txt
|
178
|
+
parseMyFile = ParseOutput.new
|
179
|
+
|
180
|
+
if ARGV.size >= 1
|
181
|
+
ARGV.each do |a|
|
182
|
+
if a == "-xml"
|
183
|
+
parseMyFile.setXmlOutput();
|
184
|
+
else
|
185
|
+
parseMyFile.process(a)
|
186
|
+
break
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|