├── Makefile ├── blinky.ewd ├── blinky.ewp ├── blinky.icf ├── blinky.ld ├── blinky.sct ├── blinky.uvopt ├── blinky.uvproj ├── blinky_ccs.cmd ├── build └── .gitignore ├── ccs ├── .ccsimportspec ├── .ccsproject ├── .cproject ├── .project ├── .settings │ └── org.eclipse.cdt.codan.core.prefs ├── Debug │ ├── blinky.bin │ └── blinky.out ├── macros.ini_initial └── target_config.ccxml ├── ewarm └── Exe │ ├── blinky.bin │ └── blinky.out ├── gcc ├── blinky.axf └── blinky.bin ├── project.yml ├── rakefile.rb ├── readme.txt ├── rvmdk ├── blinky.axf └── blinky.bin ├── src ├── blinky.c ├── led.c └── led.h ├── startup_ccs.c ├── startup_ewarm.c ├── startup_gcc.c ├── startup_rvmdk.S ├── test └── test_led.c └── vendor └── ceedling ├── docs ├── CExceptionSummary.pdf ├── CMock Summary.pdf ├── CeedlingPacket.pdf └── Unity Summary.pdf ├── lib ├── ceedling.rb └── ceedling │ ├── build_invoker_utils.rb │ ├── cacheinator.rb │ ├── cacheinator_helper.rb │ ├── cmock_builder.rb │ ├── configurator.rb │ ├── configurator_builder.rb │ ├── configurator_plugins.rb │ ├── configurator_setup.rb │ ├── configurator_validator.rb │ ├── constants.rb │ ├── defaults.rb │ ├── dependinator.rb │ ├── erb_wrapper.rb │ ├── file_finder.rb │ ├── file_finder_helper.rb │ ├── file_path_utils.rb │ ├── file_system_utils.rb │ ├── file_system_wrapper.rb │ ├── file_wrapper.rb │ ├── flaginator.rb │ ├── generator.rb │ ├── generator_helper.rb │ ├── generator_test_results.rb │ ├── generator_test_results_sanity_checker.rb │ ├── generator_test_runner.rb │ ├── loginator.rb │ ├── makefile.rb │ ├── objects.yml │ ├── par_map.rb │ ├── plugin.rb │ ├── plugin_builder.rb │ ├── plugin_manager.rb │ ├── plugin_manager_helper.rb │ ├── plugin_reportinator.rb │ ├── plugin_reportinator_helper.rb │ ├── preprocessinator.rb │ ├── preprocessinator_extractor.rb │ ├── preprocessinator_file_handler.rb │ ├── preprocessinator_helper.rb │ ├── preprocessinator_includes_handler.rb │ ├── project_config_manager.rb │ ├── project_file_loader.rb │ ├── rake_utils.rb │ ├── rake_wrapper.rb │ ├── rakefile.rb │ ├── release_invoker.rb │ ├── release_invoker_helper.rb │ ├── reportinator.rb │ ├── rules_cmock.rake │ ├── rules_preprocess.rake │ ├── rules_release.rake │ ├── rules_release_deep_dependencies.rake │ ├── rules_tests.rake │ ├── rules_tests_deep_dependencies.rake │ ├── setupinator.rb │ ├── stream_wrapper.rb │ ├── streaminator.rb │ ├── streaminator_helper.rb │ ├── system_utils.rb │ ├── system_wrapper.rb │ ├── target_loader.rb │ ├── task_invoker.rb │ ├── tasks_base.rake │ ├── tasks_filesystem.rake │ ├── tasks_release.rake │ ├── tasks_release_deep_dependencies.rake │ ├── tasks_tests.rake │ ├── tasks_tests_deep_dependencies.rake │ ├── tasks_vendor.rake │ ├── test_includes_extractor.rb │ ├── test_invoker.rb │ ├── test_invoker_helper.rb │ ├── tool_executor.rb │ ├── tool_executor_helper.rb │ ├── verbosinator.rb │ ├── version.rb │ ├── version.rb.erb │ └── yaml_wrapper.rb ├── plugins ├── bullseye │ ├── assets │ │ └── template.erb │ ├── bullseye.rake │ ├── config │ │ └── defaults.yml │ ├── lib │ │ └── bullseye.rb │ └── readme.txt ├── gcov │ ├── defaults.yml │ ├── gcov.rake │ ├── gcov.rb │ ├── readme.txt │ └── template.erb ├── module_generator │ ├── config │ │ └── module_generator.yml │ ├── lib │ │ └── module_generator.rb │ └── module_generator.rake ├── stdout_gtestlike_tests_report │ ├── assets │ │ ├── template.erb │ │ └── template.erb copy │ ├── config │ │ └── stdout_gtestlike_tests_report.yml │ └── lib │ │ └── stdout_gtestlike_tests_report.rb ├── stdout_ide_tests_report │ ├── config │ │ └── stdout_ide_tests_report.yml │ └── lib │ │ └── stdout_ide_tests_report.rb ├── stdout_pretty_tests_report │ ├── assets │ │ └── template.erb │ ├── config │ │ └── stdout_pretty_tests_report.yml │ └── lib │ │ └── stdout_pretty_tests_report.rb ├── teamcity_tests_report │ ├── config │ │ └── teamcity_tests_report.yml │ └── lib │ │ └── teamcity_tests_report.rb ├── warnings_report │ └── warnings_report.rb └── xml_tests_report │ └── xml_tests_report.rb └── vendor ├── c_exception ├── lib │ ├── CException.c │ └── CException.h └── release │ ├── build.info │ └── version.info ├── cmock ├── config │ ├── production_environment.rb │ └── test_environment.rb ├── lib │ ├── cmock.rb │ ├── cmock_config.rb │ ├── cmock_file_writer.rb │ ├── cmock_generator.rb │ ├── cmock_generator_plugin_array.rb │ ├── cmock_generator_plugin_callback.rb │ ├── cmock_generator_plugin_cexception.rb │ ├── cmock_generator_plugin_expect.rb │ ├── cmock_generator_plugin_expect_any_args.rb │ ├── cmock_generator_plugin_ignore.rb │ ├── cmock_generator_plugin_ignore_arg.rb │ ├── cmock_generator_plugin_return_thru_ptr.rb │ ├── cmock_generator_utils.rb │ ├── cmock_header_parser.rb │ ├── cmock_plugin_manager.rb │ └── cmock_unityhelper_parser.rb ├── release │ ├── build.info │ └── version.info └── src │ ├── cmock.c │ ├── cmock.h │ └── cmock_internals.h ├── constructor ├── deep_merge └── lib │ └── deep_merge.rb ├── diy └── lib │ ├── diy.rb │ └── diy │ └── factory.rb └── unity ├── auto ├── colour_prompt.rb ├── colour_reporter.rb ├── generate_config.yml ├── generate_module.rb ├── generate_test_runner.rb ├── parseOutput.rb ├── stylize_as_junit.rb ├── test_file_filter.rb ├── type_sanitizer.rb ├── unity_test_summary.py └── unity_test_summary.rb ├── release ├── build.info └── version.info └── src ├── unity.c ├── unity.h └── unity_internals.h /Makefile: -------------------------------------------------------------------------------- 1 | #****************************************************************************** 2 | # 3 | # Makefile - Rules for building the blinky example. 4 | # 5 | # Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 6 | # Software License Agreement 7 | # 8 | # Texas Instruments (TI) is supplying this software for use solely and 9 | # exclusively on TI's microcontroller products. The software is owned by 10 | # TI and/or its suppliers, and is protected under applicable copyright 11 | # laws. You may not combine this software with "viral" open-source 12 | # software in order to form a larger program. 13 | # 14 | # THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | # NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | # NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | # A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | # CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | # DAMAGES, FOR ANY REASON WHATSOEVER. 20 | # 21 | # This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 22 | # 23 | #****************************************************************************** 24 | 25 | # 26 | # Defines the part type that this project uses. 27 | # 28 | PART=TM4C123GH6PGE 29 | 30 | # 31 | # The base directory for TivaWare. 32 | # 33 | ROOT=../../../.. 34 | 35 | # 36 | # Include the common make definitions. 37 | # 38 | include ${ROOT}/makedefs 39 | 40 | # 41 | # Where to find header files that do not live in the source directory. 42 | # 43 | IPATH=../../../.. 44 | 45 | # 46 | # The default rule, which causes the blinky example to be built. 47 | # 48 | all: ${COMPILER} 49 | all: ${COMPILER}/blinky.axf 50 | 51 | # 52 | # The rule to clean out all the build products. 53 | # 54 | clean: 55 | @rm -rf ${COMPILER} ${wildcard *~} 56 | 57 | # 58 | # The rule to create the target directory. 59 | # 60 | ${COMPILER}: 61 | @mkdir -p ${COMPILER} 62 | 63 | # 64 | # Rules for building the blinky example. 65 | # 66 | ${COMPILER}/blinky.axf: ${COMPILER}/blinky.o 67 | ${COMPILER}/blinky.axf: ${COMPILER}/startup_${COMPILER}.o 68 | ${COMPILER}/blinky.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a 69 | ${COMPILER}/blinky.axf: blinky.ld 70 | SCATTERgcc_blinky=blinky.ld 71 | ENTRY_blinky=ResetISR 72 | CFLAGSgcc=-DTARGET_IS_TM4C123_RB1 73 | 74 | # 75 | # Include the automatically generated dependency files. 76 | # 77 | ifneq (${MAKECMDGOALS},clean) 78 | -include ${wildcard ${COMPILER}/*.d} __dummy__ 79 | endif 80 | -------------------------------------------------------------------------------- /blinky.icf: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // blinky.icf - Linker configuration file for blinky. 4 | // 5 | // Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 22 | // 23 | //***************************************************************************** 24 | 25 | // 26 | // Define a memory region that covers the entire 4 GB addressible space of the 27 | // processor. 28 | // 29 | define memory mem with size = 4G; 30 | 31 | // 32 | // Define a region for the on-chip flash. 33 | // 34 | define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; 35 | 36 | // 37 | // Define a region for the on-chip SRAM. 38 | // 39 | define region SRAM = mem:[from 0x20000000 to 0x20007fff]; 40 | 41 | // 42 | // Define a block for the heap. The size should be set to something other 43 | // than zero if things in the C library that require the heap are used. 44 | // 45 | define block HEAP with alignment = 8, size = 0x00000000 { }; 46 | 47 | // 48 | // Indicate that the read/write values should be initialized by copying from 49 | // flash. 50 | // 51 | initialize by copy { readwrite }; 52 | 53 | // 54 | // Indicate that the noinit values should be left alone. This includes the 55 | // stack, which if initialized will destroy the return address from the 56 | // initialization code, causing the processor to branch to zero and fault. 57 | // 58 | do not initialize { section .noinit }; 59 | 60 | // 61 | // Place the interrupt vectors at the start of flash. 62 | // 63 | place at start of FLASH { readonly section .intvec }; 64 | 65 | // 66 | // Place the remainder of the read-only items into flash. 67 | // 68 | place in FLASH { readonly }; 69 | 70 | // 71 | // Place the RAM vector table at the start of SRAM. 72 | // 73 | place at start of SRAM { section VTABLE }; 74 | 75 | // 76 | // Place all read/write items into SRAM. 77 | // 78 | place in SRAM { readwrite, block HEAP }; 79 | -------------------------------------------------------------------------------- /blinky.ld: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * blinky.ld - Linker configuration file for blinky. 4 | * 5 | * Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 6 | * Software License Agreement 7 | * 8 | * Texas Instruments (TI) is supplying this software for use solely and 9 | * exclusively on TI's microcontroller products. The software is owned by 10 | * TI and/or its suppliers, and is protected under applicable copyright 11 | * laws. You may not combine this software with "viral" open-source 12 | * software in order to form a larger program. 13 | * 14 | * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | * DAMAGES, FOR ANY REASON WHATSOEVER. 20 | * 21 | * This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 22 | * 23 | *****************************************************************************/ 24 | 25 | MEMORY 26 | { 27 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 28 | SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 29 | } 30 | 31 | SECTIONS 32 | { 33 | .text : 34 | { 35 | _text = .; 36 | KEEP(*(.isr_vector)) 37 | *(.text*) 38 | *(.rodata*) 39 | _etext = .; 40 | } > FLASH 41 | 42 | .data : AT(ADDR(.text) + SIZEOF(.text)) 43 | { 44 | _data = .; 45 | _ldata = LOADADDR (.data); 46 | *(vtable) 47 | *(.data*) 48 | _edata = .; 49 | } > SRAM 50 | 51 | .bss : 52 | { 53 | _bss = .; 54 | *(.bss*) 55 | *(COMMON) 56 | _ebss = .; 57 | } > SRAM 58 | } 59 | -------------------------------------------------------------------------------- /blinky.sct: -------------------------------------------------------------------------------- 1 | ;****************************************************************************** 2 | ; 3 | ; blinky.sct - Linker configuration file for blinky. 4 | ; 5 | ; Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 6 | ; Software License Agreement 7 | ; 8 | ; Texas Instruments (TI) is supplying this software for use solely and 9 | ; exclusively on TI's microcontroller products. The software is owned by 10 | ; TI and/or its suppliers, and is protected under applicable copyright 11 | ; laws. You may not combine this software with "viral" open-source 12 | ; software in order to form a larger program. 13 | ; 14 | ; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | ; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | ; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | ; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | ; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | ; DAMAGES, FOR ANY REASON WHATSOEVER. 20 | ; 21 | ; This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 22 | ; 23 | ;****************************************************************************** 24 | 25 | LR_IROM 0x00000000 0x00040000 26 | { 27 | ; 28 | ; Specify the Execution Address of the code and the size. 29 | ; 30 | ER_IROM 0x00000000 0x00040000 31 | { 32 | *.o (RESET, +First) 33 | * (InRoot$$Sections, +RO) 34 | } 35 | 36 | ; 37 | ; Specify the Execution Address of the data area. 38 | ; 39 | RW_IRAM 0x20000000 0x00008000 40 | { 41 | ; 42 | ; Uncomment the following line in order to use IntRegister(). 43 | ; 44 | ;* (vtable, +First) 45 | * (+RW, +ZI) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /blinky_ccs.cmd: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * blinky_ccs.cmd - CCS linker configuration file for blinky. 4 | * 5 | * Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 6 | * Software License Agreement 7 | * 8 | * Texas Instruments (TI) is supplying this software for use solely and 9 | * exclusively on TI's microcontroller products. The software is owned by 10 | * TI and/or its suppliers, and is protected under applicable copyright 11 | * laws. You may not combine this software with "viral" open-source 12 | * software in order to form a larger program. 13 | * 14 | * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | * DAMAGES, FOR ANY REASON WHATSOEVER. 20 | * 21 | * This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 22 | * 23 | *****************************************************************************/ 24 | 25 | --retain=g_pfnVectors 26 | 27 | /* The following command line options are set as part of the CCS project. */ 28 | /* If you are building using the command line, or for some reason want to */ 29 | /* define them here, you can uncomment and modify these lines as needed. */ 30 | /* If you are using CCS for building, it is probably better to make any such */ 31 | /* modifications in your CCS project and leave this file alone. */ 32 | /* */ 33 | /* --heap_size=0 */ 34 | /* --stack_size=256 */ 35 | /* --library=rtsv7M3_T_le_eabi.lib */ 36 | 37 | /* The starting address of the application. Normally the interrupt vectors */ 38 | /* must be located at the beginning of the application. */ 39 | #define APP_BASE 0x00000000 40 | #define RAM_BASE 0x20000000 41 | 42 | /* System memory map */ 43 | 44 | MEMORY 45 | { 46 | /* Application stored in and executes from internal flash */ 47 | FLASH (RX) : origin = APP_BASE, length = 0x00040000 48 | /* Application uses internal RAM for data */ 49 | SRAM (RWX) : origin = 0x20000000, length = 0x00008000 50 | } 51 | 52 | /* Section allocation in memory */ 53 | 54 | SECTIONS 55 | { 56 | .intvecs: > APP_BASE 57 | .text : > FLASH 58 | .const : > FLASH 59 | .cinit : > FLASH 60 | .pinit : > FLASH 61 | .init_array : > FLASH 62 | 63 | .vtable : > RAM_BASE 64 | .data : > SRAM 65 | .bss : > SRAM 66 | .sysmem : > SRAM 67 | .stack : > SRAM 68 | } 69 | 70 | __STACK_TOP = __stack + 512; 71 | -------------------------------------------------------------------------------- /build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /ccs/.ccsimportspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ccs/.ccsproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ccs/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | blinky 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 15 | full,incremental, 16 | 17 | 18 | 19 | 20 | 21 | com.ti.ccstudio.core.ccsNature 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.core.ccnature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | 29 | blinky.c 30 | 1 31 | SW_ROOT/examples/boards/dk-tm4c123g/blinky/blinky.c 32 | 33 | 34 | blinky_ccs.cmd 35 | 1 36 | SW_ROOT/examples/boards/dk-tm4c123g/blinky/blinky_ccs.cmd 37 | 38 | 39 | startup_ccs.c 40 | 1 41 | SW_ROOT/examples/boards/dk-tm4c123g/blinky/startup_ccs.c 42 | 43 | 44 | 45 | 46 | SW_ROOT 47 | $%7BPARENT-5-PROJECT_LOC%7D 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /ccs/.settings/org.eclipse.cdt.codan.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | inEditor=false 3 | onBuild=false 4 | -------------------------------------------------------------------------------- /ccs/Debug/blinky.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/ccs/Debug/blinky.bin -------------------------------------------------------------------------------- /ccs/Debug/blinky.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/ccs/Debug/blinky.out -------------------------------------------------------------------------------- /ccs/macros.ini_initial: -------------------------------------------------------------------------------- 1 | SW_ROOT = ../../../../.. 2 | -------------------------------------------------------------------------------- /ccs/target_config.ccxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ewarm/Exe/blinky.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/ewarm/Exe/blinky.bin -------------------------------------------------------------------------------- /ewarm/Exe/blinky.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/ewarm/Exe/blinky.out -------------------------------------------------------------------------------- /gcc/blinky.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/gcc/blinky.axf -------------------------------------------------------------------------------- /gcc/blinky.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/gcc/blinky.bin -------------------------------------------------------------------------------- /project.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Notes: 4 | # Sample project C code is not presently written to produce a release artifact. 5 | # As such, release build options are disabled. 6 | # This sample, therefore, only demonstrates running a collection of unit tests. 7 | 8 | :project: 9 | :use_exceptions: FALSE 10 | :use_test_preprocessor: TRUE 11 | :use_auxiliary_dependencies: TRUE 12 | :build_root: build 13 | # :release_build: TRUE 14 | :test_file_prefix: test_ 15 | 16 | #:release_build: 17 | # :output: MyApp.out 18 | # :use_assembly: FALSE 19 | 20 | :environment: 21 | 22 | :extension: 23 | :executable: .out 24 | 25 | :paths: 26 | :test: 27 | - +:test/** 28 | - -:test/support 29 | :source: 30 | - src/** 31 | - C:\ti\TivaWare_C_Series-2.1.2.111 32 | - C:\ti\TivaWare_C_Series-2.1.2.111\driverlib 33 | :support: 34 | - test/support 35 | 36 | :defines: 37 | # in order to add common defines: 38 | # 1) remove the trailing [] from the :common: section 39 | # 2) add entries to the :common: section (e.g. :test: has TEST defined) 40 | :commmon: &common_defines [] 41 | :test: 42 | - *common_defines 43 | - TEST 44 | :test_preprocess: 45 | - *common_defines 46 | - TEST 47 | 48 | :cmock: 49 | :mock_prefix: mock_ 50 | :when_no_prototypes: :warn 51 | :enforce_strict_ordering: TRUE 52 | :plugins: 53 | - :ignore 54 | - :callback 55 | :treat_as: 56 | uint8: HEX8 57 | uint16: HEX16 58 | uint32: UINT32 59 | int8: INT8 60 | bool: UINT8 61 | :includes: 62 | - 63 | - 64 | :treat_externs: :include 65 | 66 | #:tools: 67 | # Ceedling defaults to using gcc for compiling, linking, etc. 68 | # As [:tools] is blank, gcc will be used (so long as it's in your system path) 69 | # See documentation to configure a given toolchain for use 70 | 71 | :plugins: 72 | :load_paths: 73 | - vendor/ceedling/plugins 74 | :enabled: 75 | - stdout_pretty_tests_report 76 | - module_generator 77 | ... 78 | -------------------------------------------------------------------------------- /rakefile.rb: -------------------------------------------------------------------------------- 1 | PROJECT_CEEDLING_ROOT = "vendor/ceedling" 2 | load "#{PROJECT_CEEDLING_ROOT}/lib/ceedling.rb" 3 | 4 | Ceedling.load_project 5 | 6 | task :default => %w[ test:all release ] 7 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | Blinky 2 | 3 | A very simple example that blinks the on-board LED. 4 | 5 | ------------------------------------------------------------------------------- 6 | 7 | Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 8 | Software License Agreement 9 | 10 | Texas Instruments (TI) is supplying this software for use solely and 11 | exclusively on TI's microcontroller products. The software is owned by 12 | TI and/or its suppliers, and is protected under applicable copyright 13 | laws. You may not combine this software with "viral" open-source 14 | software in order to form a larger program. 15 | 16 | THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 17 | NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 18 | NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 20 | CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 21 | DAMAGES, FOR ANY REASON WHATSOEVER. 22 | 23 | This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 24 | -------------------------------------------------------------------------------- /rvmdk/blinky.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/rvmdk/blinky.axf -------------------------------------------------------------------------------- /rvmdk/blinky.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/rvmdk/blinky.bin -------------------------------------------------------------------------------- /src/blinky.c: -------------------------------------------------------------------------------- 1 | //***************************************************************************** 2 | // 3 | // blinky.c - Simple example to blink the on-board LED. 4 | // 5 | // Copyright (c) 2011-2015 Texas Instruments Incorporated. All rights reserved. 6 | // Software License Agreement 7 | // 8 | // Texas Instruments (TI) is supplying this software for use solely and 9 | // exclusively on TI's microcontroller products. The software is owned by 10 | // TI and/or its suppliers, and is protected under applicable copyright 11 | // laws. You may not combine this software with "viral" open-source 12 | // software in order to form a larger program. 13 | // 14 | // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 | // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 | // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 | // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 | // DAMAGES, FOR ANY REASON WHATSOEVER. 20 | // 21 | // This is part of revision 2.1.2.111 of the DK-TM4C123G Firmware Package. 22 | // 23 | //***************************************************************************** 24 | 25 | #include 26 | #include 27 | #include "inc/hw_memmap.h" 28 | #include "driverlib/gpio.h" 29 | #include "driverlib/sysctl.h" 30 | 31 | //***************************************************************************** 32 | // 33 | //! \addtogroup example_list 34 | //!

Blinky (blinky)

35 | //! 36 | //! A very simple example that blinks the on-board LED. 37 | // 38 | //***************************************************************************** 39 | 40 | //***************************************************************************** 41 | // 42 | // Blink the on-board LED. 43 | // 44 | //***************************************************************************** 45 | int 46 | main(void) 47 | { 48 | volatile uint32_t ui32Loop; 49 | 50 | // 51 | // Enable the GPIO port that is used for the on-board LED. 52 | // 53 | SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); 54 | 55 | // 56 | // Check if the peripheral access is enabled. 57 | // 58 | while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOG)) 59 | { 60 | } 61 | 62 | // 63 | // Enable the GPIO pin for the LED (PG2). Set the direction as output, and 64 | // enable the GPIO pin for digital function. 65 | // 66 | GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2); 67 | 68 | // 69 | // Loop forever. 70 | // 71 | while(1) 72 | { 73 | // 74 | // Turn on the LED. 75 | // 76 | led_turn_on(); 77 | 78 | // 79 | // Delay for a bit. 80 | // 81 | for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) 82 | { 83 | } 84 | 85 | // 86 | // Turn off the LED. 87 | // 88 | led_turn_off(); 89 | 90 | // 91 | // Delay for a bit. 92 | // 93 | for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) 94 | { 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/led.c: -------------------------------------------------------------------------------- 1 | #include "led.h" 2 | 3 | #include 4 | #include 5 | #include "inc/hw_memmap.h" 6 | #include "driverlib/gpio.h" 7 | 8 | void led_turn_on(void) 9 | { 10 | GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); 11 | } 12 | 13 | void led_turn_off(void) 14 | { 15 | GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); 16 | } 17 | -------------------------------------------------------------------------------- /src/led.h: -------------------------------------------------------------------------------- 1 | void led_turn_on(void); 2 | void led_turn_off(void); 3 | -------------------------------------------------------------------------------- /test/test_led.c: -------------------------------------------------------------------------------- 1 | #include "unity.h" 2 | #include "led.h" 3 | 4 | #include "mock_gpio.h" 5 | #include "inc/hw_memmap.h" 6 | 7 | void setUp(void) 8 | { 9 | } 10 | 11 | void tearDown(void) 12 | { 13 | } 14 | 15 | void test_when_the_led_is_turned_on_then_port_f_pin_2_is_set(void) 16 | { 17 | // Expect PORTF pin 2 to be set. 18 | GPIOPinWrite_Expect(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); 19 | 20 | // Call the function under test. 21 | led_turn_on(); 22 | } 23 | -------------------------------------------------------------------------------- /vendor/ceedling/docs/CExceptionSummary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/vendor/ceedling/docs/CExceptionSummary.pdf -------------------------------------------------------------------------------- /vendor/ceedling/docs/CMock Summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/vendor/ceedling/docs/CMock Summary.pdf -------------------------------------------------------------------------------- /vendor/ceedling/docs/CeedlingPacket.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/vendor/ceedling/docs/CeedlingPacket.pdf -------------------------------------------------------------------------------- /vendor/ceedling/docs/Unity Summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/vendor/ceedling/docs/Unity Summary.pdf -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling.rb: -------------------------------------------------------------------------------- 1 | ## 2 | # This module defines the interface for interacting with and loading a project 3 | # with Ceedling. 4 | module Ceedling 5 | ## 6 | # Returns the location where the gem is installed. 7 | # === Return 8 | # _String_ - The location where the gem lives. 9 | def self.location 10 | File.join( File.dirname(__FILE__), '..') 11 | end 12 | 13 | ## 14 | # Return the path to the "built-in" plugins. 15 | # === Return 16 | # _String_ - The path where the default plugins live. 17 | def self.load_path 18 | File.join( self.location, 'plugins') 19 | end 20 | 21 | ## 22 | # Return the path to the Ceedling Rakefile 23 | # === Return 24 | # _String_ 25 | def self.rakefile 26 | File.join( self.location, 'lib', 'ceedling', 'rakefile.rb' ) 27 | end 28 | 29 | ## 30 | # This method selects the project file that Ceedling will use by setting the 31 | # CEEDLING_MAIN_PROJECT_FILE environment variable before loading the ceedling 32 | # rakefile. A path supplied as an argument to this method will override the 33 | # current value of the environment variable. If no path is supplied as an 34 | # argument then the existing value of the environment variable is used. If 35 | # the environment variable has not been set and no argument has been supplied 36 | # then a default path of './project.yml' will be used. 37 | # 38 | # === Arguments 39 | # +options+ _Hash_:: 40 | # A hash containing the options for ceedling. Currently the following 41 | # options are supported: 42 | # * +config+ - The path to the project YAML configuration file. 43 | # * +root+ - The root of the project directory. 44 | # * +prefix+ - A prefix to prepend to plugin names in order to determine the 45 | # corresponding gem name. 46 | # * +plugins+ - The list of ceedling plugins to load 47 | def self.load_project(options = {}) 48 | # Make sure our path to the yaml file is setup 49 | if options.has_key? :config 50 | ENV['CEEDLING_MAIN_PROJECT_FILE'] = options[:config] 51 | elsif ENV['CEEDLING_MAIN_PROJECT_FILE'].nil? 52 | ENV['CEEDLING_MAIN_PROJECT_FILE'] = './project.yml' 53 | end 54 | 55 | # Register the plugins 56 | if options.has_key? :plugins 57 | options[:plugins].each do |plugin| 58 | register_plugin( plugin, options[:prefix] ) 59 | end 60 | end 61 | 62 | # Define the root of the project if specified 63 | Object.const_set('PROJECT_ROOT', options[:root]) if options.has_key? :root 64 | 65 | # Load ceedling 66 | load "#{self.rakefile}" 67 | end 68 | 69 | ## 70 | # Register a plugin for ceedling to use when a project is loaded. This method 71 | # *must* be called prior to calling the _load_project_ method. 72 | # 73 | # This method is intended to be used for loading plugins distributed via the 74 | # RubyGems mechanism. As such, the following gem structure is assumed for 75 | # plugins. 76 | # 77 | # * The gem name must be prefixed with 'ceedling-' followed by the plugin 78 | # name (ex. 'ceedling-bullseye') 79 | # 80 | # * The contents of the plugin must be isntalled into a subdirectory of 81 | # the gem with the same name as the plugin (ex. 'bullseye/') 82 | # 83 | # === Arguments 84 | # +name+ _String_:: The name of the plugin to load. 85 | # +prefix+ _String_:: 86 | # (optional, default = nil) The prefix to use for the full gem name. 87 | def self.register_plugin(name, prefix=nil) 88 | # Figure out the full name of the gem and location 89 | prefix ||= 'ceedling-' 90 | gem_name = prefix + name 91 | gem_dir = Gem::Specification.find_by_name(gem_name).gem_dir() 92 | 93 | # Register the plugin with Ceedling 94 | require 'ceedling/defaults' 95 | DEFAULT_CEEDLING_CONFIG[:plugins][:enabled] << name 96 | DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths] << gem_dir 97 | end 98 | end 99 | 100 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/build_invoker_utils.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | class BuildInvokerUtils 5 | 6 | constructor :configurator, :streaminator 7 | 8 | def process_exception(exception, context, test_build=true) 9 | if (exception.message =~ /Don't know how to build task '(.+)'/i) 10 | error_header = "ERROR: Rake could not find file referenced in source" 11 | error_header += " or test" if (test_build) 12 | error_header += ": '#{$1}'. Possible stale dependency." 13 | 14 | @streaminator.stderr_puts( error_header ) 15 | 16 | if (@configurator.project_use_deep_dependencies) 17 | help_message = "Try fixing #include statements or adding missing file. Then run '#{REFRESH_TASK_ROOT}#{context.to_s}' task and try again." 18 | @streaminator.stderr_puts( help_message ) 19 | end 20 | 21 | raise '' 22 | else 23 | raise exception 24 | end 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/cacheinator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Cacheinator 3 | 4 | constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper 5 | 6 | def cache_test_config(hash) 7 | @yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash ) 8 | end 9 | 10 | def cache_release_config(hash) 11 | @yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash ) 12 | end 13 | 14 | 15 | def diff_cached_test_file( filepath ) 16 | cached_filepath = @file_path_utils.form_test_build_cache_path( filepath ) 17 | 18 | if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath ))) 19 | @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) 20 | return filepath 21 | elsif (!@file_wrapper.exist?( cached_filepath )) 22 | @file_wrapper.cp(filepath, cached_filepath, {:preserve => false}) 23 | return filepath 24 | end 25 | 26 | return cached_filepath 27 | end 28 | 29 | 30 | def diff_cached_test_config?(hash) 31 | cached_filepath = @file_path_utils.form_test_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) 32 | 33 | return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) 34 | end 35 | 36 | def diff_cached_release_config?(hash) 37 | cached_filepath = @file_path_utils.form_release_build_cache_path(INPUT_CONFIGURATION_CACHE_FILE) 38 | 39 | return @cacheinator_helper.diff_cached_config?( cached_filepath, hash ) 40 | end 41 | 42 | end 43 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/cacheinator_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | class CacheinatorHelper 3 | 4 | constructor :file_wrapper, :yaml_wrapper 5 | 6 | def diff_cached_config?(cached_filepath, hash) 7 | return true if ( not @file_wrapper.exist?(cached_filepath) ) 8 | return true if ( (@file_wrapper.exist?(cached_filepath)) and (!(@yaml_wrapper.load(cached_filepath) == hash)) ) 9 | return false 10 | end 11 | 12 | end 13 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/cmock_builder.rb: -------------------------------------------------------------------------------- 1 | require 'cmock' 2 | 3 | class CmockBuilder 4 | 5 | attr_accessor :cmock 6 | 7 | def setup 8 | @cmock = nil 9 | end 10 | 11 | def manufacture(cmock_config) 12 | @cmock = CMock.new(cmock_config) 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/configurator_plugins.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | class ConfiguratorPlugins 4 | 5 | constructor :stream_wrapper, :file_wrapper, :system_wrapper 6 | attr_reader :rake_plugins, :script_plugins 7 | 8 | def setup 9 | @rake_plugins = [] 10 | @script_plugins = [] 11 | end 12 | 13 | 14 | def add_load_paths(config) 15 | plugin_paths = {} 16 | 17 | config[:plugins][:load_paths].each do |root| 18 | @system_wrapper.add_load_path( root ) if ( not @file_wrapper.directory_listing( File.join( root, '*.rb' ) ).empty? ) 19 | 20 | config[:plugins][:enabled].each do |plugin| 21 | path = File.join(root, plugin, "lib") 22 | old_path = File.join( root, plugin ) 23 | 24 | if ( not @file_wrapper.directory_listing( File.join( path, '*.rb' ) ).empty? ) 25 | plugin_paths[(plugin + '_path').to_sym] = path 26 | @system_wrapper.add_load_path( path ) 27 | elsif ( not @file_wrapper.directory_listing( File.join( old_path, '*.rb' ) ).empty? ) 28 | plugin_paths[(plugin + '_path').to_sym] = old_path 29 | @system_wrapper.add_load_path( old_path ) 30 | end 31 | end 32 | end 33 | 34 | return plugin_paths 35 | end 36 | 37 | 38 | # gather up and return .rake filepaths that exist on-disk 39 | def find_rake_plugins(config) 40 | plugins_with_path = [] 41 | 42 | config[:plugins][:load_paths].each do |root| 43 | config[:plugins][:enabled].each do |plugin| 44 | rake_plugin_path = File.join(root, plugin, "#{plugin}.rake") 45 | if (@file_wrapper.exist?(rake_plugin_path)) 46 | plugins_with_path << rake_plugin_path 47 | @rake_plugins << plugin 48 | end 49 | end 50 | end 51 | 52 | return plugins_with_path 53 | end 54 | 55 | 56 | # gather up and return just names of .rb classes that exist on-disk 57 | def find_script_plugins(config) 58 | config[:plugins][:load_paths].each do |root| 59 | config[:plugins][:enabled].each do |plugin| 60 | script_plugin_path = File.join(root, plugin, "lib", "#{plugin}.rb") 61 | 62 | # Add the old path here to support legacy style. Eventaully remove. 63 | old_script_plugin_path = File.join(root, plugin, "#{plugin}.rb") 64 | 65 | if @file_wrapper.exist?(script_plugin_path) or @file_wrapper.exist?(old_script_plugin_path) 66 | @script_plugins << plugin 67 | end 68 | 69 | # Print depreciation warning. 70 | if @file_wrapper.exist?(old_script_plugin_path) 71 | $stderr.puts "WARNING: Depreciated plugin style used in #{plugin}. Use new directory structure!" 72 | end 73 | end 74 | end 75 | 76 | return @script_plugins 77 | end 78 | 79 | 80 | # gather up and return configuration .yml filepaths that exist on-disk 81 | def find_config_plugins(config) 82 | plugins_with_path = [] 83 | 84 | config[:plugins][:load_paths].each do |root| 85 | config[:plugins][:enabled].each do |plugin| 86 | config_plugin_path = File.join(root, plugin, "config", "#{plugin}.yml") 87 | 88 | # Add the old path here to support legacy style. Eventaully remove. 89 | old_config_plugin_path = File.join(root, plugin, "#{plugin}.yml") 90 | 91 | if @file_wrapper.exist?(config_plugin_path) 92 | plugins_with_path << config_plugin_path 93 | elsif @file_wrapper.exist?(old_config_plugin_path) 94 | # there's a warning printed for this in find_script_plugins 95 | plugins_with_path << old_config_plugin_path 96 | end 97 | end 98 | end 99 | 100 | return plugins_with_path 101 | end 102 | 103 | 104 | # gather up and return default .yml filepaths that exist on-disk 105 | def find_plugin_defaults(config) 106 | defaults_with_path = [] 107 | 108 | config[:plugins][:load_paths].each do |root| 109 | config[:plugins][:enabled].each do |plugin| 110 | default_path = File.join(root, plugin, 'config', 'defaults.yml') 111 | old_default_path = File.join(root, plugin, 'defaults.yml') 112 | 113 | if @file_wrapper.exist?(default_path) 114 | defaults_with_path << default_path 115 | elsif @file_wrapper.exist?(old_default_path) 116 | defaults_with_path << old_default_path 117 | end 118 | end 119 | end 120 | 121 | return defaults_with_path 122 | end 123 | 124 | end 125 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/constants.rb: -------------------------------------------------------------------------------- 1 | 2 | class Verbosity 3 | SILENT = 0 # as silent as possible (though there are some messages that must be spit out) 4 | ERRORS = 1 # only errors 5 | COMPLAIN = 2 # spit out errors and warnings/notices 6 | NORMAL = 3 # errors, warnings/notices, standard status messages 7 | OBNOXIOUS = 4 # all messages including extra verbose output (used for lite debugging / verification) 8 | DEBUG = 5 # special extra verbose output for hardcore debugging 9 | end 10 | 11 | 12 | class TestResultsSanityChecks 13 | NONE = 0 # no sanity checking of test results 14 | NORMAL = 1 # perform non-problematic checks 15 | THOROUGH = 2 # perform checks that require inside knowledge of system workings 16 | end 17 | 18 | 19 | class StdErrRedirect 20 | NONE = :none 21 | AUTO = :auto 22 | WIN = :win 23 | UNIX = :unix 24 | TCSH = :tcsh 25 | end 26 | 27 | 28 | class BackgroundExec 29 | NONE = :none 30 | AUTO = :auto 31 | WIN = :win 32 | UNIX = :unix 33 | end 34 | 35 | unless defined?(PROJECT_ROOT) 36 | PROJECT_ROOT = Dir.pwd() 37 | end 38 | 39 | EXTENSION_WIN_EXE = '.exe' 40 | EXTENSION_NONWIN_EXE = '.out' 41 | 42 | 43 | CEXCEPTION_ROOT_PATH = 'c_exception' 44 | CEXCEPTION_LIB_PATH = "#{CEXCEPTION_ROOT_PATH}/lib" 45 | CEXCEPTION_C_FILE = 'CException.c' 46 | CEXCEPTION_H_FILE = 'CException.h' 47 | 48 | UNITY_ROOT_PATH = 'unity' 49 | UNITY_LIB_PATH = "#{UNITY_ROOT_PATH}/src" 50 | UNITY_C_FILE = 'unity.c' 51 | UNITY_H_FILE = 'unity.h' 52 | UNITY_INTERNALS_H_FILE = 'unity_internals.h' 53 | 54 | CMOCK_ROOT_PATH = 'cmock' 55 | CMOCK_LIB_PATH = "#{CMOCK_ROOT_PATH}/src" 56 | CMOCK_C_FILE = 'cmock.c' 57 | CMOCK_H_FILE = 'cmock.h' 58 | 59 | 60 | DEFAULT_CEEDLING_MAIN_PROJECT_FILE = 'project.yml' unless defined?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE) # main project file 61 | DEFAULT_CEEDLING_USER_PROJECT_FILE = 'user.yml' unless defined?(DEFAULT_CEEDLING_USER_PROJECT_FILE) # supplemental user config file 62 | 63 | INPUT_CONFIGURATION_CACHE_FILE = 'input.yml' unless defined?(INPUT_CONFIGURATION_CACHE_FILE) # input configuration file dump 64 | 65 | 66 | TEST_ROOT_NAME = 'test' unless defined?(TEST_ROOT_NAME) 67 | TEST_TASK_ROOT = TEST_ROOT_NAME + ':' unless defined?(TEST_TASK_ROOT) 68 | TEST_SYM = TEST_ROOT_NAME.to_sym unless defined?(TEST_SYM) 69 | 70 | RELEASE_ROOT_NAME = 'release' unless defined?(RELEASE_ROOT_NAME) 71 | RELEASE_TASK_ROOT = RELEASE_ROOT_NAME + ':' unless defined?(RELEASE_TASK_ROOT) 72 | RELEASE_SYM = RELEASE_ROOT_NAME.to_sym unless defined?(RELEASE_SYM) 73 | 74 | REFRESH_ROOT_NAME = 'refresh' unless defined?(REFRESH_ROOT_NAME) 75 | REFRESH_TASK_ROOT = REFRESH_ROOT_NAME + ':' unless defined?(REFRESH_TASK_ROOT) 76 | REFRESH_SYM = REFRESH_ROOT_NAME.to_sym unless defined?(REFRESH_SYM) 77 | 78 | UTILS_ROOT_NAME = 'utils' unless defined?(UTILS_ROOT_NAME) 79 | UTILS_TASK_ROOT = UTILS_ROOT_NAME + ':' unless defined?(UTILS_TASK_ROOT) 80 | UTILS_SYM = UTILS_ROOT_NAME.to_sym unless defined?(UTILS_SYM) 81 | 82 | OPERATION_COMPILE_SYM = :compile unless defined?(OPERATION_COMPILE_SYM) 83 | OPERATION_ASSEMBLE_SYM = :assemble unless defined?(OPERATION_ASSEMBLE_SYM) 84 | OPERATION_LINK_SYM = :link unless defined?(OPERATION_LINK_SYM) 85 | 86 | 87 | RUBY_STRING_REPLACEMENT_PATTERN = /#\{.+\}/ 88 | RUBY_EVAL_REPLACEMENT_PATTERN = /^\{(.+)\}$/ 89 | TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN = /(\$\{(\d+)\})/ 90 | TEST_STDOUT_STATISTICS_PATTERN = /-+\s*(\d+)\s+Tests\s+(\d+)\s+Failures\s+(\d+)\s+Ignored\s+(OK|FAIL)\s*/i 91 | 92 | NULL_FILE_PATH = '/dev/null' 93 | 94 | TESTS_BASE_PATH = TEST_ROOT_NAME 95 | RELEASE_BASE_PATH = RELEASE_ROOT_NAME 96 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/dependinator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Dependinator 3 | 4 | constructor :configurator, :project_config_manager, :test_includes_extractor, :file_path_utils, :rake_wrapper, :file_wrapper 5 | 6 | def touch_force_rebuild_files 7 | @file_wrapper.touch( @configurator.project_test_force_rebuild_filepath ) 8 | @file_wrapper.touch( @configurator.project_release_force_rebuild_filepath ) if (@configurator.project_release_build) 9 | end 10 | 11 | 12 | 13 | def load_release_object_deep_dependencies(dependencies_list) 14 | dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies( dependencies_file ) } 15 | end 16 | 17 | 18 | def enhance_release_file_dependencies(files) 19 | files.each do |filepath| 20 | @rake_wrapper[filepath].enhance( [@configurator.project_release_force_rebuild_filepath] ) if (@project_config_manager.release_config_changed) 21 | end 22 | end 23 | 24 | 25 | 26 | def load_test_object_deep_dependencies(files_list) 27 | dependencies_list = @file_path_utils.form_test_dependencies_filelist(files_list) 28 | dependencies_list.each { |dependencies_file| @rake_wrapper.load_dependencies(dependencies_file) } 29 | end 30 | 31 | 32 | def enhance_runner_dependencies(runner_filepath) 33 | @rake_wrapper[runner_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 34 | end 35 | 36 | 37 | def enhance_shallow_include_lists_dependencies(include_lists) 38 | include_lists.each do |include_list_filepath| 39 | @rake_wrapper[include_list_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 40 | end 41 | end 42 | 43 | 44 | def enhance_preprocesed_file_dependencies(files) 45 | files.each do |filepath| 46 | @rake_wrapper[filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 47 | end 48 | end 49 | 50 | 51 | def enhance_mock_dependencies(mocks_list) 52 | # if input configuration or ceedling changes, make sure these guys get rebuilt 53 | mocks_list.each do |mock_filepath| 54 | @rake_wrapper[mock_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 55 | @rake_wrapper[mock_filepath].enhance( [@configurator.cmock_unity_helper] ) if (@configurator.cmock_unity_helper) 56 | end 57 | end 58 | 59 | 60 | def enhance_dependencies_dependencies(dependencies) 61 | dependencies.each do |dependencies_filepath| 62 | @rake_wrapper[dependencies_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 63 | end 64 | end 65 | 66 | 67 | def enhance_test_build_object_dependencies(objects) 68 | objects.each do |object_filepath| 69 | @rake_wrapper[object_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 70 | end 71 | end 72 | 73 | 74 | def enhance_results_dependencies(result_filepath) 75 | @rake_wrapper[result_filepath].enhance( [@configurator.project_test_force_rebuild_filepath] ) if (@project_config_manager.test_config_changed) 76 | end 77 | 78 | 79 | def setup_test_executable_dependencies(test, objects) 80 | @rake_wrapper.create_file_task( @file_path_utils.form_test_executable_filepath(test), objects) 81 | end 82 | 83 | end 84 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/erb_wrapper.rb: -------------------------------------------------------------------------------- 1 | require 'erb' 2 | 3 | class ErbWrapper 4 | def generate_file(template, data, output_file) 5 | File.open(output_file, "w") do |f| 6 | f << ERB.new(template, 0, "<>").result(binding) 7 | end 8 | end 9 | end -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/file_finder_helper.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | require 'ceedling/constants' # for Verbosity enumeration 3 | 4 | class FileFinderHelper 5 | 6 | constructor :streaminator 7 | 8 | 9 | def find_file_in_collection(file_name, file_list, complain, extra_message="") 10 | file_to_find = nil 11 | 12 | file_list.each do |item| 13 | base_file = File.basename(item) 14 | 15 | # case insensitive comparison 16 | if (base_file.casecmp(file_name) == 0) 17 | # case sensitive check 18 | if (base_file == file_name) 19 | file_to_find = item 20 | break 21 | else 22 | blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.") 23 | end 24 | end 25 | 26 | end 27 | 28 | case (complain) 29 | when :error then blow_up(file_name, extra_message) if (file_to_find.nil?) 30 | when :warn then gripe(file_name, extra_message) if (file_to_find.nil?) 31 | #when :ignore then 32 | end 33 | 34 | return file_to_find 35 | end 36 | 37 | private 38 | 39 | def blow_up(file_name, extra_message="") 40 | error = "ERROR: Found no file '#{file_name}' in search paths." 41 | error += ' ' if (extra_message.length > 0) 42 | @streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS) 43 | raise 44 | end 45 | 46 | def gripe(file_name, extra_message="") 47 | warning = "WARNING: Found no file '#{file_name}' in search paths." 48 | warning += ' ' if (extra_message.length > 0) 49 | @streaminator.stderr_puts(warning + extra_message, Verbosity::COMPLAIN) 50 | end 51 | 52 | end 53 | 54 | 55 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/file_system_utils.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | require 'set' 4 | require 'fileutils' 5 | require 'ceedling/file_path_utils' 6 | 7 | 8 | class FileSystemUtils 9 | 10 | constructor :file_wrapper 11 | 12 | # build up path list from input of one or more strings or arrays of (+/-) paths & globs 13 | def collect_paths(*paths) 14 | raw = [] # all paths and globs 15 | plus = Set.new # all paths to expand and add 16 | minus = Set.new # all paths to remove from plus set 17 | 18 | # assemble all globs and simple paths, reforming our glob notation to ruby globs 19 | paths.each do |paths_container| 20 | case (paths_container) 21 | when String then raw << (FilePathUtils::reform_glob(paths_container)) 22 | when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))} 23 | else raise "Don't know how to handle #{paths_container.class}" 24 | end 25 | end 26 | 27 | # iterate through each path and glob 28 | raw.each do |path| 29 | 30 | dirs = [] # container for only (expanded) paths 31 | 32 | # if a glob, expand it and slurp up all non-file paths 33 | if path.include?('*') 34 | # grab base directory only if globs are snug up to final path separator 35 | if (path =~ /\/\*+$/) 36 | dirs << FilePathUtils.extract_path(path) 37 | end 38 | 39 | # grab expanded sub-directory globs 40 | expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) ) 41 | expanded.each do |entry| 42 | dirs << entry if @file_wrapper.directory?(entry) 43 | end 44 | 45 | # else just grab simple path 46 | # note: we could just run this through glob expansion but such an 47 | # approach doesn't handle a path not yet on disk) 48 | else 49 | dirs << FilePathUtils.extract_path_no_aggregation_operators(path) 50 | end 51 | 52 | # add dirs to the appropriate set based on path aggregation modifier if present 53 | FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs) 54 | end 55 | 56 | return (plus - minus).to_a.uniq 57 | end 58 | 59 | 60 | # given a file list, add to it or remove from it 61 | def revise_file_list(list, revisions) 62 | revisions.each do |revision| 63 | # include or exclude file or glob to file list 64 | file = FilePathUtils.extract_path_no_aggregation_operators( revision ) 65 | FilePathUtils.add_path?(revision) ? list.include(file) : list.exclude(file) 66 | end 67 | end 68 | 69 | end 70 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/file_system_wrapper.rb: -------------------------------------------------------------------------------- 1 | 2 | class FileSystemWrapper 3 | 4 | def cd(path) 5 | FileUtils.cd path do 6 | yield 7 | end 8 | end 9 | 10 | end -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/file_wrapper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' # for FileList 3 | require 'fileutils' 4 | require 'ceedling/constants' 5 | 6 | 7 | class FileWrapper 8 | 9 | def get_expanded_path(path) 10 | return File.expand_path(path) 11 | end 12 | 13 | def basename(path, extension=nil) 14 | return File.basename(path, extension) if extension 15 | return File.basename(path) 16 | end 17 | 18 | def exist?(filepath) 19 | return true if (filepath == NULL_FILE_PATH) 20 | return File.exist?(filepath) 21 | end 22 | 23 | def directory?(path) 24 | return File.directory?(path) 25 | end 26 | 27 | def dirname(path) 28 | return File.dirname(path) 29 | end 30 | 31 | def directory_listing(glob) 32 | return Dir.glob(glob) 33 | end 34 | 35 | def rm_f(filepath, options={}) 36 | FileUtils.rm_f(filepath, options) 37 | end 38 | 39 | def rm_r(filepath, options={}) 40 | FileUtils.rm_r(filepath, options={}) 41 | end 42 | 43 | def cp(source, destination, options={}) 44 | FileUtils.cp(source, destination, options) 45 | end 46 | 47 | def compare(from, to) 48 | return FileUtils.compare_file(from, to) 49 | end 50 | 51 | def open(filepath, flags) 52 | File.open(filepath, flags) do |file| 53 | yield(file) 54 | end 55 | end 56 | 57 | def read(filepath) 58 | return File.read(filepath) 59 | end 60 | 61 | def touch(filepath, options={}) 62 | FileUtils.touch(filepath, options) 63 | end 64 | 65 | def write(filepath, contents, flags='w') 66 | File.open(filepath, flags) do |file| 67 | file.write(contents) 68 | end 69 | end 70 | 71 | def readlines(filepath) 72 | return File.readlines(filepath) 73 | end 74 | 75 | def instantiate_file_list(files=[]) 76 | return FileList.new(files) 77 | end 78 | 79 | end 80 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/flaginator.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' # for ext() 3 | require 'fileutils' 4 | require 'ceedling/constants' 5 | 6 | 7 | # :flags: 8 | # :release: 9 | # :compile: 10 | # :*: # add '-foo' to compilation of all files not main.c 11 | # - -foo 12 | # :main: # add '-Wall' to compilation of main.c 13 | # - -Wall 14 | # :test: 15 | # :link: 16 | # :test_main: # add '--bar --baz' to linking of test_main.exe 17 | # - --bar 18 | # - --baz 19 | 20 | 21 | class Flaginator 22 | 23 | constructor :configurator 24 | 25 | def flag_down( operation, context, file ) 26 | # create configurator accessor method 27 | accessor = ('flags_' + context.to_s).to_sym 28 | 29 | # create simple filename key from whatever filename provided 30 | file_key = File.basename( file ).ext('').to_sym 31 | 32 | # if no entry in configuration for flags for this context, bail out 33 | return [] if not @configurator.respond_to?( accessor ) 34 | 35 | # get flags sub hash associated with this context 36 | flags = @configurator.send( accessor ) 37 | 38 | # if operation not represented in flags hash, bail out 39 | return [] if not flags.include?( operation ) 40 | 41 | # redefine flags to sub hash associated with the operation 42 | flags = flags[operation] 43 | 44 | # if our file is in the flags hash, extract the array of flags 45 | if (flags.include?( file_key )) then return flags[file_key] 46 | # if our file isn't in the flags hash, but there is default for all other files, extract array of flags 47 | elsif (flags.include?( :* )) then return flags[:*] 48 | end 49 | 50 | # fall through: flags were specified but none applying to present file 51 | return [] 52 | end 53 | 54 | end 55 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/generator_helper.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | class GeneratorHelper 5 | 6 | constructor :streaminator 7 | 8 | 9 | def test_results_error_handler(executable, shell_result) 10 | notice = '' 11 | error = false 12 | 13 | if (shell_result[:output].nil? or shell_result[:output].strip.empty?) 14 | error = true 15 | # mirror style of generic tool_executor failure output 16 | notice = "\n" + 17 | "ERROR: Test executable \"#{File.basename(executable)}\" failed.\n" + 18 | "> Produced no output to $stdout.\n" 19 | elsif ((shell_result[:output] =~ TEST_STDOUT_STATISTICS_PATTERN).nil?) 20 | error = true 21 | # mirror style of generic tool_executor failure output 22 | notice = "\n" + 23 | "ERROR: Test executable \"#{File.basename(executable)}\" failed.\n" + 24 | "> Produced no final test result counts in $stdout:\n" + 25 | "#{shell_result[:output].strip}\n" 26 | end 27 | 28 | if (error) 29 | # since we told the tool executor to ignore the exit code, handle it explicitly here 30 | notice += "> And exited with status: [#{shell_result[:exit_code]}] (count of failed tests).\n" if (shell_result[:exit_code] != nil) 31 | notice += "> And then likely crashed.\n" if (shell_result[:exit_code] == nil) 32 | 33 | notice += "> This is often a symptom of a bad memory access in source or test code.\n\n" 34 | 35 | @streaminator.stderr_puts(notice, Verbosity::COMPLAIN) 36 | raise 37 | end 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/generator_test_results.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' # for .ext() 3 | require 'ceedling/constants' 4 | 5 | 6 | class GeneratorTestResults 7 | 8 | constructor :configurator, :generator_test_results_sanity_checker, :yaml_wrapper 9 | 10 | def process_and_write_results(unity_shell_result, results_file, test_file) 11 | output_file = results_file 12 | 13 | results = get_results_structure 14 | 15 | results[:source][:path] = File.dirname(test_file) 16 | results[:source][:file] = File.basename(test_file) 17 | 18 | # process test statistics 19 | if (unity_shell_result[:output] =~ TEST_STDOUT_STATISTICS_PATTERN) 20 | results[:counts][:total] = $1.to_i 21 | results[:counts][:failed] = $2.to_i 22 | results[:counts][:ignored] = $3.to_i 23 | results[:counts][:passed] = (results[:counts][:total] - results[:counts][:failed] - results[:counts][:ignored]) 24 | end 25 | 26 | # remove test statistics lines 27 | output_string = unity_shell_result[:output].sub(TEST_STDOUT_STATISTICS_PATTERN, '') 28 | 29 | output_string.lines do |line| 30 | # process unity output 31 | case line 32 | when /(:IGNORE)/ 33 | elements = extract_line_elements(line, results[:source][:file]) 34 | results[:ignores] << elements[0] 35 | results[:stdout] << elements[1] if (!elements[1].nil?) 36 | when /(:PASS$)/ 37 | elements = extract_line_elements(line, results[:source][:file]) 38 | results[:successes] << elements[0] 39 | results[:stdout] << elements[1] if (!elements[1].nil?) 40 | when /(:FAIL)/ 41 | elements = extract_line_elements(line, results[:source][:file]) 42 | results[:failures] << elements[0] 43 | results[:stdout] << elements[1] if (!elements[1].nil?) 44 | else # collect up all other 45 | results[:stdout] << line.chomp 46 | end 47 | end 48 | 49 | @generator_test_results_sanity_checker.verify(results, unity_shell_result[:exit_code]) 50 | 51 | output_file = results_file.ext(@configurator.extension_testfail) if (results[:counts][:failed] > 0) 52 | 53 | @yaml_wrapper.dump(output_file, results) 54 | 55 | return { :result_file => output_file, :result => results } 56 | end 57 | 58 | private 59 | 60 | def get_results_structure 61 | return { 62 | :source => {:path => '', :file => ''}, 63 | :successes => [], 64 | :failures => [], 65 | :ignores => [], 66 | :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0}, 67 | :stdout => [], 68 | } 69 | end 70 | 71 | def extract_line_elements(line, filename) 72 | # handle anything preceding filename in line as extra output to be collected 73 | stdout = nil 74 | stdout_regex = /(.+)#{Regexp.escape(filename)}.+/i 75 | 76 | if (line =~ stdout_regex) 77 | stdout = $1.clone 78 | line.sub!(/#{Regexp.escape(stdout)}/, '') 79 | end 80 | 81 | # collect up test results minus and extra output 82 | elements = (line.strip.split(':'))[1..-1] 83 | return {:test => elements[1], :line => elements[0].to_i, :message => (elements[3..-1].join(':')).strip}, stdout 84 | end 85 | 86 | end 87 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/generator_test_results_sanity_checker.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' # for ext() method 3 | require 'ceedling/constants' 4 | 5 | 6 | class GeneratorTestResultsSanityChecker 7 | 8 | constructor :configurator, :streaminator 9 | 10 | def verify(results, unity_exit_code) 11 | 12 | # do no sanity checking if it's disabled 13 | return if (@configurator.sanity_checks == TestResultsSanityChecks::NONE) 14 | 15 | ceedling_ignores_count = results[:ignores].size 16 | ceedling_failures_count = results[:failures].size 17 | ceedling_tests_summation = (ceedling_ignores_count + ceedling_failures_count + results[:successes].size) 18 | 19 | # Exit code handling is not a sanity check that can always be performed because 20 | # command line simulators may or may not pass through Unity's exit code 21 | if (@configurator.sanity_checks >= TestResultsSanityChecks::THOROUGH) 22 | # many platforms limit exit codes to a maximum of 255 23 | if ((ceedling_failures_count != unity_exit_code) and (unity_exit_code < 255)) 24 | sanity_check_warning(results[:source][:file], "Unity's exit code (#{unity_exit_code}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") 25 | end 26 | 27 | if ((ceedling_failures_count < 255) and (unity_exit_code == 255)) 28 | sanity_check_warning(results[:source][:file], "Ceedling's summation of failed test cases (#{ceedling_failures_count}) is less than Unity's exit code (255 or more).") 29 | end 30 | end 31 | 32 | if (ceedling_ignores_count != results[:counts][:ignored]) 33 | sanity_check_warning(results[:source][:file], "Unity's final ignore count (#{results[:counts][:ignored]}) does not match Ceedling's summation of ignored test cases (#{ceedling_ignores_count}).") 34 | end 35 | 36 | if (ceedling_failures_count != results[:counts][:failed]) 37 | sanity_check_warning(results[:source][:file], "Unity's final fail count (#{results[:counts][:failed]}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).") 38 | end 39 | 40 | if (ceedling_tests_summation != results[:counts][:total]) 41 | sanity_check_warning(results[:source][:file], "Unity's final test count (#{results[:counts][:total]}) does not match Ceedling's summation of all test cases (#{ceedling_tests_summation}).") 42 | end 43 | 44 | end 45 | 46 | private 47 | 48 | def sanity_check_warning(file, message) 49 | unless defined?(CEEDLING_IGNORE_SANITY_CHECK) 50 | notice = "\n" + 51 | "ERROR: Internal sanity check for test fixture '#{file.ext(@configurator.extension_executable)}' finds that #{message}\n" + 52 | " Possible causes:\n" + 53 | " 1. Your test + source dereferenced a null pointer.\n" + 54 | " 2. Your test + source indexed past the end of a buffer.\n" + 55 | " 3. Your test + source committed a memory access violation.\n" + 56 | " 4. Your test fixture produced an exit code of 0 despite execution ending prematurely.\n" + 57 | " Sanity check failures of test results are usually a symptom of interrupted test execution.\n\n" 58 | 59 | @streaminator.stderr_puts( notice ) 60 | raise 61 | end 62 | end 63 | 64 | end 65 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/generator_test_runner.rb: -------------------------------------------------------------------------------- 1 | 2 | class GeneratorTestRunner 3 | 4 | constructor :configurator, :file_path_utils, :file_wrapper 5 | 6 | def find_test_cases(test_file) 7 | tests = [] 8 | tests_and_line_numbers = [] 9 | lines = [] 10 | 11 | # if we don't have preprocessor assistance, do some basic preprocessing of our own 12 | if (not @configurator.project_use_test_preprocessor) 13 | source = @file_wrapper.read(test_file) 14 | 15 | # remove line comments 16 | source = source.gsub(/\/\/.*$/, '') 17 | # remove block comments 18 | source = source.gsub(/\/\*.*?\*\//m, '') 19 | 20 | # treat preprocessor directives as a logical line 21 | lines = source.split(/(^\s*\#.*$) | (;|\{|\}) /x) # match ;, {, and } as end of lines 22 | # otherwise, read the preprocessed file raw 23 | else 24 | lines = @file_wrapper.read( @file_path_utils.form_preprocessed_file_filepath(test_file) ).split(/;|\{|\}/) 25 | end 26 | 27 | # step 1. find test functions in (possibly preprocessed) file 28 | # (note that lines are not broken up at end of lines) 29 | lines.each do |line| 30 | if (line =~ /^\s*void\s+((T|t)est.*)\s*\(\s*(void)?\s*\)/m) 31 | tests << ($1.strip) 32 | end 33 | end 34 | 35 | # step 2. associate test functions with line numbers in (non-preprocessed) original file 36 | # (note that this time we must scan file contents broken up by end of lines) 37 | raw_lines = @file_wrapper.read(test_file).split("\n") 38 | raw_index = 0 39 | 40 | tests.each do |test| 41 | raw_lines[raw_index..-1].each_with_index do |line, index| 42 | # test function might be declared across lines; look for it by its name followed 43 | # by a few tell-tale signs 44 | if (line =~ /#{test}\s*($|\(|\()/) 45 | raw_index += (index + 1) 46 | tests_and_line_numbers << {:test => test, :line_number => raw_index} 47 | break 48 | end 49 | end 50 | end 51 | 52 | return tests_and_line_numbers 53 | end 54 | 55 | def generate(module_name, runner_filepath, test_cases, mock_list, test_file_includes=[]) 56 | require 'generate_test_runner.rb' 57 | @test_runner_generator ||= UnityTestRunnerGenerator.new( @configurator.get_runner_config ) 58 | @test_runner_generator.generate( module_name, 59 | runner_filepath, 60 | test_cases, 61 | mock_list, 62 | test_file_includes) 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/loginator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Loginator 3 | 4 | constructor :configurator, :project_file_loader, :project_config_manager, :file_wrapper, :system_wrapper 5 | 6 | 7 | def setup_log_filepath 8 | config_files = [] 9 | config_files << @project_file_loader.main_file 10 | config_files << @project_file_loader.user_file 11 | config_files.concat( @project_config_manager.options_files ) 12 | config_files.compact! 13 | config_files.map! { |file| file.ext('') } 14 | 15 | log_name = config_files.join( '_' ) 16 | 17 | @project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') ) 18 | end 19 | 20 | 21 | def log(string, heading=nil) 22 | return if (not @configurator.project_logging) 23 | 24 | output = "\n[#{@system_wrapper.time_now}]" 25 | output += " :: #{heading}" if (not heading.nil?) 26 | output += "\n#{string.strip}\n" 27 | 28 | @file_wrapper.write(@project_log_filepath, output, 'a') 29 | end 30 | 31 | end 32 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/makefile.rb: -------------------------------------------------------------------------------- 1 | 2 | # modified version of Rake's provided make-style dependency loader 3 | # customizations: 4 | # (1) handles windows drives in paths -- colons don't confuse task demarcation 5 | # (2) handles spaces in directory paths 6 | 7 | module Rake 8 | 9 | # Makefile loader to be used with the import file loader. 10 | class MakefileLoader 11 | 12 | # Load the makefile dependencies in +fn+. 13 | def load(fn) 14 | open(fn) do |mf| 15 | lines = mf.read 16 | lines.gsub!(/#[^\n]*\n/m, "") # remove comments 17 | lines.gsub!(/\\\n/, ' ') # string together line continuations into single line 18 | lines.split("\n").each do |line| 19 | process_line(line) 20 | end 21 | end 22 | end 23 | 24 | private 25 | 26 | # Process one logical line of makefile data. 27 | def process_line(line) 28 | # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) 29 | file_tasks, args = line.split(/:\s/) 30 | 31 | return if args.nil? 32 | 33 | # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) 34 | dependents = args.split(/\b\s+/) 35 | # replace escaped spaces and clean up any extra whitespace 36 | dependents.map! { |path| path.gsub(/\\ /, ' ').strip } 37 | 38 | file_tasks.strip.split.each do |file_task| 39 | file file_task => dependents 40 | end 41 | end 42 | end 43 | 44 | # Install the handler 45 | Rake.application.add_loader('mf', MakefileLoader.new) 46 | end 47 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/par_map.rb: -------------------------------------------------------------------------------- 1 | 2 | 3 | def par_map(n, things, &block) 4 | queue = Queue.new 5 | things.each { |thing| queue << thing } 6 | threads = (1..n).collect do 7 | Thread.new do 8 | begin 9 | while true 10 | yield queue.pop(true) 11 | end 12 | rescue ThreadError 13 | 14 | end 15 | end 16 | end 17 | threads.each { |t| t.join } 18 | end 19 | 20 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/plugin.rb: -------------------------------------------------------------------------------- 1 | 2 | class String 3 | # reformat a multiline string to have given number of whitespace columns; 4 | # helpful for formatting heredocs 5 | def left_margin(margin=0) 6 | non_whitespace_column = 0 7 | new_lines = [] 8 | 9 | # find first line with non-whitespace and count left columns of whitespace 10 | self.each_line do |line| 11 | if (line =~ /^\s*\S/) 12 | non_whitespace_column = $&.length - 1 13 | break 14 | end 15 | end 16 | 17 | # iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin 18 | self.each_line do |line| 19 | columns = [] 20 | margin.times{columns << ' '} 21 | # handle special case of line being narrower than width to be lopped off 22 | if (non_whitespace_column < line.length) 23 | new_lines << "#{columns.join}#{line[non_whitespace_column..-1]}" 24 | else 25 | new_lines << "\n" 26 | end 27 | end 28 | 29 | return new_lines.join 30 | end 31 | end 32 | 33 | class Plugin 34 | attr_reader :name, :environment 35 | attr_accessor :plugin_objects 36 | 37 | def initialize(system_objects, name) 38 | @environment = [] 39 | @ceedling = system_objects 40 | @name = name 41 | self.setup 42 | end 43 | 44 | def setup; end 45 | 46 | # mock generation 47 | def pre_mock_generate(arg_hash); end 48 | def post_mock_generate(arg_hash); end 49 | 50 | # test runner generation 51 | def pre_runner_generate(arg_hash); end 52 | def post_runner_generate(arg_hash); end 53 | 54 | # compilation (test or source) 55 | def pre_compile_execute(arg_hash); end 56 | def post_compile_execute(arg_hash); end 57 | 58 | # linking (test or source) 59 | def pre_link_execute(arg_hash); end 60 | def post_link_execute(arg_hash); end 61 | 62 | # test fixture execution 63 | def pre_test_fixture_execute(arg_hash); end 64 | def post_test_fixture_execute(arg_hash); end 65 | 66 | # test task 67 | def pre_test(test); end 68 | def post_test(test); end 69 | 70 | # release task 71 | def pre_release; end 72 | def post_release; end 73 | 74 | # whole shebang (any use of Ceedling) 75 | def pre_build; end 76 | def post_build; end 77 | 78 | def summary; end 79 | 80 | end 81 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/plugin_builder.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/plugin' 2 | 3 | class PluginBuilder 4 | 5 | attr_accessor :plugin_objects 6 | 7 | def construct_plugin(plugin_name, object_map_yaml, system_objects) 8 | # @streaminator.stdout_puts("Constructing plugin #{plugin_name}...", Verbosity::OBNOXIOUS) 9 | object_map = {} 10 | @plugin_objects = {} 11 | @system_objects = system_objects 12 | 13 | if object_map_yaml 14 | @object_map = YAML.load(object_map_yaml) 15 | @object_map.each_key do |obj| 16 | construct_object(obj) 17 | end 18 | else 19 | raise "Invalid object map for plugin #{plugin_name}!" 20 | end 21 | 22 | return @plugin_objects 23 | end 24 | 25 | private 26 | 27 | def camelize(underscored_name) 28 | return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase} 29 | end 30 | 31 | def construct_object(obj) 32 | if @plugin_objects[obj].nil? 33 | if @object_map[obj] && @object_map[obj]['compose'] 34 | @object_map[obj]['compose'].each do |dep| 35 | construct_object(dep) 36 | end 37 | end 38 | build_object(obj) 39 | end 40 | end 41 | 42 | def build_object(new_object) 43 | if @plugin_objects[new_object.to_sym].nil? 44 | # @streaminator.stdout_puts("Building plugin object #{new_object}", Verbosity::OBNOXIOUS) 45 | require new_object 46 | class_name = camelize(new_object) 47 | new_instance = eval("#{class_name}.new(@system_objects, class_name.to_s)") 48 | new_instance.plugin_objects = @plugin_objects 49 | @plugin_objects[new_object.to_sym] = new_instance 50 | end 51 | end 52 | 53 | end -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/plugin_manager.rb: -------------------------------------------------------------------------------- 1 | require 'set' 2 | require 'ceedling/constants' 3 | 4 | class PluginManager 5 | 6 | constructor :configurator, :plugin_manager_helper, :streaminator, :reportinator, :system_wrapper 7 | 8 | def setup 9 | @build_fail_registry = [] 10 | @plugin_objects = [] # so we can preserve order 11 | end 12 | 13 | def load_plugin_scripts(script_plugins, system_objects) 14 | environment = [] 15 | 16 | script_plugins.each do |plugin| 17 | # protect against instantiating object multiple times due to processing config multiple times (option files, etc) 18 | next if (@plugin_manager_helper.include?(@plugin_objects, plugin)) 19 | begin 20 | @system_wrapper.require_file( "#{plugin}.rb" ) 21 | object = @plugin_manager_helper.instantiate_plugin_script( camelize(plugin), system_objects, plugin ) 22 | @plugin_objects << object 23 | environment += object.environment 24 | 25 | # add plugins to hash of all system objects 26 | system_objects[plugin.downcase.to_sym] = object 27 | rescue 28 | puts "Exception raised while trying to load plugin: #{plugin}" 29 | raise 30 | end 31 | end 32 | 33 | yield( { :environment => environment } ) if (environment.size > 0) 34 | end 35 | 36 | def plugins_failed? 37 | return (@build_fail_registry.size > 0) 38 | end 39 | 40 | def print_plugin_failures 41 | if (@build_fail_registry.size > 0) 42 | report = @reportinator.generate_banner('BUILD FAILURE SUMMARY') 43 | 44 | @build_fail_registry.each do |failure| 45 | report += "#{' - ' if (@build_fail_registry.size > 1)}#{failure}\n" 46 | end 47 | 48 | report += "\n" 49 | 50 | @streaminator.stderr_puts(report, Verbosity::ERRORS) 51 | end 52 | end 53 | 54 | def register_build_failure(message) 55 | @build_fail_registry << message if (message and not message.empty?) 56 | end 57 | 58 | #### execute all plugin methods #### 59 | 60 | def pre_mock_generate(arg_hash); execute_plugins(:pre_mock_generate, arg_hash); end 61 | def post_mock_generate(arg_hash); execute_plugins(:post_mock_generate, arg_hash); end 62 | 63 | def pre_runner_generate(arg_hash); execute_plugins(:pre_runner_generate, arg_hash); end 64 | def post_runner_generate(arg_hash); execute_plugins(:post_runner_generate, arg_hash); end 65 | 66 | def pre_compile_execute(arg_hash); execute_plugins(:pre_compile_execute, arg_hash); end 67 | def post_compile_execute(arg_hash); execute_plugins(:post_compile_execute, arg_hash); end 68 | 69 | def pre_link_execute(arg_hash); execute_plugins(:pre_link_execute, arg_hash); end 70 | def post_link_execute(arg_hash); execute_plugins(:post_link_execute, arg_hash); end 71 | 72 | def pre_test_fixture_execute(arg_hash); execute_plugins(:pre_test_fixture_execute, arg_hash); end 73 | def post_test_fixture_execute(arg_hash) 74 | # special arbitration: raw test results are printed or taken over by plugins handling the job 75 | @streaminator.stdout_puts(arg_hash[:shell_result][:output]) if (@configurator.plugins_display_raw_test_results) 76 | execute_plugins(:post_test_fixture_execute, arg_hash) 77 | end 78 | 79 | def pre_test(test); execute_plugins(:pre_test, test); end 80 | def post_test(test); execute_plugins(:post_test, test); end 81 | 82 | def pre_release; execute_plugins(:pre_release); end 83 | def post_release; execute_plugins(:post_release); end 84 | 85 | def pre_build; execute_plugins(:pre_build); end 86 | def post_build; execute_plugins(:post_build); end 87 | 88 | def summary; execute_plugins(:summary); end 89 | 90 | private #################################### 91 | 92 | def camelize(underscored_name) 93 | return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase} 94 | end 95 | 96 | def execute_plugins(method, *args) 97 | @plugin_objects.each do |plugin| 98 | begin 99 | plugin.send(method, *args) 100 | rescue 101 | puts "Exception raised in plugin: #{plugin.name}, in method #{method}" 102 | raise 103 | end 104 | end 105 | end 106 | 107 | end 108 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/plugin_manager_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | class PluginManagerHelper 3 | 4 | def include?(plugins, name) 5 | include = false 6 | plugins.each do |plugin| 7 | if (plugin.name == name) 8 | include = true 9 | break 10 | end 11 | end 12 | return include 13 | end 14 | 15 | def instantiate_plugin_script(plugin, system_objects, name) 16 | return eval("#{plugin}.new(system_objects, name)") 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/plugin_reportinator.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | require 'ceedling/defaults' 3 | 4 | class PluginReportinator 5 | 6 | constructor :plugin_reportinator_helper, :plugin_manager, :reportinator 7 | 8 | def setup 9 | @test_results_template = nil 10 | end 11 | 12 | 13 | def set_system_objects(system_objects) 14 | @plugin_reportinator_helper.ceedling = system_objects 15 | end 16 | 17 | 18 | def fetch_results(results_path, test, options={:boom => false}) 19 | return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options ) 20 | end 21 | 22 | 23 | def generate_banner(message) 24 | return @reportinator.generate_banner(message) 25 | end 26 | 27 | 28 | def assemble_test_results(results_list, options={:boom => false}) 29 | aggregated_results = get_results_structure 30 | 31 | results_list.each do |result_path| 32 | results = @plugin_reportinator_helper.fetch_results( result_path, options ) 33 | @plugin_reportinator_helper.process_results(aggregated_results, results) 34 | end 35 | 36 | return aggregated_results 37 | end 38 | 39 | 40 | def register_test_results_template(template) 41 | @test_results_template = template if (@test_results_template.nil?) 42 | end 43 | 44 | 45 | def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block) 46 | run_report( $stdout, 47 | ((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template), 48 | hash, 49 | verbosity, 50 | &block ) 51 | end 52 | 53 | 54 | def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL) 55 | failure = nil 56 | failure = yield() if block_given? 57 | 58 | @plugin_manager.register_build_failure( failure ) 59 | 60 | @plugin_reportinator_helper.run_report( stream, template, hash, verbosity ) 61 | end 62 | 63 | private ############################### 64 | 65 | def get_results_structure 66 | return { 67 | :successes => [], 68 | :failures => [], 69 | :ignores => [], 70 | :stdout => [], 71 | :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0, :stdout => 0} 72 | } 73 | end 74 | 75 | end -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/plugin_reportinator_helper.rb: -------------------------------------------------------------------------------- 1 | require 'erb' 2 | require 'rubygems' 3 | require 'rake' # for ext() 4 | require 'ceedling/constants' 5 | 6 | 7 | class PluginReportinatorHelper 8 | 9 | attr_writer :ceedling 10 | 11 | constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper 12 | 13 | def fetch_results(results_path, options) 14 | pass_path = File.join(results_path.ext( @configurator.extension_testpass )) 15 | fail_path = File.join(results_path.ext( @configurator.extension_testfail )) 16 | 17 | if (@file_wrapper.exist?(fail_path)) 18 | return @yaml_wrapper.load(fail_path) 19 | elsif (@file_wrapper.exist?(pass_path)) 20 | return @yaml_wrapper.load(pass_path) 21 | else 22 | if (options[:boom]) 23 | @streaminator.stderr_puts("Could find no test results for '#{File.basename(results_path).ext(@configurator.extension_source)}'", Verbosity::ERRORS) 24 | raise 25 | end 26 | end 27 | 28 | return {} 29 | end 30 | 31 | 32 | def process_results(aggregate_results, results) 33 | return if (results.empty?) 34 | 35 | aggregate_results[:successes] << { :source => results[:source].clone, :collection => results[:successes].clone } if (results[:successes].size > 0) 36 | aggregate_results[:failures] << { :source => results[:source].clone, :collection => results[:failures].clone } if (results[:failures].size > 0) 37 | aggregate_results[:ignores] << { :source => results[:source].clone, :collection => results[:ignores].clone } if (results[:ignores].size > 0) 38 | aggregate_results[:stdout] << { :source => results[:source].clone, :collection => results[:stdout].clone } if (results[:stdout].size > 0) 39 | aggregate_results[:counts][:total] += results[:counts][:total] 40 | aggregate_results[:counts][:passed] += results[:counts][:passed] 41 | aggregate_results[:counts][:failed] += results[:counts][:failed] 42 | aggregate_results[:counts][:ignored] += results[:counts][:ignored] 43 | aggregate_results[:counts][:stdout] += results[:stdout].size 44 | end 45 | 46 | 47 | def run_report(stream, template, hash, verbosity) 48 | output = ERB.new(template, 0, "%<>") 49 | @streaminator.stream_puts(stream, output.result(binding()), verbosity) 50 | end 51 | 52 | end -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/preprocessinator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Preprocessinator 3 | 4 | attr_reader :preprocess_file_proc 5 | 6 | constructor :preprocessinator_helper, :preprocessinator_includes_handler, :preprocessinator_file_handler, :task_invoker, :file_path_utils, :yaml_wrapper 7 | 8 | 9 | def setup 10 | # fashion ourselves callbacks @preprocessinator_helper can use 11 | @preprocess_includes_proc = Proc.new { |filepath| self.preprocess_shallow_includes(filepath) } 12 | @preprocess_file_proc = Proc.new { |filepath| self.preprocess_file(filepath) } 13 | end 14 | 15 | 16 | def preprocess_test_and_invoke_test_mocks(test) 17 | @preprocessinator_helper.preprocess_includes(test, @preprocess_includes_proc) 18 | 19 | mocks_list = @preprocessinator_helper.assemble_mocks_list(test) 20 | 21 | @preprocessinator_helper.preprocess_mockable_headers(mocks_list, @preprocess_file_proc) 22 | 23 | @task_invoker.invoke_test_mocks(mocks_list) 24 | 25 | @preprocessinator_helper.preprocess_test_file(test, @preprocess_file_proc) 26 | 27 | return mocks_list 28 | end 29 | 30 | def preprocess_shallow_includes(filepath) 31 | dependencies_rule = @preprocessinator_includes_handler.form_shallow_dependencies_rule(filepath) 32 | includes = @preprocessinator_includes_handler.extract_shallow_includes(dependencies_rule) 33 | 34 | @preprocessinator_includes_handler.write_shallow_includes_list( 35 | @file_path_utils.form_preprocessed_includes_list_filepath(filepath), includes) 36 | end 37 | 38 | def preprocess_file(filepath) 39 | @preprocessinator_includes_handler.invoke_shallow_includes_list(filepath) 40 | @preprocessinator_file_handler.preprocess_file( filepath, @yaml_wrapper.load(@file_path_utils.form_preprocessed_includes_list_filepath(filepath)) ) 41 | end 42 | 43 | end 44 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/preprocessinator_extractor.rb: -------------------------------------------------------------------------------- 1 | class PreprocessinatorExtractor 2 | def extract_base_file_from_preprocessed_expansion(filepath) 3 | # preprocessing by way of toolchain preprocessor expands macros, eliminates 4 | # comments, strips out #ifdef code, etc. however, it also expands in place 5 | # each #include'd file. so, we must extract only the lines of the file 6 | # that belong to the file originally preprocessed 7 | 8 | # iterate through all lines and alternate between extract and ignore modes 9 | # all lines between a '#'line containing file name of our filepath and the 10 | # next '#'line should be extracted 11 | 12 | base_name = File.basename(filepath) 13 | not_pragma = /^#(?!pragma\b)/ # preprocessor directive that's not a #pragma 14 | pattern = /^#.*(\s|\/|\\|\")#{Regexp.escape(base_name)}/ 15 | found_file = false # have we found the file we care about? 16 | 17 | lines = [] 18 | File.readlines(filepath).each do |line| 19 | if found_file and not line.match(not_pragma) 20 | lines << line 21 | else 22 | found_file = false 23 | end 24 | 25 | found_file = true if line.match(pattern) 26 | end 27 | 28 | return lines 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/preprocessinator_file_handler.rb: -------------------------------------------------------------------------------- 1 | 2 | 3 | class PreprocessinatorFileHandler 4 | 5 | constructor :preprocessinator_extractor, :configurator, :tool_executor, :file_path_utils, :file_wrapper 6 | 7 | 8 | def preprocess_file(filepath, includes) 9 | preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath) 10 | 11 | command = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, [], filepath, preprocessed_filepath) 12 | @tool_executor.exec(command[:line], command[:options]) 13 | 14 | contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath) 15 | 16 | includes.each{|include| contents.unshift("#include \"#{include}\"")} 17 | 18 | @file_wrapper.write(preprocessed_filepath, contents.join("\n")) 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/preprocessinator_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | 3 | class PreprocessinatorHelper 4 | 5 | constructor :configurator, :test_includes_extractor, :task_invoker, :file_finder, :file_path_utils 6 | 7 | 8 | def preprocess_includes(test, preprocess_includes_proc) 9 | if (@configurator.project_use_test_preprocessor) 10 | preprocessed_includes_list = @file_path_utils.form_preprocessed_includes_list_filepath(test) 11 | preprocess_includes_proc.call( @file_finder.find_test_from_file_path(preprocessed_includes_list) ) 12 | @test_includes_extractor.parse_includes_list(preprocessed_includes_list) 13 | else 14 | @test_includes_extractor.parse_test_file(test) 15 | end 16 | end 17 | 18 | def assemble_mocks_list(test) 19 | return @file_path_utils.form_mocks_source_filelist( @test_includes_extractor.lookup_raw_mock_list(test) ) 20 | end 21 | 22 | def preprocess_mockable_headers(mock_list, preprocess_file_proc) 23 | if (@configurator.project_use_test_preprocessor) 24 | preprocess_files_smartly( 25 | @file_path_utils.form_preprocessed_mockable_headers_filelist(mock_list), 26 | preprocess_file_proc ) { |file| @file_finder.find_header_file(file) } 27 | end 28 | end 29 | 30 | def preprocess_test_file(test, preprocess_file_proc) 31 | return if (!@configurator.project_use_test_preprocessor) 32 | 33 | preprocess_file_proc.call(test) 34 | end 35 | 36 | private ############################ 37 | 38 | def preprocess_files_smartly(file_list, preprocess_file_proc) 39 | if (@configurator.project_use_deep_dependencies) 40 | @task_invoker.invoke_test_preprocessed_files(file_list) 41 | else 42 | file_list.each { |file| preprocess_file_proc.call( yield(file) ) } 43 | end 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/preprocessinator_includes_handler.rb: -------------------------------------------------------------------------------- 1 | 2 | 3 | class PreprocessinatorIncludesHandler 4 | 5 | constructor :configurator, :tool_executor, :task_invoker, :file_path_utils, :yaml_wrapper, :file_wrapper 6 | 7 | # shallow includes: only those headers a source file explicitly includes 8 | 9 | def invoke_shallow_includes_list(filepath) 10 | @task_invoker.invoke_test_shallow_include_lists( [@file_path_utils.form_preprocessed_includes_list_filepath(filepath)] ) 11 | end 12 | 13 | ## 14 | # Ask the preprocessor for a make-style dependency rule of only the headers 15 | # the source file immediately includes. 16 | # 17 | # === Arguments 18 | # +filepath+ _String_:: Path to the test file to process. 19 | # 20 | # === Return 21 | # _String_:: The text of the dependency rule generated by the preprocessor. 22 | def form_shallow_dependencies_rule(filepath) 23 | # change filename (prefix of '_') to prevent preprocessor from finding 24 | # include files in temp directory containing file it's scanning 25 | temp_filepath = @file_path_utils.form_temp_path(filepath, '_') 26 | 27 | # read the file and replace all include statements with a decorated version 28 | # (decorating the names creates file names that don't exist, thus preventing 29 | # the preprocessor from snaking out and discovering the entire include path 30 | # that winds through the code). The decorated filenames indicate files that 31 | # are included directly by the test file. 32 | contents = @file_wrapper.read(filepath) 33 | contents.gsub!( /^\s*#include\s+[\"<]\s*(\S+)\s*[\">]/, "#include \"\\1\"\n#include \"@@@@\\1\"" ) 34 | @file_wrapper.write( temp_filepath, contents ) 35 | 36 | # extract the make-style dependency rule telling the preprocessor to 37 | # ignore the fact that it can't find the included files 38 | command = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, [], temp_filepath) 39 | shell_result = @tool_executor.exec(command[:line], command[:options]) 40 | 41 | return shell_result[:output] 42 | end 43 | 44 | ## 45 | # Extract the headers that are directly included by a source file using the 46 | # provided, annotated Make dependency rule. 47 | # 48 | # === Arguments 49 | # +make_rule+ _String_:: Annotated Make dependency rule. 50 | # 51 | # === Return 52 | # _Array_ of _String_:: Array of the direct dependencies for the source file. 53 | def extract_shallow_includes(make_rule) 54 | # Extract the dependencies from the make rule 55 | hdr_ext = @configurator.extension_header 56 | dependencies = make_rule.split.find_all {|path| path.end_with?(hdr_ext) }.uniq 57 | dependencies.map! {|hdr| hdr.gsub('\\','/') } 58 | 59 | # Separate the real files form the annotated ones and remove the '@@@@' 60 | annotated_headers, real_headers = dependencies.partition {|hdr| hdr =~ /^@@@@/ } 61 | annotated_headers.map! {|hdr| hdr.gsub('@@@@','') } 62 | 63 | # Find which of our annotated headers are "real" dependencies. This is 64 | # intended to weed out dependencies that have been removed due to build 65 | # options defined in the project yaml and/or in the headers themselves. 66 | annotated_headers.find_all do |annotated_header| 67 | # find the index of the "real" include that matches the annotated one. 68 | idx = real_headers.find_index do |real_header| 69 | real_header =~ /^(.*\/)?#{Regexp.escape(annotated_header)}$/ 70 | end 71 | # If we found a real include, delete it from the array and return it, 72 | # otherwise return nil. Since nil is falsy this has the effect of making 73 | # find_all return only the annotated headers for which a real include was 74 | # found/deleted 75 | idx ? real_headers.delete_at(idx) : nil 76 | end.compact 77 | end 78 | 79 | def write_shallow_includes_list(filepath, list) 80 | @yaml_wrapper.dump(filepath, list) 81 | end 82 | end 83 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/project_config_manager.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | class ProjectConfigManager 5 | 6 | attr_reader :options_files, :release_config_changed, :test_config_changed 7 | attr_accessor :config_hash 8 | 9 | constructor :cacheinator, :yaml_wrapper 10 | 11 | 12 | def setup 13 | @options_files = [] 14 | @release_config_changed = false 15 | @test_config_changed = false 16 | end 17 | 18 | 19 | def merge_options(config_hash, option_filepath) 20 | @options_files << File.basename( option_filepath ) 21 | config_hash.deep_merge( @yaml_wrapper.load( option_filepath ) ) 22 | return config_hash 23 | end 24 | 25 | 26 | 27 | def process_release_config_change 28 | # has project configuration changed since last release build 29 | @release_config_changed = @cacheinator.diff_cached_release_config?( @config_hash ) 30 | end 31 | 32 | 33 | def process_test_config_change 34 | # has project configuration changed since last test build 35 | @test_config_changed = @cacheinator.diff_cached_test_config?( @config_hash ) 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/project_file_loader.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | class ProjectFileLoader 5 | 6 | attr_reader :main_file, :user_file 7 | 8 | constructor :yaml_wrapper, :stream_wrapper, :system_wrapper, :file_wrapper 9 | 10 | def setup 11 | @main_file = nil 12 | @user_file = nil 13 | 14 | @main_project_filepath = '' 15 | @user_project_filepath = '' 16 | end 17 | 18 | 19 | def find_project_files 20 | # first go hunting for optional user project file by looking for environment variable and then default location on disk 21 | user_filepath = @system_wrapper.env_get('CEEDLING_USER_PROJECT_FILE') 22 | 23 | if ( not user_filepath.nil? and @file_wrapper.exist?(user_filepath) ) 24 | @user_project_filepath = user_filepath 25 | elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_USER_PROJECT_FILE)) 26 | @user_project_filepath = DEFAULT_CEEDLING_USER_PROJECT_FILE 27 | end 28 | 29 | # next check for main project file by looking for environment variable and then default location on disk; 30 | # blow up if we don't find this guy -- like, he's so totally important 31 | main_filepath = @system_wrapper.env_get('CEEDLING_MAIN_PROJECT_FILE') 32 | 33 | if ( not main_filepath.nil? and @file_wrapper.exist?(main_filepath) ) 34 | @main_project_filepath = main_filepath 35 | elsif (@file_wrapper.exist?(DEFAULT_CEEDLING_MAIN_PROJECT_FILE)) 36 | @main_project_filepath = DEFAULT_CEEDLING_MAIN_PROJECT_FILE 37 | else 38 | # no verbosity checking since this is lowest level reporting anyhow & 39 | # verbosity checking depends on configurator which in turns needs this class (circular dependency) 40 | @stream_wrapper.stderr_puts('Found no Ceedling project file (*.yml)') 41 | raise 42 | end 43 | 44 | @main_file = File.basename( @main_project_filepath ) 45 | @user_file = File.basename( @user_project_filepath ) if ( not @user_project_filepath.empty? ) 46 | end 47 | 48 | 49 | def load_project_config 50 | config_hash = {} 51 | 52 | # if there's no user project file, then just provide hash from project file 53 | if (@user_project_filepath.empty?) 54 | config_hash = @yaml_wrapper.load(@main_project_filepath) 55 | # if there is a user project file, load it too and merge it on top of the project file, 56 | # superseding anything that's common between them 57 | else 58 | config_hash = (@yaml_wrapper.load(@main_project_filepath)).merge(@yaml_wrapper.load(@user_project_filepath)) 59 | end 60 | 61 | return config_hash 62 | end 63 | 64 | end 65 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rake_utils.rb: -------------------------------------------------------------------------------- 1 | 2 | class RakeUtils 3 | 4 | constructor :rake_wrapper 5 | 6 | def task_invoked?(task_regex) 7 | task_invoked = false 8 | @rake_wrapper.task_list.each do |task| 9 | if ((task.already_invoked) and (task.to_s =~ task_regex)) 10 | task_invoked = true 11 | break 12 | end 13 | end 14 | return task_invoked 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rake_wrapper.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'rake' 3 | require 'ceedling/makefile' # our replacement for rake's make-style dependency loader 4 | 5 | include Rake::DSL if defined?(Rake::DSL) 6 | 7 | class Rake::Task 8 | attr_reader :already_invoked 9 | end 10 | 11 | class RakeWrapper 12 | 13 | def initialize 14 | @makefile_loader = Rake::MakefileLoader.new # use our custom replacement noted above 15 | end 16 | 17 | def [](task) 18 | return Rake::Task[task] 19 | end 20 | 21 | def task_list 22 | return Rake::Task.tasks 23 | end 24 | 25 | def create_file_task(file_task, dependencies) 26 | file(file_task => dependencies) 27 | end 28 | 29 | def load_dependencies(dependencies_path) 30 | @makefile_loader.load(dependencies_path) 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rakefile.rb: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | 3 | # get directory containing this here file, back up one directory, and expand to full path 4 | CEEDLING_ROOT = File.expand_path(File.dirname(__FILE__) + '/../..') 5 | CEEDLING_LIB = File.join(CEEDLING_ROOT, 'lib') 6 | CEEDLING_VENDOR = File.join(CEEDLING_ROOT, 'vendor') 7 | CEEDLING_RELEASE = File.join(CEEDLING_ROOT, 'release') 8 | 9 | $LOAD_PATH.unshift( CEEDLING_LIB ) 10 | $LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'unity/auto') ) 11 | $LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'diy/lib') ) 12 | $LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'constructor/lib') ) 13 | $LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'cmock/lib') ) 14 | $LOAD_PATH.unshift( File.join(CEEDLING_VENDOR, 'deep_merge/lib') ) 15 | 16 | require 'rake' 17 | 18 | require 'diy' 19 | require 'constructor' 20 | 21 | require 'ceedling/constants' 22 | require 'ceedling/target_loader' 23 | 24 | 25 | # construct all our objects 26 | # ensure load path contains all libraries needed first 27 | lib_ceedling_load_path_temp = File.join(CEEDLING_LIB, 'ceedling') 28 | $LOAD_PATH.unshift( lib_ceedling_load_path_temp ) 29 | @ceedling = DIY::Context.from_yaml( File.read( File.join(lib_ceedling_load_path_temp, 'objects.yml') ) ) 30 | @ceedling.build_everything 31 | # now that all objects are built, delete 'lib/ceedling' from load path 32 | $LOAD_PATH.delete(lib_ceedling_load_path_temp) 33 | # one-stop shopping for all our setup and such after construction 34 | @ceedling[:setupinator].ceedling = @ceedling 35 | 36 | project_config = 37 | begin 38 | cfg = @ceedling[:setupinator].load_project_files 39 | TargetLoader.inspect(cfg, ENV['TARGET']) 40 | rescue TargetLoader::NoTargets 41 | cfg 42 | rescue TargetLoader::RequestReload 43 | @ceedling[:setupinator].load_project_files 44 | end 45 | 46 | @ceedling[:setupinator].do_setup( project_config ) 47 | 48 | 49 | # tell all our plugins we're about to do something 50 | @ceedling[:plugin_manager].pre_build 51 | 52 | # load rakefile component files (*.rake) 53 | PROJECT_RAKEFILE_COMPONENT_FILES.each { |component| load(component) } 54 | 55 | # tell rake to shut up by default (overridden in verbosity / debug tasks as appropriate) 56 | verbose(false) 57 | 58 | 59 | # end block always executed following rake run 60 | END { 61 | # cache our input configurations to use in comparison upon next execution 62 | @ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].test_invoked?) 63 | @ceedling[:cacheinator].cache_release_config( @ceedling[:setupinator].config_hash ) if (@ceedling[:task_invoker].release_invoked?) 64 | 65 | # delete all temp files unless we're in debug mode 66 | if (not @ceedling[:configurator].project_debug) 67 | @ceedling[:file_wrapper].rm_f( @ceedling[:file_wrapper].directory_listing( File.join(@ceedling[:configurator].project_temp_path, '*') )) 68 | end 69 | 70 | # only perform these final steps if we got here without runtime exceptions or errors 71 | if (@ceedling[:system_wrapper].ruby_success) 72 | 73 | # tell all our plugins the build is done and process results 74 | @ceedling[:plugin_manager].post_build 75 | @ceedling[:plugin_manager].print_plugin_failures 76 | exit(1) if (@ceedling[:plugin_manager].plugins_failed?) 77 | end 78 | } 79 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/release_invoker.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | class ReleaseInvoker 5 | 6 | constructor :configurator, :release_invoker_helper, :build_invoker_utils, :dependinator, :task_invoker, :file_path_utils, :file_wrapper 7 | 8 | 9 | def setup_and_invoke_c_objects( c_files ) 10 | objects = @file_path_utils.form_release_build_c_objects_filelist( c_files ) 11 | 12 | begin 13 | @release_invoker_helper.process_deep_dependencies( @file_path_utils.form_release_dependencies_filelist( c_files ) ) 14 | 15 | @dependinator.enhance_release_file_dependencies( objects ) 16 | @task_invoker.invoke_release_objects( objects ) 17 | rescue => e 18 | @build_invoker_utils.process_exception( e, RELEASE_SYM, false ) 19 | end 20 | 21 | return objects 22 | end 23 | 24 | 25 | def setup_and_invoke_asm_objects( asm_files ) 26 | objects = @file_path_utils.form_release_build_asm_objects_filelist( asm_files ) 27 | 28 | begin 29 | @dependinator.enhance_release_file_dependencies( objects ) 30 | @task_invoker.invoke_release_objects( objects ) 31 | rescue => e 32 | @build_invoker_utils.process_exception( e, RELEASE_SYM, false ) 33 | end 34 | 35 | return objects 36 | end 37 | 38 | 39 | def refresh_c_deep_dependencies 40 | return if (not @configurator.project_use_deep_dependencies) 41 | 42 | @file_wrapper.rm_f( 43 | @file_wrapper.directory_listing( 44 | File.join( @configurator.project_release_dependencies_path, '*' + @configurator.extension_dependencies ) ) ) 45 | 46 | @release_invoker_helper.process_deep_dependencies( 47 | @file_path_utils.form_release_dependencies_filelist( 48 | @configurator.collection_all_source ) ) 49 | end 50 | 51 | 52 | def artifactinate( *files ) 53 | files.flatten.each do |file| 54 | @file_wrapper.cp( file, @configurator.project_release_artifacts_path ) if @file_wrapper.exist?( file ) 55 | end 56 | end 57 | 58 | end 59 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/release_invoker_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | 3 | class ReleaseInvokerHelper 4 | 5 | constructor :configurator, :dependinator, :task_invoker 6 | 7 | 8 | def process_deep_dependencies(dependencies_list) 9 | return if (not @configurator.project_use_deep_dependencies) 10 | 11 | @dependinator.enhance_release_file_dependencies( dependencies_list ) 12 | @task_invoker.invoke_release_dependencies_files( dependencies_list ) 13 | @dependinator.load_release_object_deep_dependencies( dependencies_list ) 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/reportinator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Reportinator 3 | 4 | def generate_banner(message, width=nil) 5 | dash_count = ((width.nil?) ? message.strip.length : width) 6 | return "#{'-' * dash_count}\n#{message}\n#{'-' * dash_count}\n" 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rules_cmock.rake: -------------------------------------------------------------------------------- 1 | 2 | 3 | rule(/#{CMOCK_MOCK_PREFIX}.+#{'\\'+EXTENSION_SOURCE}$/ => [ 4 | proc do |task_name| 5 | @ceedling[:file_finder].find_header_input_for_mock_file(task_name) 6 | end 7 | ]) do |mock| 8 | @ceedling[:generator].generate_mock(TEST_SYM, mock.source) 9 | end 10 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rules_preprocess.rake: -------------------------------------------------------------------------------- 1 | 2 | 3 | # invocations against this rule should only happen when enhanced dependencies are enabled; 4 | # otherwise, dependency tracking will be too shallow and preprocessed files could intermittently 5 | # fail to be updated when they actually need to be. 6 | rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [ 7 | proc do |task_name| 8 | @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) 9 | end 10 | ]) do |file| 11 | if (not @ceedling[:configurator].project_use_deep_dependencies) 12 | raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.' 13 | end 14 | @ceedling[:generator].generate_preprocessed_file(TEST_SYM, file.source) 15 | end 16 | 17 | 18 | # invocations against this rule can always happen as there are no deeper dependencies to consider 19 | rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [ 20 | proc do |task_name| 21 | @ceedling[:file_finder].find_test_or_source_or_header_file(task_name) 22 | end 23 | ]) do |file| 24 | @ceedling[:generator].generate_shallow_includes_list(TEST_SYM, file.source) 25 | end 26 | 27 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rules_release.rake: -------------------------------------------------------------------------------- 1 | 2 | RELEASE_COMPILE_TASK_ROOT = RELEASE_TASK_ROOT + 'compile:' 3 | RELEASE_ASSEMBLE_TASK_ROOT = RELEASE_TASK_ROOT + 'assemble:' 4 | 5 | 6 | if (RELEASE_BUILD_USE_ASSEMBLY) 7 | rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_ASM_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ 8 | proc do |task_name| 9 | @ceedling[:file_finder].find_assembly_file(task_name) 10 | end 11 | ]) do |object| 12 | @ceedling[:generator].generate_object_file( 13 | TOOLS_RELEASE_ASSEMBLER, 14 | OPERATION_ASSEMBLE_SYM, 15 | RELEASE_SYM, 16 | object.source, 17 | object.name ) 18 | end 19 | end 20 | 21 | 22 | rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_C_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ 23 | proc do |task_name| 24 | @ceedling[:file_finder].find_compilation_input_file(task_name) 25 | end 26 | ]) do |object| 27 | @ceedling[:generator].generate_object_file( 28 | TOOLS_RELEASE_COMPILER, 29 | OPERATION_COMPILE_SYM, 30 | RELEASE_SYM, 31 | object.source, 32 | object.name, 33 | @ceedling[:file_path_utils].form_release_build_c_list_filepath( object.name ) ) 34 | end 35 | 36 | 37 | rule(/#{PROJECT_RELEASE_BUILD_TARGET}/) do |bin_file| 38 | map_file = @ceedling[:configurator].project_release_build_map 39 | @ceedling[:generator].generate_executable_file( 40 | TOOLS_RELEASE_LINKER, 41 | RELEASE_SYM, 42 | bin_file.prerequisites, 43 | bin_file.name, 44 | map_file ) 45 | @ceedling[:release_invoker].artifactinate( bin_file.name, map_file, @ceedling[:configurator].release_build_artifacts ) 46 | end 47 | 48 | 49 | namespace RELEASE_SYM do 50 | # use rules to increase efficiency for large projects (instead of iterating through all sources and creating defined tasks) 51 | 52 | namespace :compile do 53 | rule(/^#{RELEASE_COMPILE_TASK_ROOT}\S+#{'\\'+EXTENSION_SOURCE}$/ => [ # compile task names by regex 54 | proc do |task_name| 55 | source = task_name.sub(/#{RELEASE_COMPILE_TASK_ROOT}/, '') 56 | @ceedling[:file_finder].find_source_file(source, :error) 57 | end 58 | ]) do |compile| 59 | @ceedling[:rake_wrapper][:directories].invoke 60 | @ceedling[:project_config_manager].process_release_config_change 61 | @ceedling[:release_invoker].setup_and_invoke_c_objects( [compile.source] ) 62 | end 63 | end 64 | 65 | if (RELEASE_BUILD_USE_ASSEMBLY) 66 | namespace :assemble do 67 | rule(/^#{RELEASE_ASSEMBLE_TASK_ROOT}\S+#{'\\'+EXTENSION_ASSEMBLY}$/ => [ # assemble task names by regex 68 | proc do |task_name| 69 | source = task_name.sub(/#{RELEASE_ASSEMBLE_TASK_ROOT}/, '') 70 | @ceedling[:file_finder].find_assembly_file(source) 71 | end 72 | ]) do |assemble| 73 | @ceedling[:rake_wrapper][:directories].invoke 74 | @ceedling[:project_config_manager].process_release_config_change 75 | @ceedling[:release_invoker].setup_and_invoke_asm_objects( [assemble.source] ) 76 | end 77 | end 78 | end 79 | 80 | end 81 | 82 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rules_release_deep_dependencies.rake: -------------------------------------------------------------------------------- 1 | 2 | 3 | rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ 4 | proc do |task_name| 5 | @ceedling[:file_finder].find_compilation_input_file(task_name) 6 | end 7 | ]) do |dep| 8 | @ceedling[:generator].generate_dependencies_file( 9 | TOOLS_RELEASE_DEPENDENCIES_GENERATOR, 10 | RELEASE_SYM, 11 | dep.source, 12 | @ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source), 13 | dep.name) 14 | end 15 | 16 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rules_tests.rake: -------------------------------------------------------------------------------- 1 | 2 | 3 | rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION_SOURCE}$/ => [ 4 | proc do |task_name| 5 | @ceedling[:file_finder].find_test_input_for_runner_file(task_name) 6 | end 7 | ]) do |runner| 8 | @ceedling[:generator].generate_test_runner(TEST_SYM, runner.source, runner.name) 9 | end 10 | 11 | 12 | rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [ 13 | proc do |task_name| 14 | @ceedling[:file_finder].find_compilation_input_file(task_name) 15 | end 16 | ]) do |object| 17 | @ceedling[:generator].generate_object_file( 18 | TOOLS_TEST_COMPILER, 19 | OPERATION_COMPILE_SYM, 20 | TEST_SYM, 21 | object.source, 22 | object.name, 23 | @ceedling[:file_path_utils].form_test_build_list_filepath( object.name ) ) 24 | end 25 | 26 | 27 | rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file| 28 | @ceedling[:generator].generate_executable_file( 29 | TOOLS_TEST_LINKER, 30 | TEST_SYM, 31 | bin_file.prerequisites, 32 | bin_file.name, 33 | @ceedling[:file_path_utils].form_test_build_map_filepath( bin_file.name ) ) 34 | end 35 | 36 | 37 | rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [ 38 | proc do |task_name| 39 | @ceedling[:file_path_utils].form_test_executable_filepath(task_name) 40 | end 41 | ]) do |test_result| 42 | @ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_SYM, test_result.source, test_result.name) 43 | end 44 | 45 | 46 | namespace TEST_SYM do 47 | # use rules to increase efficiency for large projects (instead of iterating through all sources and creating defined tasks) 48 | 49 | rule(/^#{TEST_TASK_ROOT}\S+$/ => [ # test task names by regex 50 | proc do |task_name| 51 | test = task_name.sub(/#{TEST_TASK_ROOT}/, '') 52 | test = "#{PROJECT_TEST_FILE_PREFIX}#{test}" if not (test.start_with?(PROJECT_TEST_FILE_PREFIX)) 53 | @ceedling[:file_finder].find_test_from_file_path(test) 54 | end 55 | ]) do |test| 56 | @ceedling[:rake_wrapper][:directories].invoke 57 | @ceedling[:test_invoker].setup_and_invoke([test.source]) 58 | end 59 | end 60 | 61 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/rules_tests_deep_dependencies.rake: -------------------------------------------------------------------------------- 1 | 2 | 3 | rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [ 4 | proc do |task_name| 5 | @ceedling[:file_finder].find_compilation_input_file(task_name) 6 | end 7 | ]) do |dep| 8 | @ceedling[:generator].generate_dependencies_file( 9 | TOOLS_TEST_DEPENDENCIES_GENERATOR, 10 | TEST_SYM, 11 | dep.source, 12 | @ceedling[:file_path_utils].form_test_build_object_filepath(dep.source), 13 | dep.name) 14 | end 15 | 16 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/setupinator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Setupinator 3 | 4 | attr_reader :config_hash 5 | attr_writer :ceedling 6 | 7 | def setup 8 | @ceedling = {} 9 | @config_hash = {} 10 | end 11 | 12 | def load_project_files 13 | @ceedling[:project_file_loader].find_project_files 14 | return @ceedling[:project_file_loader].load_project_config 15 | end 16 | 17 | def do_setup(config_hash) 18 | @config_hash = config_hash 19 | 20 | # load up all the constants and accessors our rake files, objects, & external scripts will need; 21 | # note: configurator modifies the cmock section of the hash with a couple defaults to tie 22 | # project together - the modified hash is used to build cmock object 23 | @ceedling[:configurator].populate_defaults( config_hash ) 24 | @ceedling[:configurator].populate_cmock_defaults( config_hash ) 25 | @ceedling[:configurator].find_and_merge_plugins( config_hash ) 26 | @ceedling[:configurator].tools_setup( config_hash ) 27 | @ceedling[:configurator].eval_environment_variables( config_hash ) 28 | @ceedling[:configurator].eval_paths( config_hash ) 29 | @ceedling[:configurator].standardize_paths( config_hash ) 30 | @ceedling[:configurator].validate( config_hash ) 31 | @ceedling[:configurator].build( config_hash, :environment ) 32 | 33 | @ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins ) 34 | @ceedling[:configurator].tools_supplement_arguments( config_hash ) 35 | 36 | # merge in any environment variables plugins specify, after the main build 37 | @ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) do |env| 38 | @ceedling[:configurator].eval_environment_variables( env ) 39 | @ceedling[:configurator].build_supplement( config_hash, env ) 40 | end 41 | 42 | @ceedling[:plugin_reportinator].set_system_objects( @ceedling ) 43 | @ceedling[:file_finder].prepare_search_sources 44 | @ceedling[:loginator].setup_log_filepath 45 | @ceedling[:project_config_manager].config_hash = config_hash 46 | end 47 | 48 | def reset_defaults(config_hash) 49 | @ceedling[:configurator].reset_defaults( config_hash ) 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/stream_wrapper.rb: -------------------------------------------------------------------------------- 1 | 2 | class StreamWrapper 3 | 4 | def stdout_puts(string) 5 | $stdout.puts(string) 6 | end 7 | 8 | def stdout_flush 9 | $stdout.flush 10 | end 11 | 12 | def stderr_puts(string) 13 | $stderr.puts(string) 14 | end 15 | 16 | def stderr_flush 17 | $stderr.flush 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/streaminator.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | class Streaminator 4 | 5 | constructor :streaminator_helper, :verbosinator, :loginator, :stream_wrapper 6 | 7 | # for those objects for whom the configurator has already been instantiated, 8 | # Streaminator is a convenience object for handling verbosity and writing to the std streams 9 | 10 | def stdout_puts(string, verbosity=Verbosity::NORMAL) 11 | if (@verbosinator.should_output?(verbosity)) 12 | @stream_wrapper.stdout_puts(string) 13 | @stream_wrapper.stdout_flush 14 | end 15 | 16 | # write to log as though Verbosity::OBNOXIOUS 17 | @loginator.log( string, @streaminator_helper.extract_name($stdout) ) 18 | end 19 | 20 | def stderr_puts(string, verbosity=Verbosity::NORMAL) 21 | if (@verbosinator.should_output?(verbosity)) 22 | @stream_wrapper.stderr_puts(string) 23 | @stream_wrapper.stderr_flush 24 | end 25 | 26 | # write to log as though Verbosity::OBNOXIOUS 27 | @loginator.log( string, @streaminator_helper.extract_name($stderr) ) 28 | end 29 | 30 | def stream_puts(stream, string, verbosity=Verbosity::NORMAL) 31 | if (@verbosinator.should_output?(verbosity)) 32 | stream.puts(string) 33 | stream.flush 34 | end 35 | 36 | # write to log as though Verbosity::OBNOXIOUS 37 | @loginator.log( string, @streaminator_helper.extract_name(stream) ) 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/streaminator_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | class StreaminatorHelper 3 | 4 | def extract_name(stream) 5 | name = case (stream.fileno) 6 | when 0 then '#' 7 | when 1 then '#' 8 | when 2 then '#' 9 | else stream.inspect 10 | end 11 | 12 | return name 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/system_utils.rb: -------------------------------------------------------------------------------- 1 | 2 | class Object 3 | def deep_clone 4 | Marshal::load(Marshal.dump(self)) 5 | end 6 | end 7 | 8 | 9 | class SystemUtils 10 | 11 | constructor :system_wrapper 12 | 13 | def setup 14 | @tcsh_shell = nil 15 | end 16 | 17 | def tcsh_shell? 18 | # once run a single time, return state determined at that execution 19 | return @tcsh_shell if not @tcsh_shell.nil? 20 | 21 | result = @system_wrapper.shell_backticks('echo $version') 22 | 23 | if ((result[:exit_code] == 0) and (result[:output].strip =~ /^tcsh/)) 24 | @tcsh_shell = true 25 | else 26 | @tcsh_shell = false 27 | end 28 | 29 | return @tcsh_shell 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/system_wrapper.rb: -------------------------------------------------------------------------------- 1 | require 'rbconfig' 2 | 3 | class SystemWrapper 4 | 5 | # static method for use in defaults 6 | def self.windows? 7 | return ((RbConfig::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) if defined?(RbConfig) 8 | return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false) 9 | end 10 | 11 | # class method so as to be mockable for tests 12 | def windows? 13 | return SystemWrapper.windows? 14 | end 15 | 16 | def module_eval(string) 17 | return Object.module_eval("\"" + string + "\"") 18 | end 19 | 20 | def eval(string) 21 | return eval(string) 22 | end 23 | 24 | def search_paths 25 | return ENV['PATH'].split(File::PATH_SEPARATOR) 26 | end 27 | 28 | def cmdline_args 29 | return ARGV 30 | end 31 | 32 | def env_set(name, value) 33 | ENV[name] = value 34 | end 35 | 36 | def env_get(name) 37 | return ENV[name] 38 | end 39 | 40 | def time_now 41 | return Time.now.asctime 42 | end 43 | 44 | def shell_backticks(command) 45 | return { 46 | :output => `#{command}`.freeze, 47 | :exit_code => ($?.exitstatus).freeze 48 | } 49 | end 50 | 51 | def shell_system(command) 52 | system( command ) 53 | return { 54 | :output => ''.freeze, 55 | :exit_code => ($?.exitstatus).freeze 56 | } 57 | end 58 | 59 | def add_load_path(path) 60 | $LOAD_PATH.unshift(path) 61 | end 62 | 63 | def require_file(path) 64 | require(path) 65 | end 66 | 67 | def ruby_success 68 | return ($!.nil? || $!.is_a?(SystemExit) && $!.success?) 69 | end 70 | 71 | def constants_include?(item) 72 | # forcing to strings provides consistency across Ruby versions 73 | return Object.constants.map{|constant| constant.to_s}.include?(item.to_s) 74 | end 75 | 76 | end 77 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/target_loader.rb: -------------------------------------------------------------------------------- 1 | module TargetLoader 2 | class NoTargets < Exception; end 3 | class NoDirectory < Exception; end 4 | class NoDefault < Exception; end 5 | class NoSuchTarget < Exception; end 6 | 7 | class RequestReload < Exception; end 8 | 9 | def self.inspect(config, target_name=nil) 10 | unless config[:targets] 11 | raise NoTargets 12 | end 13 | 14 | targets = config[:targets] 15 | unless targets[:targets_directory] 16 | raise NoDirectory("No targets directory specified.") 17 | end 18 | unless targets[:default_target] 19 | raise NoDefault("No default target specified.") 20 | end 21 | 22 | target_path = lambda {|name| File.join(targets[:targets_directory], name + ".yml")} 23 | 24 | target = if target_name 25 | target_path.call(target_name) 26 | else 27 | target_path.call(targets[:default_target]) 28 | end 29 | 30 | unless File.exists? target 31 | raise NoSuchTarget.new("No such target: #{target}") 32 | end 33 | 34 | ENV['CEEDLING_MAIN_PROJECT_FILE'] = target 35 | 36 | raise RequestReload 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/task_invoker.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/par_map' 2 | 3 | class TaskInvoker 4 | 5 | constructor :dependinator, :rake_utils, :rake_wrapper 6 | 7 | def setup 8 | @test_regexs = [/^#{TEST_ROOT_NAME}:/] 9 | @release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/] 10 | end 11 | 12 | def add_test_task_regex(regex) 13 | @test_regexs << regex 14 | end 15 | 16 | def add_release_task_regex(regex) 17 | @release_regexs << regex 18 | end 19 | 20 | def test_invoked? 21 | invoked = false 22 | 23 | @test_regexs.each do |regex| 24 | invoked = true if (@rake_utils.task_invoked?(regex)) 25 | break if invoked 26 | end 27 | 28 | return invoked 29 | end 30 | 31 | def release_invoked? 32 | invoked = false 33 | 34 | @release_regexs.each do |regex| 35 | invoked = true if (@rake_utils.task_invoked?(regex)) 36 | break if invoked 37 | end 38 | 39 | return invoked 40 | end 41 | 42 | def invoked?(regex) 43 | return @rake_utils.task_invoked?(regex) 44 | end 45 | 46 | 47 | def invoke_test_mocks(mocks) 48 | @dependinator.enhance_mock_dependencies( mocks ) 49 | mocks.each { |mock| @rake_wrapper[mock].invoke } 50 | end 51 | 52 | def invoke_test_runner(runner) 53 | @dependinator.enhance_runner_dependencies( runner ) 54 | @rake_wrapper[runner].invoke 55 | end 56 | 57 | def invoke_test_shallow_include_lists(files) 58 | @dependinator.enhance_shallow_include_lists_dependencies( files ) 59 | files.each { |file| @rake_wrapper[file].invoke } 60 | end 61 | 62 | def invoke_test_preprocessed_files(files) 63 | @dependinator.enhance_preprocesed_file_dependencies( files ) 64 | files.each { |file| @rake_wrapper[file].invoke } 65 | end 66 | 67 | def invoke_test_dependencies_files(files) 68 | @dependinator.enhance_dependencies_dependencies( files ) 69 | files.each { |file| @rake_wrapper[file].invoke } 70 | end 71 | 72 | def invoke_test_results(result) 73 | @dependinator.enhance_results_dependencies( result ) 74 | @rake_wrapper[result].invoke 75 | end 76 | 77 | def invoke_release_dependencies_files(files) 78 | par_map(PROJECT_COMPILE_THREADS, files) do |file| 79 | @rake_wrapper[file].invoke 80 | end 81 | end 82 | 83 | def invoke_release_objects(objects) 84 | par_map(PROJECT_COMPILE_THREADS, objects) do |object| 85 | @rake_wrapper[object].invoke 86 | end 87 | end 88 | 89 | end 90 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_base.rake: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | require 'ceedling/file_path_utils' 3 | require 'ceedling/version' 4 | 5 | desc "Display build environment version info." 6 | task :version do 7 | puts " Ceedling:: #{Ceedling::Version::CEEDLING}" 8 | 9 | [ 10 | ['CException', File.join( CEEDLING_VENDOR, CEXCEPTION_ROOT_PATH)], 11 | [' CMock', File.join( CEEDLING_VENDOR, CMOCK_ROOT_PATH)], 12 | [' Unity', File.join( CEEDLING_VENDOR, UNITY_ROOT_PATH)], 13 | ].each do |tool| 14 | name = tool[0] 15 | base_path = tool[1] 16 | 17 | version_string = begin 18 | @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'version.info') ).strip 19 | rescue 20 | "UNKNOWN" 21 | end 22 | build_string = begin 23 | @ceedling[:file_wrapper].read( File.join(base_path, 'release', 'build.info') ).strip 24 | rescue 25 | "UNKNOWN" 26 | end 27 | puts "#{name}:: #{version_string.empty? ? '#.#.' : (version_string + '.')}#{build_string.empty? ? '?' : build_string}" 28 | end 29 | end 30 | 31 | desc "Set verbose output (silent:[#{Verbosity::SILENT}] - obnoxious:[#{Verbosity::OBNOXIOUS}])." 32 | task :verbosity, :level do |t, args| 33 | verbosity_level = args.level.to_i 34 | 35 | if (PROJECT_USE_MOCKS) 36 | # don't store verbosity level in setupinator's config hash, use a copy; 37 | # otherwise, the input configuration will change and trigger entire project rebuilds 38 | hash = @ceedling[:setupinator].config_hash[:cmock].clone 39 | hash[:verbosity] = verbosity_level 40 | 41 | @ceedling[:cmock_builder].manufacture( hash ) 42 | end 43 | 44 | @ceedling[:configurator].project_verbosity = verbosity_level 45 | 46 | # control rake's verbosity with new setting 47 | verbose( ((verbosity_level >= Verbosity::OBNOXIOUS) ? true : false) ) 48 | end 49 | 50 | desc "Enable logging" 51 | task :logging do 52 | @ceedling[:configurator].project_logging = true 53 | end 54 | 55 | # non advertised debug task 56 | task :debug do 57 | Rake::Task[:verbosity].invoke(Verbosity::DEBUG) 58 | Rake.application.options.trace = true 59 | @ceedling[:configurator].project_debug = true 60 | end 61 | 62 | # non advertised sanity checking task 63 | task :sanity_checks, :level do |t, args| 64 | check_level = args.level.to_i 65 | @ceedling[:configurator].sanity_checks = check_level 66 | end 67 | 68 | # list expanded environment variables 69 | if (not ENVIRONMENT.empty?) 70 | desc "List all configured environment variables." 71 | task :environment do 72 | ENVIRONMENT.each do |env| 73 | env.each_key do |key| 74 | name = key.to_s.upcase 75 | puts " - #{name}: \"#{env[key]}\"" 76 | end 77 | end 78 | end 79 | end 80 | 81 | namespace :options do 82 | 83 | COLLECTION_PROJECT_OPTIONS.each do |option_path| 84 | option = File.basename(option_path, '.yml') 85 | 86 | desc "Merge #{option} project options." 87 | task option.downcase.to_sym do 88 | # @ceedling[:setupinator].reset_defaults( @ceedling[:setupinator].config_hash ) 89 | hash = @ceedling[:project_config_manager].merge_options( @ceedling[:setupinator].config_hash, option_path ) 90 | @ceedling[:setupinator].do_setup( hash ) 91 | end 92 | end 93 | 94 | end 95 | 96 | 97 | # do not present task if there's no plugins 98 | if (not PLUGINS_ENABLED.empty?) 99 | desc "Execute plugin result summaries (no build triggering)." 100 | task :summary do 101 | @ceedling[:plugin_manager].summary 102 | puts "\nNOTE: Summaries may be out of date with project sources.\n\n" 103 | end 104 | end 105 | 106 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_filesystem.rake: -------------------------------------------------------------------------------- 1 | 2 | # rather than require 'rake/clean' & try to override, we replicate for finer control 3 | CLEAN = Rake::FileList["**/*~", "**/*.bak"] 4 | CLOBBER = Rake::FileList.new 5 | 6 | CLEAN.clear_exclude.exclude { |fn| fn.pathmap("%f") == 'core' && File.directory?(fn) } 7 | 8 | CLEAN.include(File.join(PROJECT_TEST_BUILD_OUTPUT_PATH, '*')) 9 | CLEAN.include(File.join(PROJECT_TEST_RESULTS_PATH, '*')) 10 | CLEAN.include(File.join(PROJECT_TEST_DEPENDENCIES_PATH, '*')) 11 | CLEAN.include(File.join(PROJECT_BUILD_RELEASE_ROOT, '*.*')) 12 | CLEAN.include(File.join(PROJECT_RELEASE_BUILD_OUTPUT_PATH, '*')) 13 | CLEAN.include(File.join(PROJECT_RELEASE_DEPENDENCIES_PATH, '*')) 14 | 15 | CLOBBER.include(File.join(PROJECT_BUILD_ARTIFACTS_ROOT, '**/*')) 16 | CLOBBER.include(File.join(PROJECT_BUILD_TESTS_ROOT, '**/*')) 17 | CLOBBER.include(File.join(PROJECT_BUILD_RELEASE_ROOT, '**/*')) 18 | CLOBBER.include(File.join(PROJECT_LOG_PATH, '**/*')) 19 | CLOBBER.include(File.join(PROJECT_TEMP_PATH, '**/*')) 20 | 21 | # because of cmock config, mock path can optionally exist apart from standard test build paths 22 | CLOBBER.include(File.join(CMOCK_MOCK_PATH, '*')) 23 | 24 | REMOVE_FILE_PROC = Proc.new { |fn| rm_r fn rescue nil } 25 | 26 | # redefine clean so we can override how it advertises itself 27 | desc "Delete all build artifacts and temporary products." 28 | task(:clean) do 29 | # because :clean is a prerequisite for :clobber, intelligently display the progress message 30 | if (not @ceedling[:task_invoker].invoked?(/^clobber$/)) 31 | @ceedling[:streaminator].stdout_puts("\nCleaning build artifacts...\n(For large projects, this task may take a long time to complete)\n\n") 32 | end 33 | CLEAN.each { |fn| REMOVE_FILE_PROC.call(fn) } 34 | end 35 | 36 | # redefine clobber so we can override how it advertises itself 37 | desc "Delete all generated files (and build artifacts)." 38 | task(:clobber => [:clean]) do 39 | @ceedling[:streaminator].stdout_puts("\nClobbering all generated files...\n(For large projects, this task may take a long time to complete)\n\n") 40 | CLOBBER.each { |fn| REMOVE_FILE_PROC.call(fn) } 41 | end 42 | 43 | 44 | PROJECT_BUILD_PATHS.each { |path| directory(path) } 45 | 46 | # create directories that hold build output and generated files & touching rebuild dependency sources 47 | task(:directories => PROJECT_BUILD_PATHS) { @ceedling[:dependinator].touch_force_rebuild_files } 48 | 49 | 50 | # list paths discovered at load time 51 | namespace :paths do 52 | 53 | paths = @ceedling[:setupinator].config_hash[:paths] 54 | paths.each_key do |section| 55 | name = section.to_s.downcase 56 | path_list = Object.const_get("COLLECTION_PATHS_#{name.upcase}") 57 | 58 | if (path_list.size != 0) 59 | desc "List all collected #{name} paths." 60 | task(name.to_sym) { puts "#{name} paths:"; path_list.sort.each {|path| puts " - #{path}" } } 61 | end 62 | end 63 | 64 | end 65 | 66 | 67 | # list files & file counts discovered at load time 68 | namespace :files do 69 | 70 | categories = [ 71 | ['test', COLLECTION_ALL_TESTS], 72 | ['source', COLLECTION_ALL_SOURCE], 73 | ['header', COLLECTION_ALL_HEADERS] 74 | ] 75 | categories << ['assembly', COLLECTION_ALL_ASSEMBLY] if (RELEASE_BUILD_USE_ASSEMBLY) 76 | 77 | categories.each do |category| 78 | name = category[0] 79 | collection = category[1] 80 | 81 | desc "List all collected #{name} files." 82 | task(name.to_sym) do 83 | puts "#{name} files:" 84 | collection.sort.each { |filepath| puts " - #{filepath}" } 85 | puts "file count: #{collection.size}" 86 | end 87 | end 88 | 89 | end 90 | 91 | 92 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_release.rake: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | require 'ceedling/file_path_utils' 3 | 4 | 5 | desc "Build release target." 6 | task RELEASE_SYM => [:directories] do 7 | header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'" 8 | @ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}") 9 | 10 | begin 11 | @ceedling[:plugin_manager].pre_release 12 | 13 | core_objects = [] 14 | extra_objects = @ceedling[:file_path_utils].form_release_build_c_objects_filelist( COLLECTION_RELEASE_ARTIFACT_EXTRA_LINK_OBJECTS ) 15 | 16 | @ceedling[:project_config_manager].process_release_config_change 17 | core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) ) 18 | 19 | # if assembler use isn't enabled, COLLECTION_ALL_ASSEMBLY is empty array & nothing happens 20 | core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) ) 21 | 22 | file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects) ) 23 | Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke 24 | ensure 25 | @ceedling[:plugin_manager].post_release 26 | end 27 | end 28 | 29 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_release_deep_dependencies.rake: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | namespace REFRESH_SYM do 4 | 5 | task RELEASE_SYM do 6 | @ceedling[:release_invoker].refresh_c_deep_dependencies 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_tests.rake: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | namespace TEST_SYM do 5 | 6 | desc "Run all unit tests." 7 | task :all => [:directories] do 8 | @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS) 9 | end 10 | 11 | desc "Run single test ([*] real test or source file name, no path)." 12 | task :* do 13 | message = "\nOops! '#{TEST_ROOT_NAME}:*' isn't a real task. " + 14 | "Use a real test or source file name (no path) in place of the wildcard.\n" + 15 | "Example: rake #{TEST_ROOT_NAME}:foo.c\n\n" 16 | 17 | @ceedling[:streaminator].stdout_puts( message ) 18 | end 19 | 20 | desc "Run tests for changed files." 21 | task :delta => [:directories] do 22 | @ceedling[:test_invoker].setup_and_invoke(COLLECTION_ALL_TESTS, TEST_SYM, {:force_run => false}) 23 | end 24 | 25 | desc "Run tests by matching regular expression pattern." 26 | task :pattern, [:regex] => [:directories] do |t, args| 27 | matches = [] 28 | 29 | COLLECTION_ALL_TESTS.each { |test| matches << test if (test =~ /#{args.regex}/) } 30 | 31 | if (matches.size > 0) 32 | @ceedling[:test_invoker].setup_and_invoke(matches, TEST_SYM, {:force_run => false}) 33 | else 34 | @ceedling[:streaminator].stdout_puts("\nFound no tests matching pattern /#{args.regex}/.") 35 | end 36 | end 37 | 38 | desc "Run tests whose test path contains [dir] or [dir] substring." 39 | task :path, [:dir] => [:directories] do |t, args| 40 | matches = [] 41 | 42 | COLLECTION_ALL_TESTS.each { |test| matches << test if File.dirname(test).include?(args.dir.gsub(/\\/, '/')) } 43 | 44 | if (matches.size > 0) 45 | @ceedling[:test_invoker].setup_and_invoke(matches, TEST_SYM, {:force_run => false}) 46 | else 47 | @ceedling[:streaminator].stdout_puts("\nFound no tests including the given path or path component.") 48 | end 49 | end 50 | 51 | end 52 | 53 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_tests_deep_dependencies.rake: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | namespace REFRESH_SYM do 4 | 5 | task TEST_SYM do 6 | @ceedling[:test_invoker].refresh_deep_dependencies 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/tasks_vendor.rake: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | require 'ceedling/file_path_utils' 3 | 4 | # create file dependencies to ensure C-based components of vendor tools are recompiled when they are updated with new versions 5 | # forming these explicitly rather than depend on auxiliary dependencies so all scenarios are explicitly covered 6 | 7 | file( @ceedling[:file_path_utils].form_test_build_object_filepath( UNITY_C_FILE ) => [ 8 | File.join( UNITY_VENDOR_PATH, UNITY_LIB_PATH, UNITY_C_FILE ), 9 | File.join( UNITY_VENDOR_PATH, UNITY_LIB_PATH, UNITY_H_FILE ), 10 | File.join( UNITY_VENDOR_PATH, UNITY_LIB_PATH, UNITY_INTERNALS_H_FILE ) ] 11 | ) 12 | 13 | 14 | if (PROJECT_USE_MOCKS) 15 | file( @ceedling[:file_path_utils].form_test_build_object_filepath( CMOCK_C_FILE ) => [ 16 | File.join( CMOCK_VENDOR_PATH, CMOCK_LIB_PATH, CMOCK_C_FILE ), 17 | File.join( CMOCK_VENDOR_PATH, CMOCK_LIB_PATH, CMOCK_H_FILE ) ] 18 | ) 19 | end 20 | 21 | 22 | if (PROJECT_USE_EXCEPTIONS) 23 | file( @ceedling[:file_path_utils].form_test_build_object_filepath( CEXCEPTION_C_FILE ) => [ 24 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), 25 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] 26 | ) 27 | end 28 | 29 | 30 | if (PROJECT_USE_EXCEPTIONS and PROJECT_RELEASE_BUILD) 31 | file( @ceedling[:file_path_utils].form_release_build_c_object_filepath( CEXCEPTION_C_FILE ) => [ 32 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_C_FILE ), 33 | File.join( CEXCEPTION_VENDOR_PATH, CEXCEPTION_LIB_PATH, CEXCEPTION_H_FILE ) ] 34 | ) 35 | end 36 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/test_includes_extractor.rb: -------------------------------------------------------------------------------- 1 | 2 | class TestIncludesExtractor 3 | 4 | constructor :configurator, :yaml_wrapper, :file_wrapper 5 | 6 | 7 | def setup 8 | @includes = {} 9 | @mocks = {} 10 | end 11 | 12 | 13 | # for includes_list file, slurp up array from yaml file and sort & store includes 14 | def parse_includes_list(includes_list) 15 | gather_and_store_includes( includes_list, @yaml_wrapper.load(includes_list) ) 16 | end 17 | 18 | # open, scan for, and sort & store includes of test file 19 | def parse_test_file(test) 20 | gather_and_store_includes( test, extract_from_file(test) ) 21 | end 22 | 23 | # mocks with no file extension 24 | def lookup_raw_mock_list(test) 25 | file_key = form_file_key(test) 26 | return [] if @mocks[file_key].nil? 27 | return @mocks[file_key] 28 | end 29 | 30 | # includes with file extension 31 | def lookup_includes_list(file) 32 | file_key = form_file_key(file) 33 | return [] if (@includes[file_key]).nil? 34 | return @includes[file_key] 35 | end 36 | 37 | private ################################# 38 | 39 | def form_file_key(filepath) 40 | return File.basename(filepath).to_sym 41 | end 42 | 43 | def extract_from_file(file) 44 | includes = [] 45 | header_extension = @configurator.extension_header 46 | 47 | contents = @file_wrapper.read(file) 48 | 49 | # remove line comments 50 | contents = contents.gsub(/\/\/.*$/, '') 51 | # remove block comments 52 | contents = contents.gsub(/\/\*.*?\*\//m, '') 53 | 54 | contents.split("\n").each do |line| 55 | # look for include statement 56 | scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/) 57 | 58 | includes << scan_results[0][0] if (scan_results.size > 0) 59 | end 60 | 61 | return includes.uniq 62 | end 63 | 64 | def gather_and_store_includes(file, includes) 65 | mock_prefix = @configurator.cmock_mock_prefix 66 | header_extension = @configurator.extension_header 67 | file_key = form_file_key(file) 68 | @mocks[file_key] = [] 69 | 70 | # add includes to lookup hash 71 | @includes[file_key] = includes 72 | 73 | includes.each do |include_file| 74 | # check if include is a mock 75 | scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/) 76 | # add mock to lookup hash 77 | @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0) 78 | end 79 | end 80 | 81 | end 82 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/test_invoker.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/constants' 2 | 3 | 4 | class TestInvoker 5 | 6 | attr_reader :sources, :tests, :mocks 7 | 8 | constructor :configurator, 9 | :test_invoker_helper, 10 | :plugin_manager, 11 | :streaminator, 12 | :preprocessinator, 13 | :task_invoker, 14 | :dependinator, 15 | :project_config_manager, 16 | :build_invoker_utils, 17 | :file_path_utils, 18 | :file_wrapper 19 | 20 | def setup 21 | @sources = [] 22 | @tests = [] 23 | @mocks = [] 24 | end 25 | 26 | def setup_and_invoke(tests, context=TEST_SYM, options={:force_run => true}) 27 | 28 | @tests = tests 29 | 30 | @project_config_manager.process_test_config_change 31 | 32 | @tests.each do |test| 33 | # announce beginning of test run 34 | header = "Test '#{File.basename(test)}'" 35 | @streaminator.stdout_puts("\n\n#{header}\n#{'-' * header.length}") 36 | 37 | begin 38 | @plugin_manager.pre_test( test ) 39 | 40 | # collect up test fixture pieces & parts 41 | runner = @file_path_utils.form_runner_filepath_from_test( test ) 42 | mock_list = @preprocessinator.preprocess_test_and_invoke_test_mocks( test ) 43 | sources = @test_invoker_helper.extract_sources( test ) 44 | extras = @configurator.collection_test_fixture_extra_link_objects 45 | core = [test] + mock_list + sources 46 | objects = @file_path_utils.form_test_build_objects_filelist( [runner] + core + extras ) 47 | results_pass = @file_path_utils.form_pass_results_filepath( test ) 48 | results_fail = @file_path_utils.form_fail_results_filepath( test ) 49 | 50 | # clean results files so we have a missing file with which to kick off rake's dependency rules 51 | @test_invoker_helper.clean_results( {:pass => results_pass, :fail => results_fail}, options ) 52 | 53 | # load up auxiliary dependencies so deep changes cause rebuilding appropriately 54 | @test_invoker_helper.process_deep_dependencies( core ) do |dependencies_list| 55 | @dependinator.load_test_object_deep_dependencies( dependencies_list ) 56 | end 57 | 58 | # tell rake to create test runner if needed 59 | @task_invoker.invoke_test_runner( runner ) 60 | 61 | # enhance object file dependencies to capture externalities influencing regeneration 62 | @dependinator.enhance_test_build_object_dependencies( objects ) 63 | 64 | # associate object files with executable 65 | @dependinator.setup_test_executable_dependencies( test, objects ) 66 | 67 | # 3, 2, 1... launch 68 | @task_invoker.invoke_test_results( results_pass ) 69 | rescue => e 70 | @build_invoker_utils.process_exception( e, context ) 71 | ensure 72 | @plugin_manager.post_test( test ) 73 | end 74 | 75 | # store away what's been processed 76 | @mocks.concat( mock_list ) 77 | @sources.concat( sources ) 78 | end 79 | 80 | # post-process collected mock list 81 | @mocks.uniq! 82 | 83 | # post-process collected sources list 84 | @sources.uniq! 85 | end 86 | 87 | 88 | def refresh_deep_dependencies 89 | @file_wrapper.rm_f( 90 | @file_wrapper.directory_listing( 91 | File.join( @configurator.project_test_dependencies_path, '*' + @configurator.extension_dependencies ) ) ) 92 | 93 | @test_invoker_helper.process_deep_dependencies( 94 | @configurator.collection_all_tests + @configurator.collection_all_source ) 95 | end 96 | 97 | end 98 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/test_invoker_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | class TestInvokerHelper 3 | 4 | constructor :configurator, :task_invoker, :test_includes_extractor, :file_finder, :file_path_utils, :file_wrapper 5 | 6 | def clean_results(results, options) 7 | @file_wrapper.rm_f( results[:fail] ) 8 | @file_wrapper.rm_f( results[:pass] ) if (options[:force_run]) 9 | end 10 | 11 | def process_deep_dependencies(files) 12 | return if (not @configurator.project_use_deep_dependencies) 13 | 14 | dependencies_list = @file_path_utils.form_test_dependencies_filelist( files ) 15 | @task_invoker.invoke_test_dependencies_files( dependencies_list ) 16 | yield( dependencies_list ) if block_given? 17 | end 18 | 19 | def extract_sources(test) 20 | sources = [] 21 | includes = @test_includes_extractor.lookup_includes_list(test) 22 | 23 | includes.each { |include| sources << @file_finder.find_compilation_input_file(include, :ignore) } 24 | 25 | return sources.compact 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/verbosinator.rb: -------------------------------------------------------------------------------- 1 | 2 | class Verbosinator 3 | 4 | constructor :configurator 5 | 6 | def should_output?(level) 7 | return (level <= @configurator.project_verbosity) 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/version.rb: -------------------------------------------------------------------------------- 1 | # @private 2 | module Ceedling 3 | module Version 4 | # @private 5 | GEM = "0.20.3" 6 | # @private 7 | CEEDLING = GEM 8 | # @private 9 | CEXCEPTION = "1.3.17" 10 | # @private 11 | CMOCK = "2.4.2" 12 | # @private 13 | UNITY = "2.3.2" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/version.rb.erb: -------------------------------------------------------------------------------- 1 | # @private 2 | module Ceedling 3 | module Version 4 | # @private 5 | GEM = "0.20.3" 6 | # @private 7 | CEEDLING = "<%= versions["CEEDLING"] %>" 8 | # @private 9 | CEXCEPTION = "<%= versions["CEXCEPTION"] %>" 10 | # @private 11 | CMOCK = "<%= versions["CMOCK"] %>" 12 | # @private 13 | UNITY = "<%= versions["UNITY"] %>" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /vendor/ceedling/lib/ceedling/yaml_wrapper.rb: -------------------------------------------------------------------------------- 1 | require 'yaml' 2 | require 'erb' 3 | 4 | 5 | class YamlWrapper 6 | 7 | def load(filepath) 8 | return YAML.load(ERB.new(File.read(filepath)).result) 9 | end 10 | 11 | def dump(filepath, structure) 12 | File.open(filepath, 'w') do |output| 13 | YAML.dump(structure, output) 14 | end 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/bullseye/assets/template.erb: -------------------------------------------------------------------------------- 1 | % function_string = hash[:coverage][:functions].to_s 2 | % branch_string = hash[:coverage][:branches].to_s 3 | % format_string = "%#{[function_string.length, branch_string.length].max}i" 4 | <%=@ceedling[:plugin_reportinator].generate_banner("#{hash[:header]}: CODE COVERAGE SUMMARY")%> 5 | % if (!hash[:coverage][:functions].nil?) 6 | FUNCTIONS: <%=sprintf(format_string, hash[:coverage][:functions])%>% 7 | % else 8 | FUNCTIONS: none 9 | % end 10 | % if (!hash[:coverage][:branches].nil?) 11 | BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>% 12 | % else 13 | BRANCHES: none 14 | % end 15 | 16 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/bullseye/config/defaults.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | :paths: 4 | :bullseye_toolchain_include: [] 5 | 6 | :tools: 7 | :bullseye_instrumentation: 8 | :executable: covc 9 | :arguments: 10 | - '--file $': ENVIRONMENT_COVFILE 11 | - -q 12 | - ${1} 13 | :bullseye_compiler: 14 | :executable: gcc 15 | :arguments: 16 | - -g 17 | - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR 18 | - -I"$": COLLECTION_PATHS_BULLSEYE_TOOLCHAIN_INCLUDE 19 | - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR 20 | - -DBULLSEYE_COMPILER 21 | - -c "${1}" 22 | - -o "${2}" 23 | :bullseye_linker: 24 | :executable: gcc 25 | :arguments: 26 | - ${1} 27 | - -o ${2} 28 | - -L$: PLUGINS_BULLSEYE_LIB_PATH 29 | - -lcov 30 | :bullseye_fixture: 31 | :executable: ${1} 32 | :bullseye_report_covsrc: 33 | :executable: covsrc 34 | :arguments: 35 | - '--file $': ENVIRONMENT_COVFILE 36 | - -q 37 | - -w140 38 | :bullseye_report_covfn: 39 | :executable: covfn 40 | :stderr_redirect: :auto 41 | :arguments: 42 | - '--file $': ENVIRONMENT_COVFILE 43 | - --width 120 44 | - --no-source 45 | - '"${1}"' 46 | :bullseye_browser: 47 | :executable: CoverageBrowser 48 | :background_exec: :auto 49 | :optional: TRUE 50 | :arguments: 51 | - '"$"': ENVIRONMENT_COVFILE 52 | 53 | ... 54 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/bullseye/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/vendor/ceedling/plugins/bullseye/readme.txt -------------------------------------------------------------------------------- /vendor/ceedling/plugins/gcov/defaults.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | :tools: 4 | :gcov_compiler: 5 | :executable: gcc 6 | :arguments: 7 | - -g 8 | - -fprofile-arcs 9 | - -ftest-coverage 10 | - -I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR 11 | - -I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE 12 | - -D$: COLLECTION_DEFINES_TEST_AND_VENDOR 13 | - -DGCOV_COMPILER 14 | - -c "${1}" 15 | - -o "${2}" 16 | :gcov_linker: 17 | :executable: gcc 18 | :arguments: 19 | - -fprofile-arcs 20 | - -ftest-coverage 21 | - ${1} 22 | - -o ${2} 23 | :gcov_fixture: 24 | :executable: ${1} 25 | :gcov_report: 26 | :executable: gcov 27 | :arguments: 28 | - -n 29 | - -p 30 | - -b 31 | - -o "$": GCOV_BUILD_OUTPUT_PATH 32 | - "\"${1}\"" 33 | 34 | ... 35 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/gcov/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronVector/add-ceedling-to-existing-project/a37715189c94767c8c7462b4f08975d1fe0da3d4/vendor/ceedling/plugins/gcov/readme.txt -------------------------------------------------------------------------------- /vendor/ceedling/plugins/gcov/template.erb: -------------------------------------------------------------------------------- 1 | % function_string = hash[:coverage][:functions].to_s 2 | % branch_string = hash[:coverage][:branches].to_s 3 | % format_string = "%#{[function_string.length, branch_string.length].max}i" 4 | <%=@ceedling[:plugin_reportinator].generate_banner("#{BULLSEYE_ROOT_NAME.upcase}: CODE COVERAGE SUMMARY")%> 5 | % if (!hash[:coverage][:functions].nil?) 6 | FUNCTIONS: <%=sprintf(format_string, hash[:coverage][:functions])%>% 7 | % else 8 | FUNCTIONS: none 9 | % end 10 | % if (!hash[:coverage][:branches].nil?) 11 | BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>% 12 | % else 13 | BRANCHES: none 14 | % end 15 | 16 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/module_generator/config/module_generator.yml: -------------------------------------------------------------------------------- 1 | :module_generator: 2 | :project_root: ./ 3 | :source_root: src/ 4 | :test_root: test/ -------------------------------------------------------------------------------- /vendor/ceedling/plugins/module_generator/module_generator.rake: -------------------------------------------------------------------------------- 1 | 2 | namespace :module do 3 | 4 | desc "Generate module (source, header and test files)" 5 | task :create, :module_path do |t, args| 6 | @ceedling[:module_generator].create(args[:module_path]) 7 | end 8 | 9 | desc "Destroy module (source, header and test files)" 10 | task :destroy, :module_path do |t, args| 11 | @ceedling[:module_generator].create(args[:module_path], {:destroy => true}) 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_gtestlike_tests_report/assets/template.erb: -------------------------------------------------------------------------------- 1 | % ignored = hash[:results][:counts][:ignored] 2 | % failed = hash[:results][:counts][:failed] 3 | % stdout_count = hash[:results][:counts][:stdout] 4 | % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') 5 | % banner_width = 25 + header_prepend.length # widest message 6 | % results = {} 7 | % hash[:results][:successes].each do |testresult| 8 | % results[ testresult[:source][:file] ] = testresult[:collection] 9 | % results[ testresult[:source][:file] ].length.times do |i| 10 | % results[ testresult[:source][:file] ][i][:pass] = true 11 | % end 12 | % end 13 | % hash[:results][:ignores].each do |testresult| 14 | % if (results[ testresult[:source][:file] ].nil?) 15 | % results[ testresult[:source][:file] ] = testresult[:collection] 16 | % else 17 | % results[ testresult[:source][:file] ] += testresult[:collection] 18 | % end 19 | % results[ testresult[:source][:file] ].length.times do |i| 20 | % results[ testresult[:source][:file] ][i][:pass] = true 21 | % end 22 | % end 23 | % hash[:results][:failures].each do |testresult| 24 | % if (results[ testresult[:source][:file] ].nil?) 25 | % results[ testresult[:source][:file] ] = testresult[:collection] 26 | % else 27 | % results[ testresult[:source][:file] ] += testresult[:collection] 28 | % end 29 | % end 30 | 31 | 32 | [==========] Running <%=hash[:results][:counts][:total].to_s%> tests from <%=results.length.to_s%> test cases. 33 | [----------] Global test environment set-up. 34 | % results.each_pair do |modulename, moduledetails| 35 | [----------] <%=moduledetails.length.to_s%> tests from <%=modulename%> 36 | % moduledetails.each do |item| 37 | [ RUN ] <%=modulename%>.<%=item[:test]%> 38 | % if (not item[:pass]) 39 | % if (not item[:message].empty?) 40 | <%=modulename%>(<%=item[:line]%>): error: <%=item[:message]%> 41 | 42 | % m = item[:message].match(/Expected\s+(.*)\s+Was\s+([^\.]*)\./) 43 | % if m.nil? 44 | Actual: FALSE 45 | Expected: TRUE 46 | % else 47 | Actual: <%=m[2]%> 48 | Expected: <%=m[1]%> 49 | % end 50 | % else 51 | <%=modulename%>(<%=item[:line]%>): fail: <%=item[:message]%> 52 | Actual: FALSE 53 | Expected: TRUE 54 | % end 55 | [ FAILED ] <%=modulename%>.<%=item[:test]%> (0 ms) 56 | % else 57 | [ OK ] <%=modulename%>.<%=item[:test]%> (0 ms) 58 | % end 59 | % end 60 | [----------] <%=moduledetails.length.to_s%> tests from <%=modulename%> (0 ms total) 61 | % end 62 | 63 | % if (hash[:results][:counts][:total] > 0) 64 | [----------] Global test environment tear-down. 65 | [==========] <%=hash[:results][:counts][:total].to_s%> tests from <%=hash[:results][:stdout].length.to_s%> test cases ran. 66 | [ PASSED ] <%=hash[:results][:counts][:passed].to_s%> tests. 67 | % if (failed == 0) 68 | [ FAILED ] 0 tests. 69 | 70 | 0 FAILED TESTS 71 | % else 72 | [ FAILED ] <%=failed.to_s%> tests, listed below: 73 | % hash[:results][:failures].each do |failure| 74 | % failure[:collection].each do |item| 75 | [ FAILED ] <%=failure[:source][:file]%>.<%=item[:test]%> 76 | % end 77 | % end 78 | % end 79 | 80 | <%=failed.to_s%> FAILED TESTS 81 | % else 82 | 83 | No tests executed. 84 | % end 85 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_gtestlike_tests_report/assets/template.erb copy: -------------------------------------------------------------------------------- 1 | % ignored = hash[:results][:counts][:ignored] 2 | % failed = hash[:results][:counts][:failed] 3 | % stdout_count = hash[:results][:counts][:stdout] 4 | % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') 5 | % banner_width = 25 + header_prepend.length # widest message 6 | 7 | 8 | % if (stdout_count > 0) 9 | [==========] Running <%=hash[:results][:counts][:total].to_s%> tests from <%=hash[:results][:stdout].length.to_s%> test cases. 10 | [----------] Global test environment set-up. 11 | % end 12 | % if (failed > 0) 13 | % hash[:results][:failures].each do |failure| 14 | [----------] <%=failure[:collection].length.to_s%> tests from <%=failure[:source][:file]%> 15 | % failure[:collection].each do |item| 16 | [ RUN ] <%=failure[:source][:file]%>.<%=item[:test]%> 17 | % if (not item[:message].empty?) 18 | <%=failure[:source][:file]%>(<%=item[:line]%>): error: <%=item[:message]%> 19 | 20 | % m = item[:message].match(/Expected\s+(.*)\s+Was\s+([^\.]*)\./) 21 | % if m.nil? 22 | Actual: FALSE 23 | Expected: TRUE 24 | % else 25 | Actual: <%=m[2]%> 26 | Expected: <%=m[1]%> 27 | % end 28 | % else 29 | <%=failure[:source][:file]%>(<%=item[:line]%>): fail: <%=item[:message]%> 30 | Actual: FALSE 31 | Expected: TRUE 32 | % end 33 | [ FAILED ] <%=failure[:source][:file]%>.<%=item[:test]%> (0 ms) 34 | % end 35 | [----------] <%=failure[:collection].length.to_s%> tests from <%=failure[:source][:file]%> (0 ms total) 36 | % end 37 | % end 38 | % if (hash[:results][:counts][:total] > 0) 39 | [----------] Global test environment tear-down. 40 | [==========] <%=hash[:results][:counts][:total].to_s%> tests from <%=hash[:results][:stdout].length.to_s%> test cases ran. 41 | [ PASSED ] <%=hash[:results][:counts][:passed].to_s%> tests. 42 | % if (failed == 0) 43 | [ FAILED ] 0 tests. 44 | 45 | 0 FAILED TESTS 46 | % else 47 | [ FAILED ] <%=failed.to_s%> tests, listed below: 48 | % hash[:results][:failures].each do |failure| 49 | % failure[:collection].each do |item| 50 | [ FAILED ] <%=failure[:source][:file]%>.<%=item[:test]%> 51 | % end 52 | % end 53 | 54 | <%=failed.to_s%> FAILED TESTS 55 | % end 56 | % else 57 | 58 | No tests executed. 59 | % end 60 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :plugins: 3 | # tell Ceedling we got results display taken care of 4 | :display_raw_test_results: FALSE 5 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/plugin' 2 | require 'ceedling/defaults' 3 | 4 | class StdoutGtestlikeTestsReport < Plugin 5 | 6 | def setup 7 | @result_list = [] 8 | @plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) 9 | template = @ceedling[:file_wrapper].read(File.join(@plugin_root, 'assets/template.erb')) 10 | @ceedling[:plugin_reportinator].register_test_results_template( template ) 11 | end 12 | 13 | def post_test_fixture_execute(arg_hash) 14 | return if not (arg_hash[:context] == TEST_SYM) 15 | 16 | @result_list << arg_hash[:result_file] 17 | end 18 | 19 | def post_build 20 | return if not (@ceedling[:task_invoker].test_invoked?) 21 | 22 | results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) 23 | hash = { 24 | :header => '', 25 | :results => results 26 | } 27 | 28 | @ceedling[:plugin_reportinator].run_test_results_report(hash) 29 | end 30 | 31 | def summary 32 | result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) 33 | 34 | # get test results for only those tests in our configuration and of those only tests with results on disk 35 | hash = { 36 | :header => '', 37 | :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) 38 | } 39 | 40 | @ceedling[:plugin_reportinator].run_test_results_report(hash) 41 | end 42 | 43 | end 44 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_ide_tests_report/config/stdout_ide_tests_report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :plugins: 3 | # tell Ceedling we got results display taken care of 4 | :display_raw_test_results: FALSE 5 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/plugin' 2 | require 'ceedling/defaults' 3 | 4 | class StdoutIdeTestsReport < Plugin 5 | 6 | def setup 7 | @result_list = [] 8 | end 9 | 10 | def post_test_fixture_execute(arg_hash) 11 | return if not (arg_hash[:context] == TEST_SYM) 12 | 13 | @result_list << arg_hash[:result_file] 14 | end 15 | 16 | def post_build 17 | return if (not @ceedling[:task_invoker].test_invoked?) 18 | 19 | results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) 20 | hash = { 21 | :header => '', 22 | :results => results 23 | } 24 | 25 | @ceedling[:plugin_reportinator].run_test_results_report(hash) do 26 | message = '' 27 | message = 'Unit test failures.' if (hash[:results][:counts][:failed] > 0) 28 | message 29 | end 30 | end 31 | 32 | def summary 33 | result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) 34 | 35 | # get test results for only those tests in our configuration and of those only tests with results on disk 36 | hash = { 37 | :header => '', 38 | :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) 39 | } 40 | 41 | @ceedling[:plugin_reportinator].run_test_results_report(hash) 42 | end 43 | 44 | end 45 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_pretty_tests_report/assets/template.erb: -------------------------------------------------------------------------------- 1 | % ignored = hash[:results][:counts][:ignored] 2 | % failed = hash[:results][:counts][:failed] 3 | % stdout_count = hash[:results][:counts][:stdout] 4 | % header_prepend = ((hash[:header].length > 0) ? "#{hash[:header]}: " : '') 5 | % banner_width = 25 + header_prepend.length # widest message 6 | 7 | % if (stdout_count > 0) 8 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'TEST OUTPUT')%> 9 | % hash[:results][:stdout].each do |string| 10 | [<%=string[:source][:file]%>] 11 | % string[:collection].each do |item| 12 | - "<%=item%>" 13 | % end 14 | 15 | % end 16 | % end 17 | % if (ignored > 0) 18 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'IGNORED TEST SUMMARY')%> 19 | % hash[:results][:ignores].each do |ignore| 20 | [<%=ignore[:source][:file]%>] 21 | % ignore[:collection].each do |item| 22 | Test: <%=item[:test]%> 23 | % if (not item[:message].empty?) 24 | At line (<%=item[:line]%>): "<%=item[:message]%>" 25 | % else 26 | At line (<%=item[:line]%>) 27 | % end 28 | 29 | % end 30 | % end 31 | % end 32 | % if (failed > 0) 33 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'FAILED TEST SUMMARY')%> 34 | % hash[:results][:failures].each do |failure| 35 | [<%=failure[:source][:file]%>] 36 | % failure[:collection].each do |item| 37 | Test: <%=item[:test]%> 38 | % if (not item[:message].empty?) 39 | At line (<%=item[:line]%>): "<%=item[:message]%>" 40 | % else 41 | At line (<%=item[:line]%>) 42 | % end 43 | 44 | % end 45 | % end 46 | % end 47 | % total_string = hash[:results][:counts][:total].to_s 48 | % format_string = "%#{total_string.length}i" 49 | <%=@ceedling[:plugin_reportinator].generate_banner(header_prepend + 'OVERALL TEST SUMMARY')%> 50 | % if (hash[:results][:counts][:total] > 0) 51 | TESTED: <%=hash[:results][:counts][:total].to_s%> 52 | PASSED: <%=sprintf(format_string, hash[:results][:counts][:passed])%> 53 | FAILED: <%=sprintf(format_string, failed)%> 54 | IGNORED: <%=sprintf(format_string, ignored)%> 55 | % else 56 | 57 | No tests executed. 58 | % end 59 | 60 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_pretty_tests_report/config/stdout_pretty_tests_report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :plugins: 3 | # tell Ceedling we got results display taken care of 4 | :display_raw_test_results: FALSE 5 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/plugin' 2 | require 'ceedling/defaults' 3 | 4 | class StdoutPrettyTestsReport < Plugin 5 | 6 | def setup 7 | @result_list = [] 8 | @plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) 9 | template = @ceedling[:file_wrapper].read(File.join(@plugin_root, 'assets/template.erb')) 10 | @ceedling[:plugin_reportinator].register_test_results_template( template ) 11 | end 12 | 13 | def post_test_fixture_execute(arg_hash) 14 | return if not (arg_hash[:context] == TEST_SYM) 15 | 16 | @result_list << arg_hash[:result_file] 17 | end 18 | 19 | def post_build 20 | return if not (@ceedling[:task_invoker].test_invoked?) 21 | 22 | results = @ceedling[:plugin_reportinator].assemble_test_results(@result_list) 23 | hash = { 24 | :header => '', 25 | :results => results 26 | } 27 | 28 | @ceedling[:plugin_reportinator].run_test_results_report(hash) do 29 | message = '' 30 | message = 'Unit test failures.' if (results[:counts][:failed] > 0) 31 | message 32 | end 33 | end 34 | 35 | def summary 36 | result_list = @ceedling[:file_path_utils].form_pass_results_filelist( PROJECT_TEST_RESULTS_PATH, COLLECTION_ALL_TESTS ) 37 | 38 | # get test results for only those tests in our configuration and of those only tests with results on disk 39 | hash = { 40 | :header => '', 41 | :results => @ceedling[:plugin_reportinator].assemble_test_results(result_list, {:boom => false}) 42 | } 43 | 44 | @ceedling[:plugin_reportinator].run_test_results_report(hash) 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/teamcity_tests_report/config/teamcity_tests_report.yml: -------------------------------------------------------------------------------- 1 | --- 2 | :plugins: 3 | # tell Ceedling we got results display taken care of 4 | :display_raw_test_results: FALSE 5 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/plugin' 2 | require 'ceedling/defaults' 3 | 4 | class TeamcityTestsReport < Plugin 5 | 6 | def setup 7 | @suite_started = nil 8 | @output_enabled = !defined?(TEAMCITY_BUILD) || TEAMCITY_BUILD 9 | end 10 | 11 | def escape(string) 12 | string.gsub(/['|\[\]]/, '|\0').gsub('\r', '|r').gsub('\n', '|n') 13 | end 14 | 15 | def pre_test(test) 16 | teamcity_message "testSuiteStarted name='#{File.basename(test, '.c')}'" 17 | @suite_started = Time.now 18 | end 19 | 20 | def post_test(test) 21 | teamcity_message "testSuiteFinished name='#{File.basename(test, '.c')}'" 22 | end 23 | 24 | def post_test_fixture_execute(arg_hash) 25 | duration = (Time.now - @suite_started) * 1000 26 | results = @ceedling[:plugin_reportinator].assemble_test_results([arg_hash[:result_file]]) 27 | avg_duration = (duration / [1, results[:counts][:passed] + results[:counts][:failed]].max).round 28 | 29 | results[:successes].each do |success| 30 | success[:collection].each do |test| 31 | teamcity_message "testStarted name='#{test[:test]}'" 32 | teamcity_message "testFinished name='#{test[:test]}' duration='#{avg_duration}'" 33 | end 34 | end 35 | 36 | results[:failures].each do |failure| 37 | failure[:collection].each do |test| 38 | teamcity_message "testStarted name='#{test[:test]}'" 39 | teamcity_message "testFailed name='#{test[:test]}' message='#{escape(test[:message])}' details='File: #{failure[:source][:path]}/#{failure[:source][:file]} Line: #{test[:line]}'" 40 | teamcity_message "testFinished name='#{test[:test]}' duration='#{avg_duration}'" 41 | end 42 | end 43 | 44 | results[:ignores].each do |failure| 45 | failure[:collection].each do |test| 46 | teamcity_message "testIgnored name='#{test[:test]}' message='#{escape(test[:message])}'" 47 | end 48 | end 49 | 50 | # We ignore stdout 51 | end 52 | 53 | def teamcity_message(content) 54 | puts "##teamcity[#{content}]" unless !@output_enabled 55 | end 56 | 57 | end 58 | -------------------------------------------------------------------------------- /vendor/ceedling/plugins/warnings_report/warnings_report.rb: -------------------------------------------------------------------------------- 1 | require 'plugin' 2 | require 'constants' 3 | 4 | class WarningsReport < Plugin 5 | 6 | def setup 7 | @stderr_redirect = nil 8 | @log_paths = {} 9 | end 10 | 11 | def pre_compile_execute( arg_hash ) 12 | # at beginning of compile, override tool's stderr_redirect so we can parse $stderr + $stdout 13 | set_stderr_redirect( arg_hash ) 14 | end 15 | 16 | def post_compile_execute( arg_hash ) 17 | # after compilation, grab output for parsing/logging, restore stderr_redirect, log warning if it exists 18 | output = arg_hash[:shell_result][:output] 19 | restore_stderr_redirect( arg_hash ) 20 | write_warning_log( arg_hash[:context], output ) 21 | end 22 | 23 | def pre_link_execute( arg_hash ) 24 | # at beginning of link, override tool's stderr_redirect so we can parse $stderr + $stdout 25 | set_stderr_redirect( arg_hash ) 26 | end 27 | 28 | def post_link_execute( arg_hash ) 29 | # after linking, grab output for parsing/logging, restore stderr_redirect, log warning if it exists 30 | output = arg_hash[:shell_result][:output] 31 | restore_stderr_redirect( arg_hash ) 32 | write_warning_log( arg_hash[:context], output ) 33 | end 34 | 35 | private 36 | 37 | def set_stderr_redirect( hash ) 38 | @stderr_redirect = hash[:tool][:stderr_redirect] 39 | hash[:tool][:stderr_redirect] = StdErrRedirect::AUTO 40 | end 41 | 42 | def restore_stderr_redirect( hash ) 43 | hash[:tool][:stderr_redirect] = @stderr_redirect 44 | end 45 | 46 | def write_warning_log( context, output ) 47 | # if $stderr/$stdout contain "warning", log it 48 | if (output =~ /warning/i) 49 | # generate a log path & file io write flags 50 | logging = generate_log_path( context ) 51 | @ceedling[:file_wrapper].write( logging[:path], output + "\n", logging[:flags] ) if (not logging.nil?) 52 | end 53 | end 54 | 55 | def generate_log_path( context ) 56 | # if path has already been generated, return it & 'append' file io flags (append to log) 57 | return { :path => @log_paths[context], :flags => 'a' } if (not @log_paths[context].nil?) 58 | 59 | # first time through, generate path & 'write' file io flags (create new log) 60 | base_path = File.join( PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s ) 61 | file_path = File.join( base_path, 'warnings.log' ) 62 | 63 | if (@ceedling[:file_wrapper].exist?( base_path )) 64 | @log_paths[context] = file_path 65 | return { :path => file_path, :flags => 'w' } 66 | end 67 | 68 | return nil 69 | end 70 | 71 | end -------------------------------------------------------------------------------- /vendor/ceedling/plugins/xml_tests_report/xml_tests_report.rb: -------------------------------------------------------------------------------- 1 | require 'ceedling/plugin' 2 | require 'ceedling/constants' 3 | 4 | class XmlTestsReport < Plugin 5 | 6 | def setup 7 | @results_list = {} 8 | @test_counter = 0 9 | end 10 | 11 | def post_test_fixture_execute(arg_hash) 12 | context = arg_hash[:context] 13 | 14 | @results_list[context] = [] if (@results_list[context].nil?) 15 | 16 | @results_list[context] << arg_hash[:result_file] 17 | end 18 | 19 | def post_build 20 | @results_list.each_key do |context| 21 | results = @ceedling[:plugin_reportinator].assemble_test_results(@results_list[context]) 22 | 23 | file_path = File.join( PROJECT_BUILD_ARTIFACTS_ROOT, context.to_s, 'report.xml' ) 24 | 25 | @ceedling[:file_wrapper].open( file_path, 'w' ) do |f| 26 | @test_counter = 1 27 | write_results( results, f ) 28 | end 29 | end 30 | end 31 | 32 | private 33 | 34 | def write_results( results, stream ) 35 | write_header( stream ) 36 | write_failures( results[:failures], stream ) 37 | write_tests( results[:successes], stream, 'SuccessfulTests' ) 38 | write_tests( results[:ignores], stream, 'IgnoredTests' ) 39 | write_statistics( results[:counts], stream ) 40 | write_footer( stream ) 41 | end 42 | 43 | def write_header( stream ) 44 | stream.puts "" 45 | stream.puts "" 46 | end 47 | 48 | def write_failures( results, stream ) 49 | if (results.size == 0) 50 | stream.puts "\t" 51 | return 52 | end 53 | 54 | stream.puts "\t" 55 | 56 | results.each do |result| 57 | result[:collection].each do |item| 58 | filename = File.join( result[:source][:path], result[:source][:file] ) 59 | 60 | stream.puts "\t\t" 61 | stream.puts "\t\t\t#{filename}::#{item[:test]}" 62 | stream.puts "\t\t\tAssertion" 63 | stream.puts "\t\t\t" 64 | stream.puts "\t\t\t\t#{filename}" 65 | stream.puts "\t\t\t\t#{item[:line]}" 66 | stream.puts "\t\t\t" 67 | stream.puts "\t\t\t#{item[:message]}" 68 | stream.puts "\t\t" 69 | @test_counter += 1 70 | end 71 | end 72 | 73 | stream.puts "\t" 74 | end 75 | 76 | def write_tests( results, stream, tag ) 77 | if (results.size == 0) 78 | stream.puts "\t<#{tag}/>" 79 | return 80 | end 81 | 82 | stream.puts "\t<#{tag}>" 83 | 84 | results.each do |result| 85 | result[:collection].each do |item| 86 | stream.puts "\t\t" 87 | stream.puts "\t\t\t#{File.join( result[:source][:path], result[:source][:file] )}::#{item[:test]}" 88 | stream.puts "\t\t" 89 | @test_counter += 1 90 | end 91 | end 92 | 93 | stream.puts "\t" 94 | end 95 | 96 | def write_statistics( counts, stream ) 97 | stream.puts "\t" 98 | stream.puts "\t\t#{counts[:total]}" 99 | stream.puts "\t\t#{counts[:ignored]}" 100 | stream.puts "\t\t#{counts[:failed]}" 101 | stream.puts "\t\t0" 102 | stream.puts "\t\t#{counts[:failed]}" 103 | stream.puts "\t" 104 | end 105 | 106 | def write_footer( stream ) 107 | stream.puts "" 108 | end 109 | 110 | end 111 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/c_exception/lib/CException.c: -------------------------------------------------------------------------------- 1 | #include "CException.h" 2 | 3 | #pragma GCC diagnostic push 4 | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" 5 | volatile CEXCEPTION_FRAME_T CExceptionFrames[CEXCEPTION_NUM_ID] = {{ 0 }}; 6 | #pragma GCC diagnostic pop 7 | 8 | //------------------------------------------------------------------------------------------ 9 | // Throw 10 | //------------------------------------------------------------------------------------------ 11 | void Throw(CEXCEPTION_T ExceptionID) 12 | { 13 | unsigned int MY_ID = CEXCEPTION_GET_ID; 14 | CExceptionFrames[MY_ID].Exception = ExceptionID; 15 | if (CExceptionFrames[MY_ID].pFrame) 16 | { 17 | longjmp(*CExceptionFrames[MY_ID].pFrame, 1); 18 | } 19 | CEXCEPTION_NO_CATCH_HANDLER(ExceptionID); 20 | } 21 | 22 | //------------------------------------------------------------------------------------------ 23 | // Explanation of what it's all for: 24 | //------------------------------------------------------------------------------------------ 25 | /* 26 | #define Try 27 | { <- give us some local scope. most compilers are happy with this 28 | jmp_buf *PrevFrame, NewFrame; <- prev frame points to the last try block's frame. new frame gets created on stack for this Try block 29 | unsigned int MY_ID = CEXCEPTION_GET_ID; <- look up this task's id for use in frame array. always 0 if single-tasking 30 | PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; <- set pointer to point at old frame (which array is currently pointing at) 31 | CExceptionFrames[MY_ID].pFrame = &NewFrame; <- set array to point at my new frame instead, now 32 | CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- initialize my exception id to be NONE 33 | if (setjmp(NewFrame) == 0) { <- do setjmp. it returns 1 if longjump called, otherwise 0 34 | if (&PrevFrame) <- this is here to force proper scoping. it requires braces or a single line to be but after Try, otherwise won't compile. This is always true at this point. 35 | 36 | #define Catch(e) 37 | else { } <- this also forces proper scoping. Without this they could stick their own 'else' in and it would get ugly 38 | CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; <- no errors happened, so just set the exception id to NONE (in case it was corrupted) 39 | } 40 | else <- an exception occurred 41 | { e = CExceptionFrames[MY_ID].Exception; e=e;} <- assign the caught exception id to the variable passed in. 42 | CExceptionFrames[MY_ID].pFrame = PrevFrame; <- make the pointer in the array point at the previous frame again, as if NewFrame never existed. 43 | } <- finish off that local scope we created to have our own variables 44 | if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away 45 | */ 46 | 47 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/c_exception/lib/CException.h: -------------------------------------------------------------------------------- 1 | #ifndef _CEXCEPTION_H 2 | #define _CEXCEPTION_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" 8 | { 9 | #endif 10 | 11 | 12 | //To Use CException, you have a number of options: 13 | //1. Just include it and run with the defaults 14 | //2. Define any of the following symbols at the command line to override them 15 | //3. Include a header file before CException.h everywhere which defines any of these 16 | //4. Create an Exception.h in your path, and just define EXCEPTION_USE_CONFIG_FILE first 17 | 18 | #ifdef CEXCEPTION_USE_CONFIG_FILE 19 | #include "CExceptionConfig.h" 20 | #endif 21 | 22 | //This is the value to assign when there isn't an exception 23 | #ifndef CEXCEPTION_NONE 24 | #define CEXCEPTION_NONE (0x5A5A5A5A) 25 | #endif 26 | 27 | //This is number of exception stacks to keep track of (one per task) 28 | #ifndef CEXCEPTION_NUM_ID 29 | #define CEXCEPTION_NUM_ID (1) //there is only the one stack by default 30 | #endif 31 | 32 | //This is the method of getting the current exception stack index (0 if only one stack) 33 | #ifndef CEXCEPTION_GET_ID 34 | #define CEXCEPTION_GET_ID (0) //use the first index always because there is only one anyway 35 | #endif 36 | 37 | //The type to use to store the exception values. 38 | #ifndef CEXCEPTION_T 39 | #define CEXCEPTION_T unsigned int 40 | #endif 41 | 42 | //This is an optional special handler for when there is no global Catch 43 | #ifndef CEXCEPTION_NO_CATCH_HANDLER 44 | #define CEXCEPTION_NO_CATCH_HANDLER(id) 45 | #endif 46 | 47 | //These hooks allow you to inject custom code into places, particularly useful for saving and restoring additional state 48 | #ifndef CEXCEPTION_HOOK_START_TRY 49 | #define CEXCEPTION_HOOK_START_TRY 50 | #endif 51 | #ifndef CEXCEPTION_HOOK_HAPPY_TRY 52 | #define CEXCEPTION_HOOK_HAPPY_TRY 53 | #endif 54 | #ifndef CEXCEPTION_HOOK_AFTER_TRY 55 | #define CEXCEPTION_HOOK_AFTER_TRY 56 | #endif 57 | #ifndef CEXCEPTION_HOOK_START_CATCH 58 | #define CEXCEPTION_HOOK_START_CATCH 59 | #endif 60 | 61 | //exception frame structures 62 | typedef struct { 63 | jmp_buf* pFrame; 64 | CEXCEPTION_T volatile Exception; 65 | } CEXCEPTION_FRAME_T; 66 | 67 | //actual root frame storage (only one if single-tasking) 68 | extern volatile CEXCEPTION_FRAME_T CExceptionFrames[]; 69 | 70 | //Try (see C file for explanation) 71 | #define Try \ 72 | { \ 73 | jmp_buf *PrevFrame, NewFrame; \ 74 | unsigned int MY_ID = CEXCEPTION_GET_ID; \ 75 | PrevFrame = CExceptionFrames[CEXCEPTION_GET_ID].pFrame; \ 76 | CExceptionFrames[MY_ID].pFrame = (jmp_buf*)(&NewFrame); \ 77 | CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ 78 | CEXCEPTION_HOOK_START_TRY; \ 79 | if (setjmp(NewFrame) == 0) { \ 80 | if (1) 81 | 82 | //Catch (see C file for explanation) 83 | #define Catch(e) \ 84 | else { } \ 85 | CExceptionFrames[MY_ID].Exception = CEXCEPTION_NONE; \ 86 | CEXCEPTION_HOOK_HAPPY_TRY; \ 87 | } \ 88 | else \ 89 | { \ 90 | e = CExceptionFrames[MY_ID].Exception; \ 91 | (void)e; \ 92 | CEXCEPTION_HOOK_START_CATCH; \ 93 | } \ 94 | CExceptionFrames[MY_ID].pFrame = PrevFrame; \ 95 | CEXCEPTION_HOOK_AFTER_TRY; \ 96 | } \ 97 | if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) 98 | 99 | //Throw an Error 100 | void Throw(CEXCEPTION_T ExceptionID); 101 | 102 | //Just exit the Try block and skip the Catch. 103 | #define ExitTry() Throw(CEXCEPTION_NONE) 104 | 105 | #ifdef __cplusplus 106 | } // extern "C" 107 | #endif 108 | 109 | 110 | #endif // _CEXCEPTION_H 111 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/c_exception/release/build.info: -------------------------------------------------------------------------------- 1 | 17 2 | 3 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/c_exception/release/version.info: -------------------------------------------------------------------------------- 1 | 1.3 2 | 3 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/config/production_environment.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | # Setup our load path: 8 | [ 9 | 'lib', 10 | ].each do |dir| 11 | $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__)) + '/../', dir) ) 12 | end 13 | 14 | 15 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/config/test_environment.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | # Setup our load path: 8 | [ 9 | 'lib', 10 | 'vendor/behaviors/lib', 11 | 'vendor/hardmock/lib', 12 | 'vendor/unity/auto/', 13 | 'test/system/' 14 | ].each do |dir| 15 | $LOAD_PATH.unshift( File.join( File.expand_path(File.dirname(__FILE__) + "/../"), dir) ) 16 | end 17 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | [ "../config/production_environment", 8 | "cmock_header_parser", 9 | "cmock_generator", 10 | "cmock_file_writer", 11 | "cmock_config", 12 | "cmock_plugin_manager", 13 | "cmock_generator_utils", 14 | "cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"} 15 | 16 | 17 | $QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i } 18 | 19 | class CMock 20 | 21 | def initialize(options=nil) 22 | cm_config = CMockConfig.new(options) 23 | cm_unityhelper = CMockUnityHelperParser.new(cm_config) 24 | cm_writer = CMockFileWriter.new(cm_config) 25 | cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper}) 26 | cm_gen_plugins = CMockPluginManager.new(cm_config, cm_gen_utils) 27 | @cm_parser = CMockHeaderParser.new(cm_config) 28 | @cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins) 29 | @silent = (cm_config.verbosity < 2) 30 | end 31 | 32 | def setup_mocks(files) 33 | [files].flatten.each do |src| 34 | generate_mock src 35 | end 36 | end 37 | 38 | private ############################### 39 | 40 | def generate_mock(src) 41 | name = File.basename(src, '.h') 42 | puts "Creating mock for #{name}..." unless @silent 43 | @cm_generator.create_mock(name, @cm_parser.parse(name, File.read(src))) 44 | end 45 | end 46 | 47 | def option_maker(options, key, val) 48 | options = options || {} 49 | options[key.to_sym] = 50 | if val.chr == ":" 51 | val[1..-1].to_sym 52 | elsif val.include? ";" 53 | val.split(';') 54 | elsif val == 'true' 55 | true 56 | elsif val == 'false' 57 | false 58 | elsif val =~ /^\d+$/ 59 | val.to_i 60 | else 61 | val 62 | end 63 | options 64 | end 65 | 66 | # Command Line Support ############################### 67 | 68 | if ($0 == __FILE__) 69 | usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock" 70 | 71 | if (!ARGV[0]) 72 | puts usage 73 | exit 1 74 | end 75 | 76 | options = {} 77 | filelist = [] 78 | ARGV.each do |arg| 79 | if (arg =~ /^-o\"?([a-zA-Z0-9._\\\/:\s]+)\"?/) 80 | options.merge! CMockConfig.load_config_file_from_yaml( arg.gsub(/^-o/,'') ) 81 | elsif (arg =~ /^--([a-zA-Z0-9._\\\/:\s]+)=\"?([a-zA-Z0-9._\-\\\/:\s\;]+)\"?/) 82 | options = option_maker(options, $1, $2) 83 | else 84 | filelist << arg 85 | end 86 | end 87 | 88 | CMock.new(options).setup_mocks(filelist) 89 | end 90 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_file_writer.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockFileWriter 8 | 9 | attr_reader :config 10 | 11 | def initialize(config) 12 | @config = config 13 | end 14 | 15 | def create_subdir(subdir) 16 | if !Dir.exists?("#{@config.mock_path}/") 17 | require 'fileutils' 18 | FileUtils.mkdir_p "#{@config.mock_path}/" 19 | end 20 | if subdir && !Dir.exists?("#{@config.mock_path}/#{subdir+'/' if subdir}") 21 | require 'fileutils' 22 | FileUtils.mkdir_p "#{@config.mock_path}/#{subdir+'/' if subdir}" 23 | end 24 | end 25 | 26 | def create_file(filename, subdir) 27 | raise "Where's the block of data to create?" unless block_given? 28 | full_file_name_temp = "#{@config.mock_path}/#{subdir+'/' if subdir}#{filename}.new" 29 | full_file_name_done = "#{@config.mock_path}/#{subdir+'/' if subdir}#{filename}" 30 | File.open(full_file_name_temp, 'w') do |file| 31 | yield(file, filename) 32 | end 33 | update_file(full_file_name_done, full_file_name_temp) 34 | end 35 | 36 | private ################################### 37 | 38 | def update_file(dest, src) 39 | require 'fileutils' 40 | FileUtils.rm(dest) if (File.exist?(dest)) 41 | FileUtils.cp(src, dest) 42 | FileUtils.rm(src) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_array.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockGeneratorPluginArray 8 | 9 | attr_reader :priority 10 | attr_accessor :config, :utils, :unity_helper, :ordered 11 | def initialize(config, utils) 12 | @config = config 13 | @ptr_handling = @config.when_ptr 14 | @ordered = @config.enforce_strict_ordering 15 | @utils = utils 16 | @unity_helper = @utils.helpers[:unity_helper] 17 | @priority = 8 18 | end 19 | 20 | def instance_typedefs(function) 21 | function[:args].inject("") do |all, arg| 22 | (arg[:ptr?]) ? all + " int Expected_#{arg[:name]}_Depth;\n" : all 23 | end 24 | end 25 | 26 | def mock_function_declarations(function) 27 | return nil unless function[:contains_ptr?] 28 | args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ') 29 | args_string = function[:args].map do |m| 30 | const_str = m[:const?] ? 'const ' : '' 31 | m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}" 32 | end.join(', ') 33 | if (function[:return][:void?]) 34 | return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" + 35 | "void #{function[:name]}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string});\n" 36 | else 37 | return "#define #{function[:name]}_ExpectWithArrayAndReturn(#{args_call}, cmock_retval) #{function[:name]}_CMockExpectWithArrayAndReturn(__LINE__, #{args_call}, cmock_retval)\n" + 38 | "void #{function[:name]}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]});\n" 39 | end 40 | end 41 | 42 | def mock_interfaces(function) 43 | return nil unless function[:contains_ptr?] 44 | lines = [] 45 | func_name = function[:name] 46 | args_string = function[:args].map do |m| 47 | const_str = m[:const?] ? 'const ' : '' 48 | m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}" 49 | end.join(', ') 50 | call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ') 51 | if (function[:return][:void?]) 52 | lines << "void #{func_name}_CMockExpectWithArray(UNITY_LINE_TYPE cmock_line, #{args_string})\n" 53 | else 54 | lines << "void #{func_name}_CMockExpectWithArrayAndReturn(UNITY_LINE_TYPE cmock_line, #{args_string}, #{function[:return][:str]})\n" 55 | end 56 | lines << "{\n" 57 | lines << @utils.code_add_base_expectation(func_name) 58 | lines << " CMockExpectParameters_#{func_name}(cmock_call_instance, #{call_string});\n" 59 | lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" unless (function[:return][:void?]) 60 | lines << "}\n\n" 61 | end 62 | 63 | end 64 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_cexception.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockGeneratorPluginCexception 8 | 9 | attr_reader :priority 10 | attr_reader :config, :utils 11 | 12 | def initialize(config, utils) 13 | @config = config 14 | @utils = utils 15 | @priority = 7 16 | end 17 | 18 | def include_files 19 | return "#include \"CException.h\"\n" 20 | end 21 | 22 | def instance_typedefs(function) 23 | " CEXCEPTION_T ExceptionToThrow;\n" 24 | end 25 | 26 | def mock_function_declarations(function) 27 | if (function[:args_string] == "void") 28 | return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" + 29 | "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" 30 | else 31 | return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" + 32 | "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n" 33 | end 34 | end 35 | 36 | def mock_implementation(function) 37 | " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" + 38 | " UNITY_CLR_DETAILS();\n" + 39 | " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" 40 | end 41 | 42 | def mock_interfaces(function) 43 | arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, " 44 | call_string = function[:args].map{|m| m[:name]}.join(', ') 45 | [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n", 46 | @utils.code_add_base_expectation(function[:name]), 47 | @utils.code_call_argument_loader(function), 48 | " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", 49 | "}\n\n" ].join 50 | end 51 | 52 | end 53 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockGeneratorPluginExpectAnyArgs 8 | 9 | attr_reader :priority 10 | attr_reader :config, :utils 11 | 12 | def initialize(config, utils) 13 | @config = config 14 | @utils = utils 15 | @priority = 3 16 | end 17 | 18 | def instance_structure(function) 19 | if (function[:return][:void?]) || (@config.plugins.include? :ignore) 20 | "" 21 | else 22 | " #{function[:return][:type]} #{function[:name]}_FinalReturn;\n" 23 | end 24 | end 25 | 26 | def instance_typedefs(function) 27 | " CMOCK_ARG_MODE IgnoreMode;\n" 28 | end 29 | 30 | def mock_function_declarations(function) 31 | 32 | if (function[:return][:void?]) 33 | return "#define #{function[:name]}_ExpectAnyArgs() #{function[:name]}_CMockExpectAnyArgs(__LINE__)\n" + 34 | "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line);\n" 35 | else 36 | return "#define #{function[:name]}_ExpectAnyArgsAndReturn(cmock_retval) #{function[:name]}_CMockExpectAnyArgsAndReturn(__LINE__, cmock_retval)\n" + 37 | "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" 38 | end 39 | end 40 | 41 | # def mock_implementation(function) 42 | # lines = " if (cmock_call_instance->IgnoreMode == CMOCK_ARG_NONE)\n {\n" 43 | # if (function[:return][:void?]) 44 | # lines << " return;\n }\n" 45 | # else 46 | # retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} ) 47 | # lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?]) 48 | # return_type = function[:return][:const?] ? "(const #{function[:return][:type]})" : ((function[:return][:type] =~ /cmock/) ? "(#{function[:return][:type]})" : '') 49 | # lines << " return #{return_type}cmock_call_instance->ReturnVal;\n }\n" 50 | # end 51 | # lines 52 | # end 53 | 54 | def mock_interfaces(function) 55 | lines = "" 56 | if (function[:return][:void?]) 57 | lines << "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)\n{\n" 58 | else 59 | lines << "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" 60 | end 61 | lines << @utils.code_add_base_expectation(function[:name], true) 62 | unless (function[:return][:void?]) 63 | lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" 64 | end 65 | lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_NONE;\n" 66 | lines << "}\n\n" 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockGeneratorPluginIgnore 8 | 9 | attr_reader :priority 10 | attr_reader :config, :utils 11 | 12 | def initialize(config, utils) 13 | @config = config 14 | @utils = utils 15 | @priority = 2 16 | end 17 | 18 | def instance_structure(function) 19 | if (function[:return][:void?]) 20 | " int #{function[:name]}_IgnoreBool;\n" 21 | else 22 | " int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n" 23 | end 24 | end 25 | 26 | def mock_function_declarations(function) 27 | if (function[:return][:void?]) 28 | return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore()\n" + 29 | "void #{function[:name]}_CMockIgnore(void);\n" 30 | else 31 | return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" + 32 | "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n" 33 | end 34 | end 35 | 36 | def mock_implementation_precheck(function) 37 | lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n" 38 | lines << " UNITY_CLR_DETAILS();\n" 39 | if (function[:return][:void?]) 40 | lines << " return;\n }\n" 41 | else 42 | retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} ) 43 | return_type = function[:return][:const?] ? "(const #{function[:return][:type]})" : ((function[:return][:type] =~ /cmock/) ? "(#{function[:return][:type]})" : '') 44 | lines << " if (cmock_call_instance == NULL)\n return #{return_type}Mock.#{function[:name]}_FinalReturn;\n" 45 | lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?]) 46 | lines << " return #{return_type}cmock_call_instance->ReturnVal;\n }\n" 47 | end 48 | lines 49 | end 50 | 51 | def mock_interfaces(function) 52 | lines = "" 53 | if (function[:return][:void?]) 54 | lines << "void #{function[:name]}_CMockIgnore(void)\n{\n" 55 | else 56 | lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n" 57 | end 58 | if (!function[:return][:void?]) 59 | lines << @utils.code_add_base_expectation(function[:name], false) 60 | end 61 | unless (function[:return][:void?]) 62 | lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n" 63 | end 64 | lines << " Mock.#{function[:name]}_IgnoreBool = (int)1;\n" 65 | lines << "}\n\n" 66 | end 67 | 68 | def mock_verify(function) 69 | func_name = function[:name] 70 | " if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n" 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb: -------------------------------------------------------------------------------- 1 | class CMockGeneratorPluginIgnoreArg 2 | attr_reader :priority 3 | attr_accessor :utils 4 | 5 | def initialize(config, utils) 6 | @utils = utils 7 | @priority = 10 8 | end 9 | 10 | def instance_typedefs(function) 11 | lines = "" 12 | function[:args].each do |arg| 13 | lines << " int IgnoreArg_#{arg[:name]};\n" 14 | end 15 | lines 16 | end 17 | 18 | def mock_function_declarations(function) 19 | lines = "" 20 | function[:args].each do |arg| 21 | lines << "#define #{function[:name]}_IgnoreArg_#{arg[:name]}()" 22 | lines << " #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(__LINE__)\n" 23 | lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line);\n" 24 | end 25 | lines 26 | end 27 | 28 | def mock_interfaces(function) 29 | lines = [] 30 | func_name = function[:name] 31 | function[:args].each do |arg| 32 | arg_name = arg[:name] 33 | arg_type = arg[:type] 34 | lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n" 35 | lines << "{\n" 36 | lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " + 37 | "(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n" 38 | lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringIgnPreExp);\n" 39 | lines << " cmock_call_instance->IgnoreArg_#{arg_name} = 1;\n" 40 | lines << "}\n\n" 41 | end 42 | lines 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb: -------------------------------------------------------------------------------- 1 | class CMockGeneratorPluginReturnThruPtr 2 | attr_reader :priority 3 | attr_accessor :utils 4 | 5 | def initialize(config, utils) 6 | @utils = utils 7 | @priority = 9 8 | end 9 | 10 | def instance_typedefs(function) 11 | lines = "" 12 | function[:args].each do |arg| 13 | if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?]) 14 | lines << " int ReturnThruPtr_#{arg[:name]}_Used;\n" 15 | lines << " #{arg[:type]} ReturnThruPtr_#{arg[:name]}_Val;\n" 16 | lines << " int ReturnThruPtr_#{arg[:name]}_Size;\n" 17 | end 18 | end 19 | lines 20 | end 21 | 22 | def mock_function_declarations(function) 23 | lines = "" 24 | function[:args].each do |arg| 25 | if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?]) 26 | lines << "#define #{function[:name]}_ReturnThruPtr_#{arg[:name]}(#{arg[:name]})" 27 | lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, sizeof(*#{arg[:name]}))\n" 28 | lines << "#define #{function[:name]}_ReturnArrayThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_len)" 29 | lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, (int)(cmock_len * (int)sizeof(*#{arg[:name]})))\n" 30 | lines << "#define #{function[:name]}_ReturnMemThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_size)" 31 | lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, cmock_size)\n" 32 | lines << "void #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg[:name]}, int cmock_size);\n" 33 | end 34 | end 35 | lines 36 | end 37 | 38 | def mock_interfaces(function) 39 | lines = [] 40 | func_name = function[:name] 41 | function[:args].each do |arg| 42 | arg_name = arg[:name] 43 | arg_type = arg[:type] 44 | if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?]) 45 | lines << "void #{func_name}_CMockReturnMemThruPtr_#{arg_name}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg_name}, int cmock_size)\n" 46 | lines << "{\n" 47 | lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " + 48 | "(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n" 49 | lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringPtrPreExp);\n" 50 | lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Used = 1;\n" 51 | lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Val = #{arg_name};\n" 52 | lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Size = cmock_size;\n" 53 | lines << "}\n\n" 54 | end 55 | end 56 | lines 57 | end 58 | 59 | def mock_implementation(function) 60 | lines = [] 61 | function[:args].each do |arg| 62 | arg_name = arg[:name] 63 | arg_type = arg[:type] 64 | if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?]) 65 | lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n" 66 | lines << " {\n" 67 | lines << " memcpy(#{arg_name}, cmock_call_instance->ReturnThruPtr_#{arg_name}_Val,\n" 68 | lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Size);\n" 69 | lines << " }\n" 70 | end 71 | end 72 | lines 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_plugin_manager.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockPluginManager 8 | 9 | attr_accessor :plugins 10 | 11 | def initialize(config, utils) 12 | @plugins = [] 13 | plugins_to_load = [:expect, config.plugins].flatten.uniq.compact 14 | plugins_to_load.each do |plugin| 15 | plugin_name = plugin.to_s 16 | object_name = "CMockGeneratorPlugin" + camelize(plugin_name) 17 | begin 18 | unless (Object.const_defined? object_name) 19 | require "#{File.expand_path(File.dirname(__FILE__))}/cmock_generator_plugin_#{plugin_name.downcase}.rb" 20 | end 21 | @plugins << eval("#{object_name}.new(config, utils)") 22 | rescue 23 | raise "ERROR: CMock unable to load plugin '#{plugin_name}'" 24 | end 25 | end 26 | @plugins.sort! {|a,b| a.priority <=> b.priority } 27 | end 28 | 29 | def run(method, args=nil) 30 | if args.nil? 31 | return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join 32 | else 33 | return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join 34 | end 35 | end 36 | 37 | def camelize(lower_case_and_underscored_word) 38 | lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase } 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/lib/cmock_unityhelper_parser.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # CMock Project - Automatic Mock Generation for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | class CMockUnityHelperParser 8 | 9 | attr_accessor :c_types 10 | 11 | def initialize(config) 12 | @config = config 13 | @fallback = @config.plugins.include?(:array) ? 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY' : 'UNITY_TEST_ASSERT_EQUAL_MEMORY' 14 | @c_types = map_C_types.merge(import_source) 15 | end 16 | 17 | def get_helper(ctype) 18 | lookup = ctype.gsub(/(?:^|(\S?)(\s*)|(\W))const(?:$|(\s*)(\S)|(\W))/,'\1\3\5\6').strip.gsub(/\s+/,'_') 19 | return [@c_types[lookup], ''] if (@c_types[lookup]) 20 | if (lookup =~ /\*$/) 21 | lookup = lookup.gsub(/\*$/,'') 22 | return [@c_types[lookup], '*'] if (@c_types[lookup]) 23 | else 24 | lookup = lookup + '*' 25 | return [@c_types[lookup], '&'] if (@c_types[lookup]) 26 | end 27 | return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/) 28 | raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown 29 | return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, ''] 30 | end 31 | 32 | private ########################### 33 | 34 | def map_C_types 35 | c_types = {} 36 | @config.treat_as.each_pair do |ctype, expecttype| 37 | c_type = ctype.gsub(/\s+/,'_') 38 | if (expecttype =~ /\*/) 39 | c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/,'')}_ARRAY" 40 | else 41 | c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}" 42 | c_types[c_type+'*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY" 43 | end 44 | end 45 | c_types 46 | end 47 | 48 | def import_source 49 | source = @config.load_unity_helper 50 | return {} if source.nil? 51 | c_types = {} 52 | source = source.gsub(/\/\/.*$/, '') #remove line comments 53 | source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments 54 | 55 | #scan for comparison helpers 56 | match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4,'\s*\w+\s*').join(',') + '\)') 57 | pairs = source.scan(match_regex).flatten.compact 58 | (pairs.size/2).times do |i| 59 | expect = pairs[i*2] 60 | ctype = pairs[(i*2)+1] 61 | c_types[ctype] = expect unless expect.include?("_ARRAY") 62 | end 63 | 64 | #scan for array variants of those helpers 65 | match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5,'\s*\w+\s*').join(',') + '\)') 66 | pairs = source.scan(match_regex).flatten.compact 67 | (pairs.size/2).times do |i| 68 | expect = pairs[i*2] 69 | ctype = pairs[(i*2)+1] 70 | c_types[ctype.gsub('_ARRAY','*')] = expect 71 | end 72 | 73 | c_types 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/release/build.info: -------------------------------------------------------------------------------- 1 | 214 2 | 3 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/release/version.info: -------------------------------------------------------------------------------- 1 | 2.4.2 2 | 3 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/src/cmock.h: -------------------------------------------------------------------------------- 1 | /* ========================================== 2 | CMock Project - Automatic Mock Generation for C 3 | Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | [Released under MIT License. Please refer to license.txt for details] 5 | ========================================== */ 6 | 7 | #ifndef CMOCK_FRAMEWORK_H 8 | #define CMOCK_FRAMEWORK_H 9 | 10 | #include "cmock_internals.h" 11 | 12 | //should be big enough to index full range of CMOCK_MEM_MAX 13 | #ifndef CMOCK_MEM_INDEX_TYPE 14 | #define CMOCK_MEM_INDEX_TYPE unsigned int 15 | #endif 16 | 17 | #define CMOCK_GUTS_NONE (0) 18 | 19 | #define CMOCK_ARG_MODE CMOCK_MEM_INDEX_TYPE 20 | #define CMOCK_ARG_ALL 0 21 | #define CMOCK_ARG_NONE ((CMOCK_MEM_INDEX_TYPE)(~0)) 22 | 23 | //------------------------------------------------------- 24 | // Memory API 25 | //------------------------------------------------------- 26 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNew(CMOCK_MEM_INDEX_TYPE size); 27 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemChain(CMOCK_MEM_INDEX_TYPE root_index, CMOCK_MEM_INDEX_TYPE obj_index); 28 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemNext(CMOCK_MEM_INDEX_TYPE previous_item_index); 29 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemEndOfChain(CMOCK_MEM_INDEX_TYPE root_index); 30 | 31 | void* CMock_Guts_GetAddressFor(CMOCK_MEM_INDEX_TYPE index); 32 | 33 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesFree(void); 34 | CMOCK_MEM_INDEX_TYPE CMock_Guts_MemBytesUsed(void); 35 | void CMock_Guts_MemFreeAll(void); 36 | void CMock_Guts_MemFreeFinal(void); 37 | 38 | #endif //CMOCK_FRAMEWORK 39 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/cmock/src/cmock_internals.h: -------------------------------------------------------------------------------- 1 | /* ========================================== 2 | CMock Project - Automatic Mock Generation for C 3 | Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | [Released under MIT License. Please refer to license.txt for details] 5 | ========================================== */ 6 | 7 | #ifndef CMOCK_FRAMEWORK_INTERNALS_H 8 | #define CMOCK_FRAMEWORK_INTERNALS_H 9 | 10 | //These are constants that the generated mocks have access to 11 | extern const char* CMockStringOutOfMemory; 12 | extern const char* CMockStringCalledMore; 13 | extern const char* CMockStringCalledLess; 14 | extern const char* CMockStringCalledEarly; 15 | extern const char* CMockStringCalledLate; 16 | extern const char* CMockStringCallOrder; 17 | extern const char* CMockStringIgnPreExp; 18 | extern const char* CMockStringPtrPreExp; 19 | extern const char* CMockStringExpNULL; 20 | extern const char* CMockStringMismatch; 21 | 22 | //define CMOCK_MEM_DYNAMIC to grab memory as needed with malloc 23 | //when you do that, CMOCK_MEM_SIZE is used for incremental size instead of total 24 | #ifdef CMOCK_MEM_STATIC 25 | #undef CMOCK_MEM_DYNAMIC 26 | #endif 27 | 28 | #ifdef CMOCK_MEM_DYNAMIC 29 | #include 30 | #endif 31 | 32 | //this is used internally during pointer arithmetic. make sure this type is the same size as the target's pointer type 33 | #ifndef CMOCK_MEM_PTR_AS_INT 34 | #ifdef UNITY_POINTER_WIDTH 35 | #ifdef UNITY_INT_WIDTH 36 | #if UNITY_POINTER_WIDTH == UNITY_INT_WIDTH 37 | #define CMOCK_MEM_PTR_AS_INT unsigned int 38 | #endif 39 | #endif 40 | #endif 41 | #endif 42 | 43 | #ifndef CMOCK_MEM_PTR_AS_INT 44 | #ifdef UNITY_POINTER_WIDTH 45 | #ifdef UNITY_LONG_WIDTH 46 | #if UNITY_POINTER_WIDTH == UNITY_LONG_WIDTH 47 | #define CMOCK_MEM_PTR_AS_INT unsigned long 48 | #endif 49 | #if UNITY_POINTER_WIDTH > UNITY_LONG_WIDTH 50 | #define CMOCK_MEM_PTR_AS_INT unsigned long long 51 | #endif 52 | #endif 53 | #endif 54 | #endif 55 | 56 | #ifndef CMOCK_MEM_PTR_AS_INT 57 | #define CMOCK_MEM_PTR_AS_INT unsigned long 58 | #endif 59 | 60 | //0 for no alignment, 1 for 16-bit, 2 for 32-bit, 3 for 64-bit 61 | #ifndef CMOCK_MEM_ALIGN 62 | #define CMOCK_MEM_ALIGN (2) 63 | #endif 64 | 65 | //amount of memory to allow cmock to use in its internal heap 66 | #ifndef CMOCK_MEM_SIZE 67 | #define CMOCK_MEM_SIZE (32768) 68 | #endif 69 | 70 | //automatically calculated defs for easier reading 71 | #define CMOCK_MEM_ALIGN_SIZE (CMOCK_MEM_INDEX_TYPE)(1u << CMOCK_MEM_ALIGN) 72 | #define CMOCK_MEM_ALIGN_MASK (CMOCK_MEM_INDEX_TYPE)(CMOCK_MEM_ALIGN_SIZE - 1) 73 | #define CMOCK_MEM_INDEX_SIZE (CMOCK_MEM_INDEX_TYPE)(CMOCK_MEM_PTR_AS_INT)((sizeof(CMOCK_MEM_INDEX_TYPE) > CMOCK_MEM_ALIGN_SIZE) ? sizeof(CMOCK_MEM_INDEX_TYPE) : CMOCK_MEM_ALIGN_SIZE) 74 | 75 | 76 | #endif //CMOCK_FRAMEWORK_INTERNALS 77 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/constructor/lib/constructor_struct.rb: -------------------------------------------------------------------------------- 1 | class ConstructorStruct 2 | def self.new(*accessors, &block) 3 | defaults = {:accessors => true, :strict => false} 4 | 5 | accessor_names = accessors.dup 6 | if accessors.last.is_a? Hash 7 | accessor_names.pop 8 | user_opts = accessors.last 9 | user_opts.delete(:accessors) 10 | defaults.each do |k,v| 11 | user_opts[k] ||= v 12 | end 13 | else 14 | accessors << defaults 15 | end 16 | 17 | Class.new do 18 | constructor *accessors 19 | 20 | class_eval(&block) if block 21 | 22 | comparator_code = accessor_names.map { |fname| "self.#{fname} == o.#{fname}" }.join(" && ") 23 | eval %| 24 | def ==(o) 25 | (self.class == o.class) && #{comparator_code} 26 | end 27 | def eql?(o) 28 | (self.class == o.class) && #{comparator_code} 29 | end 30 | | 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/diy/lib/diy/factory.rb: -------------------------------------------------------------------------------- 1 | module DIY #:nodoc:# 2 | class FactoryDef #:nodoc: 3 | attr_accessor :name, :target, :class_name, :library 4 | 5 | def initialize(opts) 6 | @name, @target, @library, @auto_require = 7 | opts[:name], opts[:target], opts[:library], opts[:auto_require] 8 | 9 | @class_name = Infl.camelize(@target) 10 | @library ||= Infl.underscore(@class_name) if @auto_require 11 | end 12 | end 13 | 14 | class Context 15 | def construct_factory(key) 16 | factory_def = @defs[key] 17 | # puts "requiring #{factory_def.library}" 18 | require factory_def.library if factory_def.library 19 | 20 | big_c = get_class_for_name_with_module_delimeters(factory_def.class_name) 21 | 22 | FactoryFactory.new(big_c) 23 | end 24 | end 25 | 26 | class FactoryFactory 27 | def initialize(clazz) 28 | @class_to_create = clazz 29 | end 30 | 31 | def create(*args) 32 | @class_to_create.new(*args) 33 | end 34 | end 35 | end 36 | 37 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/auto/colour_prompt.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # Unity Project - A Test Framework for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | if RUBY_PLATFORM =~/(win|w)32$/ 8 | begin 9 | require 'Win32API' 10 | rescue LoadError 11 | puts "ERROR! \"Win32API\" library not found" 12 | puts "\"Win32API\" is required for colour on a windows machine" 13 | puts " try => \"gem install Win32API\" on the command line" 14 | puts 15 | end 16 | # puts 17 | # puts 'Windows Environment Detected...' 18 | # puts 'Win32API Library Found.' 19 | # puts 20 | end 21 | 22 | class ColourCommandLine 23 | def initialize 24 | if RUBY_PLATFORM =~/(win|w)32$/ 25 | get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L') 26 | @set_console_txt_attrb = 27 | Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I') 28 | @hout = get_std_handle.call(-11) 29 | end 30 | end 31 | 32 | def change_to(new_colour) 33 | if RUBY_PLATFORM =~/(win|w)32$/ 34 | @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour)) 35 | else 36 | "\033[30;#{posix_colour(new_colour)};22m" 37 | end 38 | end 39 | 40 | def win32_colour(colour) 41 | case colour 42 | when :black then 0 43 | when :dark_blue then 1 44 | when :dark_green then 2 45 | when :dark_cyan then 3 46 | when :dark_red then 4 47 | when :dark_purple then 5 48 | when :dark_yellow, :narrative then 6 49 | when :default_white, :default, :dark_white then 7 50 | when :silver then 8 51 | when :blue then 9 52 | when :green, :success then 10 53 | when :cyan, :output then 11 54 | when :red, :failure then 12 55 | when :purple then 13 56 | when :yellow then 14 57 | when :white then 15 58 | else 59 | 0 60 | end 61 | end 62 | 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 | 84 | case colour 85 | when :black then 30 86 | when :red, :failure then 31 87 | when :green, :success then 32 88 | when :yellow then 33 89 | when :blue, :narrative then 34 90 | when :purple, :magenta then 35 91 | when :cyan, :output then 36 92 | when :white, :default_white then 37 93 | when :default then 39 94 | else 95 | 39 96 | end 97 | end 98 | 99 | def out_c(mode, colour, str) 100 | case RUBY_PLATFORM 101 | when /(win|w)32$/ 102 | change_to(colour) 103 | $stdout.puts str if mode == :puts 104 | $stdout.print str if mode == :print 105 | change_to(:default_white) 106 | else 107 | $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts 108 | $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print 109 | end 110 | end 111 | end # ColourCommandLine 112 | 113 | def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end 114 | def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end 115 | 116 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/auto/colour_reporter.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # Unity Project - A Test Framework for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" 8 | 9 | $colour_output = true 10 | 11 | def report(message) 12 | if not $colour_output 13 | $stdout.puts(message) 14 | else 15 | message = message.join('\n') if (message.class == Array) 16 | message.each_line do |line| 17 | line.chomp! 18 | colour = case(line) 19 | when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i 20 | ($1.to_i == 0) ? :green : :red 21 | when /PASS/ 22 | :green 23 | when /^OK$/ 24 | :green 25 | when /(?:FAIL|ERROR)/ 26 | :red 27 | when /IGNORE/ 28 | :yellow 29 | when /^(?:Creating|Compiling|Linking)/ 30 | :white 31 | else 32 | :silver 33 | end 34 | colour_puts(colour, line) 35 | end 36 | end 37 | $stdout.flush 38 | $stderr.flush 39 | end -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/auto/generate_config.yml: -------------------------------------------------------------------------------- 1 | #this is a sample configuration file for generate_module 2 | #you would use it by calling generate_module with the -ygenerate_config.yml option 3 | #files like this are useful for customizing generate_module to your environment 4 | :generate_module: 5 | :defaults: 6 | #these defaults are used in place of any missing options at the command line 7 | :path_src: ../src/ 8 | :path_inc: ../src/ 9 | :path_tst: ../test/ 10 | :update_svn: true 11 | :includes: 12 | #use [] for no additional includes, otherwise list the includes on separate lines 13 | :src: 14 | - Defs.h 15 | - Board.h 16 | :inc: [] 17 | :tst: 18 | - Defs.h 19 | - Board.h 20 | - Exception.h 21 | :boilerplates: 22 | #these are inserted at the top of generated files. 23 | #just comment out or remove if not desired. 24 | #use %1$s where you would like the file name to appear (path/extension not included) 25 | :src: | 26 | //------------------------------------------- 27 | // %1$s.c 28 | //------------------------------------------- 29 | :inc: | 30 | //------------------------------------------- 31 | // %1$s.h 32 | //------------------------------------------- 33 | :tst: | 34 | //------------------------------------------- 35 | // Test%1$s.c : Units tests for %1$s.c 36 | //------------------------------------------- 37 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/auto/test_file_filter.rb: -------------------------------------------------------------------------------- 1 | # ========================================== 2 | # Unity Project - A Test Framework for C 3 | # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 | # [Released under MIT License. Please refer to license.txt for details] 5 | # ========================================== 6 | 7 | require'yaml' 8 | 9 | module RakefileHelpers 10 | class TestFileFilter 11 | def initialize(all_files = false) 12 | @all_files = all_files 13 | if not @all_files == true 14 | if File.exist?('test_file_filter.yml') 15 | filters = YAML.load_file( 'test_file_filter.yml' ) 16 | @all_files, @only_files, @exclude_files = 17 | filters[:all_files], filters[:only_files], filters[:exclude_files] 18 | end 19 | end 20 | end 21 | attr_accessor :all_files, :only_files, :exclude_files 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/auto/type_sanitizer.rb: -------------------------------------------------------------------------------- 1 | module TypeSanitizer 2 | 3 | def self.sanitize_c_identifier(unsanitized) 4 | # convert filename to valid C identifier by replacing invalid chars with '_' 5 | return unsanitized.gsub(/[-\/\\\.\,\s]/, "_") 6 | end 7 | 8 | end 9 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/release/build.info: -------------------------------------------------------------------------------- 1 | 119 2 | 3 | -------------------------------------------------------------------------------- /vendor/ceedling/vendor/unity/release/version.info: -------------------------------------------------------------------------------- 1 | 2.3.2 2 | 3 | --------------------------------------------------------------------------------