Commit Graph

117 Commits (251a27094295b9be56885334189850602c449150)

Author SHA1 Message Date
David Saada 542744d03c Support erase value in Flash HAL drivers, FlashIAP and block devices 2018-11-07 14:23:07 +02:00
kegilbert a2ac895c37 This reverts commit 9b53d1256fb358407acbaf81c70b71d937b1f7cd.i
Move the memory tracing enabled macro to a config option but
revert the !defined -> #if changes to no longer cause breaking
changes.
2018-10-26 17:35:33 -05:00
Martin Kojtal bbfa322afb tests: fix astyle 2018-10-25 09:58:17 +01:00
Kevin Bracey 1ef213ec89 Clean up Thread deprecation warnings
Static Thread methods and signal methods have been deprecated. Remove
all references in the main code, and most of the tests. Some tests of
the deprecated APIs themselves remain.
2018-10-12 14:57:13 +03:00
Cruz Monrreal 1e3e69463f
Merge pull request #7781 from deepikabhavnani/crc_safety
Add thread safety to CRC class
2018-08-29 15:42:23 -05:00
Cruz Monrreal 1b051c7687
Merge pull request #7402 from kegilbert/mem-tracing-config-patch
Replace mbed_mem_tracing_enabled macro with config option
2018-08-27 10:34:24 -05:00
Martin Kojtal a24cecfc94
Merge pull request #7805 from jamesbeyond/fm_test
Skip Greentea tests for Mbed OS code coverage on Fast Models
2018-08-27 10:39:43 +02:00
Qinghao Shi c9ac4868ac move test skipping macro for FastModels to top of the test 2018-08-23 22:30:55 +01:00
Qinghao Shi 0ad1934f32 move test skipping macro to case array section 2018-08-22 17:48:03 +01:00
deepikabhavnani 986411ccb0 Add thread safety to CRC class
Thread safety is added to serialize the hardware CRC and will not
impact the software CRC.
2018-08-21 15:26:05 -05:00
Cruz Monrreal e02466a77a
Merge pull request #7524 from c1728p9/tickless_fix
Fixes for tickless and LPTICKER_DELAY_TICKS
2018-08-21 10:03:41 -05:00
Qinghao Shi 891c4ed244 Skip time drifting test on FastModels targets
FastModels targets are simulator running on the x86 hosts.
As the nature of non-RealTime x86 OS and FastModels, timing accuracy is not guaranteed
So skipping the time drifting tests on FastModel targets
2018-08-17 17:46:28 +01:00
Russ Butler 472ababfef Update deep sleep lock check in tests
When the define LPTICKER_DELAY_TICKS is set deep sleep can be randomly
disallowed when using the low power ticker. This is because a Timer
object, which locks deep sleep, is used to protect from back-to-back
writes to lp tickers which can't support that. This causes tests which
assert that deep sleep is allowed to intermittently fail.

To fix this intermittent failure this patch adds the function
sleep_manager_can_deep_sleep_test_check() which checks if deep sleep
is allowed over a duration. It updates all the tests to use
sleep_manager_can_deep_sleep_test_check() rather
than sleep_manager_can_deep_sleep() so the tests work even if deep
sleep is spuriously blocked.
2018-08-17 09:29:41 -05:00
David Saada 876b5f755b FlashIAP & NVStore tests: Skip test if overwriting code in flash. 2018-08-16 21:59:45 +03:00
Nir Sonnenschein 2b8eb5ec0e
Merge pull request #7752 from maciejbocianski/timer_test_fix
tests-mbed_drivers-timer: change delay method
2018-08-14 19:42:43 +03:00
Maciej Bocianski efe9e44208 tests-mbed_drivers-timer: change delay method 2018-08-10 09:52:07 +02:00
jeromecoutant f532159b61 Timeout tests : unstable result
RTX waits, such as sem.wait(N), delays for between N-1 and N cycles.
As lp_ticker is not so accurate as us_ticker,
sometines, wait is expiring just before the lp_timeout.
2018-08-09 10:13:17 +02:00
kegilbert 9b53d1256f Replace mbed_mem_tracing_enabled macro with config option 2018-08-06 13:44:12 -05:00
Martin Kojtal e52bb68f93 tests: astyle fix
All tests should comply to our coding standard now
2018-08-03 10:23:38 +01:00
Cruz Monrreal 8f7024a226
Merge pull request #7383 from davidsaada/david_flashiap_timing_test
FlashIAP: Add timing test
2018-08-02 23:08:54 -05:00
David Saada 7cf5b3a008 FlashIAP: Add timing test 2018-08-02 18:39:07 +03:00
Przemyslaw Stekiel 6874fde3d3 TESTS-MBED_DRIVERS-TIMER: include ticker_free() function in the ticker interface. 2018-08-02 09:48:36 +02:00
Przemyslaw Stekiel b1b4f6e2ad tests-mbed_drivers-lp_timer: change delay method
The test sometimes fails on NRF51_DK (test case: "Test: LowPowerTimer - time measurement 1 ms.") in morph tests.

The test verifies if LowPowerTimer class correctly counts elapsed time. Sometimes we got measured ~1600 us for delay 1000 us (delta 550 us).
The delay is performed using `wait_us()` function which for delays greater than or equal to 1 ms (our case) calls `Thread::wait((uint32_t)ms);`. This causes rescheduling and potentially can put board into sleep (deep sleep mode is disabled by `wait_us()`). For our test purposes we don't need rescheduling/sleep since this actions takes extra time and have influence on the time measurement accuracy.
The solution is to implement function for delay which is based on busy loop and uses us ticker. It has been verified that this solves the problem. With this fix when measurement of 1 ms is repeated 1000 times we got usually measured time equal to ~1080 us, and sometimes ~1300us (checked that this is caused by systick interrupt handling). Since this is test for drivers layer and the results are acceptable I decided to not disabling systick in the test).
2018-07-11 11:44:27 +02:00
ccli8 39a6fa9609 Enlarge wait time in Greentea test function test_deepsleep
Original wait time is not enough for UART to flush out before deepsleep on some targets.
2018-06-19 09:23:53 +08:00
Cruz Monrreal 6999d25f4d
Merge pull request #6935 from maciejbocianski/ticker_test_fix
ticker test improvement
2018-06-13 08:46:41 -05:00
Maciej Bocianski 27bf6cff4f ticker test improvement
Make multiticker test more reliable when scheduling very early interrupts.
When very early interrupt is scheduled (e.g now + 2[ticks]) then it's likely
that it won't be fired in some circumstances and as a result there is overdue
event in queue. That overdue event can be mistakenly scheduled again by
`Ticker::detach` (detach calls schedule if head was removed). That's why we
should check interrupts counter immediately after wait period and before detach loop
2018-06-08 15:37:59 +02:00
Wilfried Chauveau 3745c73e91 set the tolerance to 5% if NO_SYSTICK is enabled 2018-05-31 13:05:37 +01:00
Przemyslaw Stekiel 500be1fbac Fix tolerance definition in ticker tests. 2018-05-25 13:04:23 -05:00
Przemyslaw Stekiel 06c6db5119 tests-mbed_drivers-lp_timer: modify tolerance to percentage form
Represent tolerance value as it is done in `tests-mbed_drivers_timer`.
Use 5% tolerance for lp ticker.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel a0a07d9725 tests-mbed_drivers-timerevent: increase tolerance for NRF52_DK
Test inserts event into the TimerEvent object which is scheduled 50 ms in the future. Then test thread hangs on the semaphore for 51 ms and after that time we expect that event handler has been executed. This test fails sometimes on NRF51_DK, NRF52_DK since different clocks are used for event handling and delay. TimerEvent class uses fast us ticker and semaphores are based on lp ticker (NRF51_DK) or System Tick Timer (NRF52_DK).
We assume that ticker measurement error is 10% and our 1 [ms] extra corresponds to 2% error. I suggest to increase delay to 2 [ms] (4%). This should be enough for all boards at this moment.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel 75df9ecd19 tests-mbed_drivers-lp_ticker: increase tolerance for NRF51_DK
This test fails sometimes while testing 1 ms timeout on NRF51_DK board.
This board is very slow and lp ticker is inaccurate.
I noticed that measured results are very close to the tolerance value. For 1ms delay we measure in failure case 1560 us and tolerance is set to 550.
Since measurement method is also significantly flawed (extra time for setting up ticker and execution of a ticker irq handler) I recommend to increase tolerance by least +100 us for now.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel a3d5921515 tests-mbed_drivers-timerevent: Disable deep-sleep mode in TestTimerEvent class.
Since now us ticker is disabled in deep-sleep mode and tests-mbed_drivers-timerevent verifies TimerEvent class which uses us ticker then deep-sleep mode needs to be disabled during the test execution.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel 79f219bb3d tests-mbed_drivers-timer: Adapt tolerance for new Ticker driver
Since this change concerns new ticker driver for NRF51_DK it goas on ticker feature branch.

On this branch us ticker is based on 1 MHz higher precision counter (on master is based on 32kHz RTC). As a result of using higher precision counter measurement error increased:
:485::FAIL: Expected 1.060000 Was 1.070478

For delay 1060 ms we measured ~1070 ms so we have about ~1% measurement error which is not bed for this board.

To make it work with 1MHz us ticker increase test tolerance. Define tolerance as follows:
tolerance  = 500us + 0.02 * delay.
2018-05-25 12:29:55 -05:00
Przemyslaw Stekiel b524a7f8d9 tests-mbed_drivers-lp_ticker: Adapt tolerance for new Ticker driver
Since this change concerns new ticker driver for NRF51_DK it goas on ticker feature branch.

On master NRF51_DK Ticker driver uses 32kHz RTC for lp and us ticker. Test uses us ticker to measure lp ticker interrupt scheduling (LowPowerTicker.attach), but since the same hardware is used for both tickers the measurement error is constant. On this branch us ticker uses 1 MHz higher precision clock and the results are different - measurement error grows linearly and shows inaccuracy of the RTC.
Test implements constant delta for measured time equal to 2000 us.

Change delta so it depends on lp ticker tested timeout value:
500us for measurement inaccuracy + 5% tolerance for LowPowerTicker
2018-05-25 12:29:54 -05:00
Przemyslaw Stekiel 2323486bf3 tests-mbed_drivers-timerevent: perform test only if USTICKER support is enabled. 2018-05-25 12:29:54 -05:00
Bartek Szatkowski a92ff94904 Fix rebase error 2018-05-25 12:20:10 -05:00
Bartek Szatkowski 6e9f04bf2f Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
That's to match DEVICE_USTICKER.
2018-05-25 12:20:09 -05:00
Przemyslaw Stekiel b7fdf60f29 Skip higher level ticker tests for targets with stale ticker target specific drivers.
Since target specific ticker drivers are not ready also features which uses ticker in upper layers may not work correctly and tests for these features.
We need to disable also failing higher level ticker related tests (by adding check if DEVICE_USTICKER symbol is available and raise #error [NOT_SUPPORTED] if not).

Note:
tests-mbed_drivers-rtc is new and uses us ticker to perform a delay.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel 7227670416 Skip higher level ticker tests for targets with stale ticker target specific drivers.
Since target specific ticker drivers are not ready also features which uses ticker in upper layers may not work correctly and tests for these features.
We need to disable also failing higher level ticker related tests (by adding check if DEVICE_USTICKER symbol is available and raise #error [NOT_SUPPORTED] if not).
2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel 785e5d30a2 Disable `tests-mbed_drivers-timeout` test if USTICKER support is disabled (NRF52_DK). 2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel 48a769dbb3 Disable `tests-mbed_drivers-timerevent` test if USTICKER support is disabled. 2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel 3cd3defbba Disable boards which does not fulfil new sleep standards.
These boards will be re-enabled when sleep driver for them is ready.

Note:
This operation is done by removing "SLEEP" feature from target's "device_has" list (in targets.json config file).
For NRF52_DK removing of "SLEEP" feature causes some timing issues which have influence on tests. In order to successfully disable this board we need to disable also related features like "USTICKER", "LOWPOERTIMER" and slightly modify ticker tests, so they will not be executed if usticker support is not available (by default all targets support us ticker).
2018-05-25 12:04:32 -05:00
Cruz Monrreal 15ff9a8bf7
Merge pull request #6864 from davidsaada/david_flashiap_unaligned_src
FlashIAP: Fix problem of programming source buffer not aligned to 4
2018-05-14 10:35:38 -05:00
David Saada 9cdecf4d5a FlashIAP: Fix problem of programming source buffer not aligned to uint32_t 2018-05-10 12:00:29 +03:00
Przemyslaw Stekiel 2ccc11f243 tests-mbed_drivers-rtc: Add one second tolerance in functional tests.
Currently test assumes that 1 sec is long enough to set RTC time and read same time which has been set.
In some cases extra time for synchronisation between clock domains is needed and after setting/reading operations the read value might be different than one which has been set (+1 sec).
Additionally in some cases when lp ticker is based on RTC, the RTC implementation may use mechanism to trace elapsed seconds without modifying RTC registers. In such case it is possible that second will change immediately after setting time.

Add 1 sec tolerance (min possible) for such checks.
2018-05-09 14:41:40 +02:00
deepikabhavnani d43d9b134b Moved stats test to platform folder 2018-05-01 14:03:31 -05:00
Brian Daniels 631e5ebdee Modifying echo test to be driven more from the device.
Previously, the echo test followed a flow like the following:

-STEP-	-HOST PC-                  -DEVICE-
0	send _sync
1				   echo back _sync
2				   send echo_count
3	echo back echo_count
4	send first echo packet
5				   echo back echo packet
	(repeat echo steps)

However, as noted by issue #6659, this test would somtimes fail between
steps 4 and 5. To ensure each KV pair makes to the correct destination,
we usually write the KV back. Step 4 does not wait for this to happen
and starts sending echo packets. So the device is acting as the "echo
server".

This change makes the host PC the "echo server". The idea being that the
device will be slower and the host pc should always be able to keep up
with it, not the other way around.
2018-04-23 17:56:13 -05:00
Deepika bf0393aaa9 Added test for MbedCRC.h 2018-03-23 14:54:24 -05:00
Filip Jagodzinski 82f781ce3d Tests: Drivers: Timeout: Update unit tests
Added unit tests for Timeout API.
Added unit tests for LowPowerTimeout API.
Moved all existing test cases to a header file.
2018-02-28 17:27:46 +01:00
Cruz Monrreal 3d37d819e9
Merge pull request #5046 from fkjagodzinski/timerevent_tests
TimerEvent tests
2018-02-26 15:02:52 -06:00