You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by gi...@git.apache.org on 2017/06/29 18:10:49 UTC

[GitHub] ccollins476ad opened a new pull request #363: testutil - Remove init boilerplate

ccollins476ad opened a new pull request #363: testutil - Remove init boilerplate
URL: https://github.com/apache/incubator-mynewt-core/pull/363
 
 
   All selftest main() functions had the same initialization sequence for the testutil package:
   
   1. `ts_config.ts_print_results = 1;`
   2. `tu_init();`
   3. (sometimes) `tu_parse_args(argc, argv);`
   
   The issues with this are:
   
   * Since (1) is always present, it could be performed by the `tu_init()` function call automatically.
   * (2) is inconsistent with regular apps.  An app calls `sysinit()` from main, but selftest programs call `tu_init()`, which in turn calls `sysinit()`.
   * (3) is obsolete; `newt run <test-pkg>` takes care of argument parsing now.
   
   This commit addresses these issues as follows:
   
   1. Move `ts_config.ts_print_results = 1;` into `tu_init()`.
   2. Turn `tu_init()` into a sysinit function.  That is, have it get called automatically by sysinit.
   3. Remove `tu_parse_args()` entirely.
   4. In selftest `main()` functions, call `sysinit()` instead of `tu_init()` like a regular app.
   
   The motivation for this commit is to make unit test documentation easier to understand.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services