Commit Graph

78 Commits (4d59c8857de83f679c94a57987f62b91c000f5e1)

Author SHA1 Message Date
Brian Daniels e678325730 Modifying timing tests to use timing drift host test 2016-08-30 14:53:18 -05:00
Brian Daniels f6c60d07ac Adding timing drift host test 2016-08-30 14:38:30 -05:00
Brian Daniels 6e223e311c Removing threaded_blink test (duplicate of basic rtos test) 2016-08-30 14:37:30 -05:00
Russ Butler 69431da0c7 Add a test to check for init race conditions
Test SingletonPtr initailization along the with lazy initailization
that is built into the C++ language itself.
2016-08-30 11:23:11 -05:00
Vincent Coubard a9d9987d7c Fix a rare case of imcompatibility between base_control_t and control_t.
Both branches of a ternary operator should yield the same type;
compatibility is not enough in that case.
2016-08-30 13:29:19 +01:00
Christopher Haster 756a09003c Added explicit void specialization in callbacks
One limitation of C++ is that implicit casts do not occur when
matching template overloads, as a consequence the callback's
argument type requires a strict match.

Unfortunately, the prevents the previously common pattern of using
void pointers as function arguments, causing unnecessary problems
for users porting code.

        Thing *t;
        void doit(void *p) { blablabla }

        Callback<void()> cb(t, doit);

To avoid this, explicit overloads on void pointers were added. This
avoids a template expansion, and allows the implicit cast to occur
as the user would expect.
2016-08-26 12:50:13 -05:00
Christopher Haster 5c0f39f190 Split callback test into multiple tests based on types
As the templated tests grew, the resulting binary exceeded a
flash size of 64K. This caused the test to incorrectly fail on
small devices.

Moved and split into the following:
TESTS/mbed_functional/callback
TESTS/mbed_functional/callback_small
TESTS/mbed_functional/callback_big
TESTS/mbed_functional/functionpointer
2016-08-26 09:54:13 -05:00
Christopher Haster c71e67f2dc Updated minor functionality of the Callback class
- Marked `call` and `operator()` functions as const
- Moved to static_cast for internal function pointer to avoid losing
  compiler checked const-safety
- Added test for `operator=` with non-callback types
- Moved from zero-cast to value-initializer when callback is null
- Added `operator==` and `operator!=`
- Removed special handling of null callback
- Replicated doxygen to all overloads
- Added correct nops where uninitialized callbacks are called
- Added assertion for null callback
- Removed copy-constructor from callback constructor
2016-08-26 09:54:02 -05:00
Bogdan Marinescu 1e3cbc909b Added tests for the memory tracer 2016-08-26 09:42:40 -05:00
Christopher Haster 45d25ed493 Added support for cv-qualifiers in Callback class
Additionally, the following changes were don to avoid combinatorial
explosion in function overloads as a result of adding cv-qualifiers:
- Added convenience function for inferred type
- Deprecated callback overloads qhere cv-qualifiers are not scalable

Supported overloads:
callback(void (*f)(A...));
callback(const Callback<R(A...)> &);
callback(T *t,                void (*f)(T*, A...));
callback(const T *t,          void (*f)(const T*, A...));
callback(volatile T *t,       void (*f)(volatile T*, A...));
callback(const volatile T *t, void (*f)(const volatile T*, A...));
callback(T *t,                void (T::*f)(A...));
callback(const T *t,          void (T::*f)(A...) const);
callback(volatile T *t,       void (T::*f)(A...) volatile);
callback(const volatile T *t, void (T::*f)(A...) const volatile);
2016-08-26 09:40:22 -05:00
Sam Grove 3dac791b4a Merge pull request #2476 from bulislaw/lp_ticker
K22F/K64F: Add lp_ticker implementation and HAL lp_ticker tests
2016-08-25 09:19:18 -05:00
Bartek Szatkowski 7203be9e6f Add tests for LowPowerTimeout and lp_ticker 2016-08-25 13:25:02 +01:00
Russ Butler 6a31ffbf3e Heap statistics
Keep track of the current size allocated, maximum size allocated,
number of allocations, failed allocations and total size allocated for
both GCC and ARM. Report the maximum size allocated at the end of
testing.

Also, add a test to verify heap metrics are working as expected.
2016-08-22 18:32:51 -05:00
Martin Kojtal 64a30a0095 Merge pull request #2479 from geky/deprecated-until
Updated deprecation notices to match branch names
2016-08-18 09:06:39 +01:00
Martin Kojtal 8568c9eac8 Merge pull request #2394 from geky/deprecated-until
Add more well-defined garuntees on deprecation notices in mbed
2016-08-17 14:45:46 +01:00
Christopher Haster b12c27c5b4 Updated deprecation notices to match branch names
Example:

    MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
    void foo(int arg);
2016-08-16 20:30:20 -05:00
Christopher Haster 0f516aa8e0 Added more well-defined garuntees on deprecation notices in mbed
From the discussion on issue #2068:
Functions marked deprecated in the mbed library should notate when
the deprecation was started to allow efficient removal once a set
amount of time has expired.

Added the following macro:
MBED_DEPRECATED_SINCE("version", "message string")

Example usage:

    MBED_DEPRECATED_SINCE("v5.1", "don't foo any more, bar instead")
    void foo(int arg);

Adopted in existing deprecations:
- FunctionPointer
- RtosTimer
- Thread
2016-08-16 15:45:51 -05:00
Russ Butler 13c06850a2 Add a test for thread-safe malloc
Add a test to repeatedly malloc and free from different threads to
test if these functions are thread safe.
2016-07-29 20:14:07 -05:00
Vincent Coubard a7d1bf7364 Update thread stack size for NRF based targets in rtos tests. 2016-07-28 21:21:31 +01:00
Sam Grove c24e461be3 Merge pull request #2248 from pan-/define_stack_stize_for_RTOS_threads_test
Define stack size of the threads spawned by RTOS threads test.
2016-07-26 20:14:51 -05:00
Vincent Coubard 2099da6d58 Define stack size of the threads spawned by this test.
This stack size is adjusted for NRF51 and NRF52 based targets.
2016-07-25 23:56:14 +01:00
Vincent Coubard 5676cccc7c Define stack size for NRF52. 2016-07-25 23:46:35 +01:00
Sam Grove 0675a58009 Merge pull request #2241 from pan-/fix_stack_definitions
Bring missing stack definitions for various targets.
2016-07-25 14:02:42 -05:00
Vincent Coubard 1752f23ff8 Remove double #else statement 2016-07-25 13:24:57 +01:00
Vincent Coubard d2e683cc1e Bring missing stack definitions for various targets.
Those definitions where available in libraries/test/rtos/mbed/* tests but
not in TESTS/mbedmicro-rtos-mbed/* tests.
2016-07-25 11:57:26 +01:00
Vincent Coubard 80ead8ca1a Fix behavior when mbed-os RTOS tests are build while the system is single
threaded.

For mbed micro, if the MBED_RTOS_SINGLE_THREAD is defined then the
compilation of the test will fail with the info
	[NOT_SUPPORTED] test not supported

This patch bring this behavior to mbed-os RTOS tests.
2016-07-25 11:41:00 +01:00
Christopher Haster 8e60fdd919 Added tests for cv-qualifier c-objects in Callback class 2016-07-20 19:27:38 -05:00
Brian Daniels a9eb39dee4 Adding test frameworks and test sources
This commit adds the following test frameworks:

- `greentea-client` (https://github.com/ARMmbed/greentea-client)
  - This framework provides a key-value api for communicating with the
    greentea test tool (https://github.com/ARMmbed/greentea)
- `unity` (https://github.com/ARMmbed/unity)
  - This framework provides test assert macros that can be used when
    writing test cases
- `utest` (https://github.com/ARMmbed/utest)
  - This framework allows you to execute a series of test cases with
    reporting that works with the greentea test tool
    (https://github.com/ARMmbed/greentea)

The following changes were made when bringing these frameworks into the
tree:

- References to `mbed_drivers/mbed.h` within utest's tests were migrated
  to `mbed.h`
- The yotta file `module.json` was removed from `greentea-client` and
  `unity`
  - `coverage.json` was also removed from `greentea-client`
- `.gitignore` and `.gitattributes` were removed from `greentea-client`
- Apache 2.0 license files were removed from `greentea-client`

This also brings in a number of tests that have been newly written or ported from various sources:

- `TESTS/integration` - Very basic tests, used to check if testing frameworks are working correctly
- `TESTS/mbed_drivers` (Thanks @PrzemekWirkus!) - TESTS ported from mbed OS 3.0 (https://github.com/ARMmbed/mbed-drivers)
- `TESTS/mbedmicro-mbed` (Thanks @PrzemekWirkus!) - Tests that weren't covered by `TESTS/mbed_drivers` that currently live in `libraries/tests/mbed`
- `TESTS/mbedmicro-rtos-mbed` (Thanks @PrzemekWirkus!) - Ported tests that currently live in `libraries/tests/rtos/mbed`
- `TESTS/storage_abstraction` (Thanks @rgrover!) - Tests for the storage_abstraction hal
2016-07-20 12:41:26 -05:00