Commit Graph

518 Commits (e17b1df13d9c3269b838169d6d61912d3d13431d)

Author SHA1 Message Date
Przemyslaw Stekiel a1d92e5168 HAL rtc test: increase test timeout.
Verified that on some platforms 30s is not enough.
2018-05-25 12:49:48 -05:00
Przemyslaw Stekiel 105b0ab851 HAL rtc test: check only if rtc_isenabled() returns 1 in case when init is done.
Since some platforms use RTC for low power timer RTC may be already enabled.
Because of that we will only verify if rtc_isenabled() returns 1 in case when init is done and RTC time is set.
2018-05-25 12:49:48 -05:00
Przemyslaw Stekiel a0f1627316 Update of RTC HAL API tests.
Provide minor fixes for existing test cases.
Add additional test cases.
2018-05-25 12:49:11 -05:00
Russ Butler 1f97f11373 Add documentation and test the HAL RTC API
Add requirements, tests, an example implementation and additional
function documentation to the HAL RTC API.
2018-05-25 12:37:19 -05:00
Bartek Szatkowski efd307fa79 Rename new occurrences of LOWPOWERTIMER to LPTICKER 2018-05-25 12:33:43 -05:00
Przemyslaw Stekiel e7fa5fc599 tests-mbed_hal-flash: optimieze time_cpu_cycles() function
This function should perform instruction cycles count in critical section.
Additionally remove redundant code.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel be098399a8 tests-mbed_hal-flash: Remove 5% extra tolerance for NRF52_DK
NRF52_DK is now based on fast and accurate 1MHz counter.
2018-05-25 12:33:42 -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 50a5e2c1f4 tests-mbed_hal-common_tickers: fix bug in ticker increment test case
It is possible that the difference between base and next tick count on some platforms is greater than 1, in this case we need to repeat counting with the reduced number of cycles (for slower boards).
If number of cycles has been reduced than base tick count needs to be redefined. This operation is missing and is added by this patch.
2018-05-25 12:33:42 -05:00
Bartek Szatkowski 95559ad3e1 Change LPTICKER spec to allow clock freq starting at 4kHz 2018-05-25 12:32:39 -05:00
Przemyslaw Stekiel c18763bb41 tests-mbed_hal-common_tickers: disable os tick while running test cases
It has been noticed on NRF51_DK board that occurrence of system tick have impact on test execution.
NRF51_DK is a slow board with fast us ticker and handling of system tick interrupt takes about 250 us ticker ticks which have huge influence on interrupt tests where interrupt is set to <current count> + 100, 200, 500 ticks.
2018-05-25 12:30:52 -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 4fe068834c tests-events-queue: modify tolerance to percentage form
On some boards without SYSTICK support lp ticker is used to trace system ticks.
Event queue uses system ticker to count delay when callback is to be fired.
New ticker implementation for NRF51_DK provides fast and accurate counter for us ticker which shows inaccuracy of the system ticker(which is based on slow and inaccurate lp ticker). This is why measured error grows linearly and percentage form needs to be used.

Currently we use constant tolerance value equal to: 5 [ms].
This patch modifies tolerance to the following form: 5% of measured time [ms].

In this test the lowest delay is equal to 100 [ms], so 5% corresponds to 5 [ms] tolerance - original value. This means that min tolerance is 5 [ms] so this change should not have negative impact on other targets.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel ff39a9874a tests-mbed_hal-common_tickers: increase overflow protection limit
For NR51_DK US_TICKER_OV_LIMIT needs to be increased since if test is run few times in row sometimes fails. This is because NR51_DK is a slow board (16 MHz) with fast and short us ticker counter 1 MHz/16 bits.
2018-05-25 12:29:55 -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 8979212b78 tests-mbed_hal-lp_ticker: run sleep test only if SLEEP support is enabled. 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
jeromecoutant 26313d8938 tests-mbed_hal-common_tickers_freq : correct overflowCounter value 2018-05-25 12:22:06 -05:00
jeromecoutant d2fff9cab3 tests-mbed_hal-common_tickers_freq : use unsigned long 2018-05-25 12:22:06 -05:00
Przemyslaw Stekiel ea61f9887e tests-mbed_hal-lp_ticker: Add overflow protection. 2018-05-25 12:21:16 -05:00
Russ Butler 9c2d758cda Restore ticker state after each test
Update the ticker common test to clean up after each case by restoring
the ticker IRQ handler. This allows tickers to function normally after
each case has completed.
2018-05-25 12:21:16 -05:00
jeromecoutant 69b51dffaf tests-mbed_hal-lp_ticker : increase time before deep sleep 2018-05-25 12:21:16 -05:00
Przemyslaw Stekiel 85ce887cea lp_us_tickers test: provide minor fixes after review
- count_ticks: fix counter overflow handling,
- count_ticks: use reg_cycles variable in while loop,
- increment test: reduce number of cycles for slow cores if measure process needs to be repeated (difference is greater than 1).
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel f6163a341c lp_us_tickers test: call overflow_protect function in test functions instead test setup handler.
This is done to bypass green-tea setup handler which takes additional time.
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel 8f52816bba lp_us_tickers test: fix overflow protection
On slow targets with fast high frequency tickers like NRF51_DK (16 Mhz CPU/1MHz ticker) time window for test case execution without overflow needs to be increased. Add parameter to `overflow_protect` function to be able to set different time window without overflow for us ticker and lp ticker.
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel 0ecf58f51c lp_us_tickers test: fix `increment test` for slow boards
Increment test proves that ticker counter is incremented by one.
This is done indirectly for high frequency counters where it is impossible to read 'value' and 'value + 1' in two successive ticker reads.
This check is done indirectly by counting ticker ticks elapsed during execution of N cycles of empty while loop. Unfortunately on slow boards with fast tickers like NRF51_DK(16 MHz CPU/1MHz hf ticker) it is possible that for the same N cycles measured number of elapsed ticks in two successive calls is greater than 1. This patch provides fix for such case - measure operation is repeated with the same number of cycles.
2018-05-25 12:20:10 -05:00
Bartek Szatkowski a92ff94904 Fix rebase error 2018-05-25 12:20:10 -05:00
Bartek Szatkowski ba963b4453 Rename lp_us tests to common and hf to microsecond 2018-05-25 12:20:09 -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 f55f9d36fb lp_ticker test - provide lp ticker glitch test case
Test that lp ticker does not glitch backwards due to an incorrectly implemented ripple counter driver.
2018-05-25 12:18:55 -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 6d7aef6bf1 lp_us_tickers test - fix count_ticks() function to give the same results on all compilers
count_ticks() function counts ticker ticks elapsed during execution of N cycles of empty while loop.
In current version N value (cycles) is given as volatile paramater in order to disable possible compiler optimalisation.
There was a problem with measured time on different compilers and additionally results on ARM compiler were unexpected (the difference beetween measured elapsed ticks for the same number of cycles was to large). This might be caused by the memory access in order to store updated variable in memory. To fix this issue given numer of cycles has been stored into register and register is decremented (no memory access).

With this fix count_ticks(NUM_OF_CYCLES, 1) call returns 2500 +/-1 for us ticker ticks using each compiler (K64F).
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel c4cf1f1eae lp_us_tickers test - add tolerance to interrupt time.
On some platforms (e.g. K64F) different counters are used for time measurement and interrupt generation.
Because of that we should relax interrupt test case and give additional time before checking if interrupt handler has been executed.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel e0fcce592c lp_us_tickers test - provide counter overflow protection
Since according to the ticker requirements min acceptable counter size is 12 bits (low power timer) for which max count is 4095, then all test cases must be executed in this time window.
HAL ticker layer handles overflow and it is not handled in the target ticker drivers.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel 9d84143276 Provide fix to the implementation of ticker_overflow_test test case.
The intention was to use ticker_overflow_delta equal to 0 for low power ticker tests and ticker_overflow_delta equal to 50 for high frequency ticker tests. Current implementation is invalid since for devices which provide LOW_POWER_TIMER feature delta is equal to 0 and for devices without this feature delta is equal 50.
2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel 1bd2e517a0 Modify ticker_init_test() to be consistent with the new requirement. 2018-05-25 12:17:49 -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 c32ccf69b1 Add tests for ticker HAL API. 2018-05-25 12:04:32 -05:00
Russ Butler 03d7141797 Add documentation for the HAL Ticker API
Add documentation and test header for the HAL Ticker API.
2018-05-25 12:04:32 -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 2b7d7a822b tests-mbedmicro-rtos-mbed-systimer: execute sleep/deepsleep test cases only when SLEEP support is enabled. 2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel f226ae2fc9 tests-mbed_hal-sleep: decrease delay when testing if us ticker is disabled in deep-sleep mode.
This is done because of possible limitations of lowpower ticker freq/width.
2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel 996374e4dc tests-mbed_hal-sleep: fix formatting. 2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel 7f56bb0c23 tests-mbed_hal-sleep: remove unused variable. 2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel 20a9da5b73 tests-mbed_hal-sleep: use lp ticker data while testing deepsleep. 2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel 160c75d099 tests-mbed_hal-sleep: add lp/us ticker overflow handling. 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
Przemyslaw Stekiel b2d3338ad7 Add test and test header to Sleep HAL API. 2018-05-25 12:03:37 -05:00
Veijo Pesonen 491a7ea03e Fixes findings from Greentea netsocket TCP test cases 2018-05-25 09:39:36 +03:00
Veijo Pesonen 3e11a3e666 Fixes findings from Greentea netsocket UDP test cases 2018-05-25 09:39:36 +03:00
Juha Ylinen 53eb36e729 Fix Greentea WiFi test build issues 2018-05-25 09:39:36 +03:00
Veijo Pesonen 21ec972798 Switches Greentea netsocket test case naming convention
From lowercase to uppercase and drops 'test_'-prefix. Test case
descriptions do also match to TC names now.

Additionally all the TCs are not behing MBED_EXTENDED_TESTS
anymore.
2018-05-25 09:39:36 +03:00
Veijo Pesonen 1b041721a0 Fixes Greentea UDP test cases
udpsocket_echotest.cpp
	udpsocket_echotest_burst.cpp
2018-05-25 09:39:36 +03:00
Veijo Pesonen 4fa57e36fe Greentea TCP test cases - check all socket calls 2018-05-25 09:39:36 +03:00
Veijo Pesonen 1fef1602a2 Adds UDP Greentea test cases
udpsocket_echotest
	udpsocket_echotest_nonblock
2018-05-25 09:39:36 +03:00
Veijo Pesonen a2f5ffa752 Adds UDP Greentea test case
udpsocket_sendto_repeat
2018-05-25 09:39:35 +03:00
Veijo Pesonen 19335741df Adds TCP test case
tcpsocket_send_repeat
2018-05-25 09:39:35 +03:00
Veijo Pesonen 096ed1e451 Adds UDP Greentea test case
udpsocket_sendto_invalid
2018-05-25 09:39:35 +03:00
Veijo Pesonen 420459b8de Removes obsolete TCP and UDP Greentea test cases 2018-05-25 09:39:35 +03:00
Veijo Pesonen aee6b06e0c Adds TCP test case
tcpsocket_echotest
	tcpsocket_echotest_nonblock
2018-05-25 09:38:23 +03:00
Veijo Pesonen df825cb3f9 Adds TCP test case
tcpsocket_connect_invalid
2018-05-25 09:38:23 +03:00
Veijo Pesonen 38b8865bcc Adds TCP and UDP test cases
tcpsocket_open_close_repeat
	udpsocket_open_close_repeat
2018-05-25 09:35:14 +03:00
Veijo Pesonen c86bf1acd0 Adds more TCP and UDP test cases
Adds TCP and UDP test cases

        tcpsocket_open_limit
        udpsocket_open_limit
2018-05-25 09:35:14 +03:00
Juha Ylinen 8e81d0153a Update Greentea WiFi tests
Use similar network interface configuration as used in netsocket tests
Improve test coverage
2018-05-25 09:35:14 +03:00
Veijo Pesonen f04f7c1773 Starts adding more TCP and UDP performance tests
Starts splitting Greentea test suites to TCP and UDP suites and adds
more test cases like

	tcpsocket_echotest_burst
	tcpsocket_echotest_burst_nonblock
	tcpsocket_endpoint_close
	tcpsocket_recv_100k
	tcpsocket_recv_100k
	tcpsocket_recv_timeout
	tcpsocket_send_timeout
	tcpsocket_thread_per_socket_safety
	udpsocket_echotest_burst
	udpsocket_echotest_burst_nonblock
	udpsocket_recv_timeout
	udpsocket_sendto_timeout
2018-05-25 09:35:14 +03:00
Veijo Pesonen 2f410b0ce2 Rely on ARM's and U-Blox's echo servers
Make the server as default. Use the hostnames instead of plain IP addresses.
2018-05-25 09:35:14 +03:00
Cruz Monrreal 527f9a12fd
Merge pull request #6983 from SenRamakri/sen_ErrorHandling_Push2
Standardized Error Handling and Error Codes
2018-05-24 10:57:00 -05:00
Kevin Bracey 13dcef63e3
Merge pull request #6847 from ARMmbed/feature-emac
Merge feature-emac branch into master
2018-05-24 16:47:04 +03:00
deepikabhavnani ea356a6e8c Increased wait time to allow device to sleep
With small wait time at the start, chances are that device does not
enter sleep and idle time is zero. Increasing wait time to make sure
device goes to sleep.
2018-05-23 15:06:17 -05:00
Senthil Ramakrishnan 5ef6728c08 Splitting MBED_ERROR macros to support ones with/without error value argument 2018-05-23 12:21:28 -05:00
Senthil Ramakrishnan 693a6c40bb Refactor error reporting 2018-05-23 12:21:11 -05:00
Senthil Ramakrishnan d4fe75731d Adding mbed prefixes to all macros and functions to avoid namespace conflicts 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 147d9cac4e Test application/cases optimization for some low memory targets, macro changes and test fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan f9c25612ae Fix test failures when trap errors are enabled and other fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan cbfc06577b Fixes to align with naming conventions 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 92df68b1ea Changed variable names for registers to avoid namespace conflicts, build fixes, macros and other fixes 2018-05-23 12:21:09 -05:00
Senthil Ramakrishnan 2e28dd95e1 Change set_error/set_error_fatal to warning/error, add itm support and other changes 2018-05-23 12:21:08 -05:00
Senthil Ramakrishnan 839fef0ad1 Added more tests for error log and error reporting, updated doxygen comments 2018-05-23 12:21:07 -05:00
Senthil Ramakrishnan 9041b475c6 Error handling/logging implementation and tests 2018-05-23 12:21:07 -05:00
Asif Rizwan 657ac3f643 WIFI_EMAC class renamed to OdinWiFiEMAC, Formatting
Revert "in ODIN emac initialization required before connection"
2018-05-23 12:25:21 +03:00
Mika Leppänen fd2c6ba12b Removed EMAC get default instance from EMAC tests
Test environment now uses the EMAC defined by add ethernet interface.
2018-05-23 12:25:20 +03:00
Asif Rizwan 717abf20aa in ODIN emac initialization required before connection 2018-05-23 12:25:19 +03:00
Michael Zhang 162a8c0a00 add-rtl8195am-feature-emac (#6904)
rtl8195am feature emac implementation.
2018-05-23 12:25:18 +03:00
Mika Leppänen e481c5ef75 Added memory manager set to add_ethernet_interface() of test stack
This allows that EMAC memory manager can be used to allocate EMAC driver
memory already after the add_ethernet_interface() call.
2018-05-23 12:24:11 +03:00
Amanda Butler 26f369919b Copy edit README.md
Copy edit changes to README.md, mostly for active voice, consistent tense across docs and style.
2018-05-23 12:24:08 +03:00
Mika Leppänen 026af3a72e Updated emac greentea tests
- Improved markdown
- Set tests to fail if CTP echo server is not present
2018-05-23 12:24:08 +03:00
Mika Leppänen d9a66f1c54 Updated non-blocking connect changes to EMAC greentea test server 2018-05-23 12:24:08 +03:00
Mika Leppänen c1c69be10b Made feature-emac changes to emac greentea tests default code
Removed flagging of the new/old code.
2018-05-23 12:24:05 +03:00
Mika Leppänen 7aebda7a0f Emac greentea tests for feature-emac 2018-05-23 12:24:05 +03:00
Kevin Bracey f584ac3b59 Connectivity test: don't create interface object twice 2018-05-23 12:24:00 +03:00
Martin Kojtal 5d027f4e27
Merge pull request #6857 from deepikabhavnani/cpu_stats
CPU Statistics
2018-05-22 14:30:21 +02:00
Cruz Monrreal 97b1615dcc
Merge pull request #6821 from deepikabhavnani/system_stats
System stats - API addition
2018-05-21 10:16:59 -05:00
Cruz Monrreal 86d04d7b15
Merge pull request #6901 from kivaisan/eventqueue_time_left
events: Introduce API to query how much time is left for delayed event
2018-05-21 10:12:13 -05:00
Kimmo Vaisanen 990da085d9 Introduce API to query how much time is left for delayed event
If user has initiated a delayed event (either with call_in or call_every),
user might need to know how much time is left until the event is
due to be dispatched.

Added time_left() function can be used to get the remaining time.
2018-05-18 12:55:06 +03:00
Deepika 25e2b8838a Added additional read to care of lazyily initialized timer 2018-05-17 10:25:31 -05:00
Cruz Monrreal 77f5c4ac04
Merge pull request #6749 from AndrzejKurek/feature-mbedtls-platform-setup
Add platform setup and teardown calls to mbedtls tests
2018-05-17 10:08:44 -05:00