Skip to content

Commit

Permalink
[UMM-53] Allow command line override of config file
Browse files Browse the repository at this point in the history
  • Loading branch information
rhempel committed Apr 30, 2021
1 parent 8fae4e7 commit 42be1cd
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 111 deletions.
208 changes: 103 additions & 105 deletions project.yml
Original file line number Diff line number Diff line change
@@ -1,105 +1,103 @@
---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

:project:
:use_exceptions: FALSE
:use_test_preprocessor: TRUE
:use_auxiliary_dependencies: TRUE
:build_root: build
# :release_build: TRUE
:test_file_prefix: test_
:default_tasks:
- test:all

#:test_build:
# :use_assembly: TRUE

#:release_build:
# :output: MyApp.out
# :use_assembly: FALSE

:environment:

:extension:
:executable: .out

:paths:
:test:
- +:test/**
- -:test/support
:source:
- src/**
:support:
- test/support/*

:defines:
# in order to add common defines:
# 1) remove the trailing [] from the :common: section
# 2) add entries to the :common: section (e.g. :test: has TEST defined)
:common: &common_defines []
:test:
- *common_defines
- TEST
- UMM_INFO
- UMM_TEST_BUILD
- UMM_INTEGRITY_CHECK
- UMM_POISON_CHECK
:test_preprocess:
- *common_defines
- TEST
- UMM_INFO
- UMM_TEST_BUILD
- UMM_INTEGRITY_CHECK
- UMM_POISON_CHECK

:cmock:
:mock_prefix: mock_
:when_no_prototypes: :warn
:enforce_strict_ordering: TRUE
:plugins:
- :ignore
- :callback
:treat_as:
uint8: HEX8
uint16: HEX16
uint32: UINT32
int8: INT8
bool: UINT8

# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
# :gcov:
# :html_report: TRUE
# :html_report_type: detailed
# :html_medium_threshold: 75
# :html_high_threshold: 90
# :xml_report: FALSE

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

# LIBRARIES
# These libraries are automatically injected into the build process. Those specified as
# common will be used in all types of builds. Otherwise, libraries can be injected in just
# tests or releases. These options are MERGED with the options in supplemental yaml files.
:libraries:
:placement: :end
:flag: "${1}" # or "-L ${1}" for example
:test: [-lm]
:release: [-lm]

:plugins:
# :load_paths:
# - vendor/ceedling/plugins
:enabled:
- stdout_pretty_tests_report
- module_generator
- raw_output_report
...
---

# Notes:
# Sample project C code is not presently written to produce a release artifact.
# As such, release build options are disabled.
# This sample, therefore, only demonstrates running a collection of unit tests.

:project:
:use_exceptions: FALSE
:use_test_preprocessor: TRUE
:use_auxiliary_dependencies: TRUE
:build_root: build
# :release_build: TRUE
:test_file_prefix: test_
:default_tasks:
- test:all

#:test_build:
# :use_assembly: TRUE

#:release_build:
# :output: MyApp.out
# :use_assembly: FALSE

:environment:

:extension:
:executable: .out

:paths:
:test:
- +:test/**
- -:test/support
:source:
- src/**
:support:
- test/support/*

:defines:
# in order to add common defines:
# 1) remove the trailing [] from the :common: section
# 2) add entries to the :common: section (e.g. :test: has TEST defined)
:common: &common_defines
- TEST
- UMM_INFO
- UMM_TEST_BUILD
- UMM_INTEGRITY_CHECK
- UMM_POISON_CHECK
- UMM_CFGFILE="<umm_malloc_cfgport.h>"

:test:
- *common_defines

:test_preprocess:
- *common_defines

:cmock:
:mock_prefix: mock_
:when_no_prototypes: :warn
:enforce_strict_ordering: TRUE
:plugins:
- :ignore
- :callback
:treat_as:
uint8: HEX8
uint16: HEX16
uint32: UINT32
int8: INT8
bool: UINT8

# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
# :gcov:
# :html_report: TRUE
# :html_report_type: detailed
# :html_medium_threshold: 75
# :html_high_threshold: 90
# :xml_report: FALSE

#:tools:
# Ceedling defaults to using gcc for compiling, linking, etc.
# As [:tools] is blank, gcc will be used (so long as it's in your system path)
# See documentation to configure a given toolchain for use

# LIBRARIES
# These libraries are automatically injected into the build process. Those specified as
# common will be used in all types of builds. Otherwise, libraries can be injected in just
# tests or releases. These options are MERGED with the options in supplemental yaml files.
:libraries:
:placement: :end
:flag: "${1}" # or "-L ${1}" for example
:test: [-lm]
:release: [-lm]

:plugins:
# :load_paths:
# - vendor/ceedling/plugins
:enabled:
- stdout_pretty_tests_report
- module_generator
- raw_output_report
...
2 changes: 1 addition & 1 deletion src/umm_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <stddef.h>
#include <string.h>

#include "umm_malloc_cfg.h" /* user-dependent */
#include "umm_malloc_cfg.h" // Override with umm_malloc_cfg_xxx.h
#include "umm_malloc.h"

/* Use the default DBGLOG_LEVEL and DBGLOG_FUNCTION */
Expand Down
31 changes: 26 additions & 5 deletions src/umm_malloc_cfg.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/*
* Configuration for umm_malloc - DO NOT EDIT THIS FILE BY HAND!
*
* Refer to the notes below for how to configure the build at compile time
* using -D to define non-default values
* NOTE WELL: Your project MUST have a umm_malloc_cfgport.h - even if
* it's empty!!!
*
* Refer to the notes below for details on the umm_malloc configuration
* options.
*/

#ifndef _UMM_MALLOC_CFG_H
Expand All @@ -16,11 +19,23 @@
* There are a number of defines you can set at compile time that affect how
* the memory allocator will operate.
*
* You should NOT edit this file, it may be changed from time to time in
* the upstream project. Instead, you can do one of the following (in order
* of priority
*
* 1. Pass in the override values on the command line using -D UMM_xxx
* 2. Pass in the filename holding override values using -D UMM_CFGFILE
* 3. Set up defaults in a file called umm_malloc_cfgport.h
*
* NOTE WELL: For the command line -D options to take highest priority, your
* project level override file must check that the UMM_xxx
* value is not already defined before overriding
*
* Unless otherwise noted, the default state of these values is #undef-ined!
*
* If you set them via the -D option on the command line (preferred method)
* then this file handles all the configuration automagically and warns if
* there is an incompatible configuration.
* As this is the top level configuration file, it is responsible for making
* sure that the configuration makes sense. For example the UMM_BLOCK_BODY_SIZE
* is a minimum of 8 and a multiple of 4.
*
* UMM_TEST_BUILD
*
Expand Down Expand Up @@ -95,6 +110,12 @@
* ----------------------------------------------------------------------------
*/

#ifdef UMM_CFGFILE
#include UMM_CFGFILE
#else
#include <umm_malloc_cfgport.h>
#endif

/* A couple of macros to make packing structures less compiler dependent */

#define UMM_H_ATTPACKPRE
Expand Down
5 changes: 5 additions & 0 deletions test/umm_malloc_cfgport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Project specific configuration for umm_malloc
*
* This file is intentionally left blank
*/

0 comments on commit 42be1cd

Please sign in to comment.