Commit Graph

6110 Commits (820d79d84bf0cb31ab8bcecfd9e7090cdb6872cc)

Author SHA1 Message Date
Niklas Hauser 336bffaf05 Add shim definitions for mbed OS definitions.
This allows utest to be used without mbed OS dependencies.
2016-04-28 15:21:16 -05:00
Niklas Hauser 53377a1f4a Adapt Harness to call init and run functions. 2016-04-28 15:21:12 -05:00
Niklas Hauser df1d9f5529 Extend scheduler with init and run callbacks. 2016-04-28 15:21:08 -05:00
Niklas Hauser 6e85376d37 Allow case selection from teardown handler.
This can be used for arbitrary ordering of test cases.
2016-04-28 15:21:04 -05:00
Niklas Hauser 494c303da5 Remove C++11 member initializers. 2016-04-28 15:21:00 -05:00
Niklas Hauser 2fdf733292 Update documentation. 2016-04-28 15:20:56 -05:00
Niklas Hauser d33aabf7ac Handle failure to schedule callback asynchronously. 2016-04-28 15:20:52 -05:00
Niklas Hauser 95462c1d7c Use scheduler interface in harness.
The default implementation uses MINAR as the underlying scheduler,
however, by declaring `config.utest.use_custom_scheduler = true`
MINAR is not included by default.
2016-04-28 15:20:48 -05:00
Niklas Hauser 589dd7b509 Add scheduler interface with documentation. 2016-04-28 15:20:44 -05:00
Niklas Hauser 2e71820fa9 Cleanup confusing default handler namings. 2016-04-28 15:20:40 -05:00
Niklas Hauser 6b692dd5fa Use return value of test setup handler to choose start case. 2016-04-28 15:20:36 -05:00
Niklas Hauser 50917538eb Add `REASON_CASE_INDEX` failure reason. 2016-04-28 15:20:31 -05:00
Niklas Hauser 014b3fef1f Use negative numbers for `status_t`. 2016-04-28 15:20:26 -05:00
Niklas Hauser 2ee605a4ec Update documentation of greentea default handlers. 2016-04-28 15:20:22 -05:00
Niklas Hauser 31a5cf9c34 Also `exit(1)` on test failure. 2016-04-28 15:20:17 -05:00
Niklas Hauser ad8eaadb8f exit(result) after harness finished. 2016-04-28 15:20:13 -05:00
Przemek Wirkus b1af815f49 Add support for greentea-client 2016-04-28 15:20:09 -05:00
Przemek Wirkus 5369d33ae2 Expect FAIL test cases. Merge and squash changes from Niklas
From @niklas-arm:
* Report success to greentea for expected failures.
* Use the greentea setup handlers for correct reporting.
* Remove GREENTEA_START() from all tests.
* Reorder greentea_send_kv to be more readable.
2016-04-28 15:20:05 -05:00
Przemek Wirkus 59fc24ccb2 Refactor failure_handler(s) 2016-04-28 15:20:01 -05:00
Przemek Wirkus 93efc09f4c Replace verbose_case_teardown_handler with greentea counterparts 2016-04-28 15:19:57 -05:00
Przemek Wirkus 982a06cf33 Port tests to Async API feature 2016-04-28 15:19:53 -05:00
Przemek Wirkus 2fc2c1fbcc Modify module configuration 2016-04-28 15:19:49 -05:00
Niklas Hauser 01040bb9bf Do not report failure with uninitialized harness.
Calling `raise_failure` before harness is initialized can print
unintentional failure strings.
This disallows using Unity macros outside of the utest harness.
2016-04-28 15:19:44 -05:00
Martin Kojtal 4db0ec48c3 Case - add control handler check to is_empty() 2016-04-28 15:19:41 -05:00
Niklas Hauser 110b13e8b5 Properly deprecate `FAILURE_` enumerations. 2016-04-28 15:19:37 -05:00
Niklas Hauser 3aaa6c903b Update documentation and changelog. 2016-04-28 15:19:33 -05:00
Niklas Hauser e68d00ded5 Add location to failure information.
Rename `failure_t` to `failure_reason_t`.
Add `location_t` with stringify function.
Add new `failure_t` struct with location information.
Adapt harness logic to keep track of location.
Add a test failure handler that reports assertion failures
on test setup and test teardown.
2016-04-28 15:19:29 -05:00
Niklas Hauser 5a052a523a Fixed premature validation attribute modification. 2016-04-28 15:19:25 -05:00
Niklas Hauser 7f9f0d81ab Allow case attribute modification in callback validation. 2016-04-28 15:19:21 -05:00
Niklas Hauser 3abe3b04cf Fix default handler initialization value. 2016-04-28 15:19:17 -05:00
Niklas Hauser d5c8b80e73 Replace `repeat_count` with `call_count`.
This aims to reduce confusion over repeat vs. call counting, and
the resulting off-by-one error due to different user expectations.
2016-04-28 15:19:13 -05:00
Niklas Hauser 15f3ccad1b Add constants to `{default|ignore}_handler`.
This is better than explicitly casting to the handler you want.
2016-04-28 15:19:08 -05:00
Niklas Hauser aca2e920e3 Types: Add `CaseNoRepeat` and `CaseNoTimeout` aliases. Add combination unit tests for aliases and fix bugs.
This allows inline use of these properties.

Example:
`CaseTimeout(ms) + (repeat_count < 100 ? CaseRepeatAll : CaseNoRepeat);`
2016-04-28 15:19:05 -05:00
Niklas Hauser ea2befaeee Test: Fix control_t behavior and assert with test. 2016-04-28 15:19:01 -05:00
Niklas Hauser d2093f1ddc Types: Add type-compatible Timeout factory functions. Add CaseAwait behavior for infinite timeouts. Improve enum naming. 2016-04-28 15:18:57 -05:00
Niklas Hauser 49952824fb Handlers: Add specialized functions for all handlers.
Most of them simply forward to the verbose handlers,
however, should we decide differently in the future,
existing unit tests will not have to be adapted.
2016-04-28 15:18:53 -05:00
Niklas Hauser 34571488a6 Harness: Fix case index counting. 2016-04-28 15:18:49 -05:00
Niklas Hauser 17c89289a1 Harness: Fix bugs in repeat logic. 2016-04-28 15:18:45 -05:00
Niklas Hauser 205233a6db Repeat: Allow repeat on timeout and validation at the same time. 2016-04-28 15:18:41 -05:00
Niklas Hauser bc25003d41 Unity: Add failure ignoring callback. 2016-04-28 15:18:38 -05:00
Niklas Hauser 633588dc35 Handlers: Add test failure handler to allow selftest. 2016-04-28 15:18:34 -05:00
Niklas Hauser 105d07b552 Harness: Allow generic ignoring of failures. 2016-04-28 15:18:30 -05:00
Niklas Hauser 67e271f292 Harness: Implement test case repeat on timeout.
This is particularly useful for network unittests that may timeout, but
are allowed to retry a number of times, before being declared a failure.
2016-04-28 15:18:25 -05:00
Niklas Hauser dc242ee280 Harness: Atomic execution of handlers not necessary. 2016-04-28 15:18:20 -05:00
Niklas Hauser 0b93efe7f6 Return whether the specification can be run or not. Do not die after specification teardown handler. 2016-04-28 15:18:16 -05:00
Niklas Hauser 4e5996ceea Allow starting a specification at a different case.
This can be used to skip failing test cases with external support from
a test runner like greentea.
It would reset the device and execute the specification again, but start
at the next test case.
2016-04-28 15:18:12 -05:00
Niklas Hauser c2343b223b Update namespace from v0 to v1. 2016-04-28 15:18:08 -05:00
Niklas Hauser d59284850d Fix off-by-one error in case indexing. 2016-04-28 15:18:03 -05:00
Niklas Hauser dc8c336652 Refactor all include guards to `UTEST_*`. 2016-04-28 15:17:59 -05:00
Niklas Hauser 13987f8101 Adapt include path for header file move to `utest`. 2016-04-28 15:17:55 -05:00