Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a HAL set_time() test #8094

Closed
wants to merge 1 commit into from
Closed

Add a HAL set_time() test #8094

wants to merge 1 commit into from

Conversation

TacoGrandeTX
Copy link
Contributor

@TacoGrandeTX TacoGrandeTX commented Sep 11, 2018

Description

This is the HAL test requested for #7849.

Without DEVICE_RTC defined set_time() was not being tested. When DEVICE_LPTICKER is defined set_time() only works correctly on the first call. This test calls set_time() twice and ensures the time set by both calls is correct.

Here is the test output on the nRF52_DK (where the problem was identified):

$ mbed test -m nrf52_dk -t arm -n mbed-os-tests-mbed_hal-rtc_time -c
...

Build successes:
  * NRF52_DK::ARM::MBED-BUILD
  * NRF52_DK::ARM::MBED-OS-TESTS-MBED_HAL-RTC_TIME
mbedgt: greentea test automation tool ver. 1.3.3
mbedgt: test specification file 'C:\_nrf\greentea\BUILD\tests\NRF52_DK\ARM\test_spec.json' (specified with --test-spec option)
mbedgt: using 'C:\_nrf\greentea\BUILD\tests\NRF52_DK\ARM\test_spec.json' from current directory!
mbedgt: detecting connected mbed-enabled devices...
mbedgt: detected 1 device
mbedgt: processing target 'NRF52_DK' toolchain 'ARM' compatible platforms... (note: switch set to --parallel 1)
mbedgt: test case filter (specified with -n option)
        mbed-os-tests-mbed_hal-rtc_time
        {u'mbed-os-tests-mbed_hal-rtc_time': <mbed_greentea.tests_spec.Test instance at 0x0432DE18>}
        test filtered in 'mbed-os-tests-mbed_hal-rtc_time'
mbedgt: running 1 test for platform 'NRF52_DK' and toolchain 'ARM'
mbedgt: mbed-host-test-runner: started
mbedgt: checking for GCOV data...
mbedgt: test on hardware with target id: 000682276342
mbedgt: test suite 'mbed-os-tests-mbed_hal-rtc_time' ................................................. OK in 21.23 sec
        test case: 'test is leap year - RTC leap years full support' ................................. OK in 0.09 sec
        test case: 'test is leap year - RTC leap years partial support' .............................. OK in 0.07 sec
        test case: 'test local time - invalid param' ................................................. OK in 0.06 sec
        test case: 'test make time - invalid param' .................................................. OK in 0.05 sec
        test case: 'test make time boundary values - RTC leap years full support' .................... OK in 0.09 sec
        test case: 'test make time boundary values - RTC leap years partial support' ................. OK in 0.09 sec
        test case: 'test set_time twice' ............................................................. OK in 2.05 sec
mbedgt: test case summary: 7 passes, 0 failures
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.9738552186
mbedgt: test suite report:
+--------------+---------------+---------------------------------+--------+--------------------+-------------+
| target       | platform_name | test suite                      | result | elapsed_time (sec) | copy_method |
+--------------+---------------+---------------------------------+--------+--------------------+-------------+
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | OK     | 21.23              | default     |
+--------------+---------------+---------------------------------+--------+--------------------+-------------+
mbedgt: test suite results: 1 OK
mbedgt: test case report:
+--------------+---------------+---------------------------------+-----------------------------------------------------------------+--------+--------+--------+--------------------+
| target       | platform_name | test suite                      | test case                                                       | passed | failed | result | elapsed_time (sec) |
+--------------+---------------+---------------------------------+-----------------------------------------------------------------+--------+--------+--------+--------------------+
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test is leap year - RTC leap years full support                 | 1      | 0      | OK     | 0.09               |
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test is leap year - RTC leap years partial support              | 1      | 0      | OK     | 0.07               |
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test local time - invalid param                                 | 1      | 0      | OK     | 0.06               |
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test make time - invalid param                                  | 1      | 0      | OK     | 0.05               |
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test make time boundary values - RTC leap years full support    | 1      | 0      | OK     | 0.09               |
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test make time boundary values - RTC leap years partial support | 1      | 0      | OK     | 0.09               |
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | test set_time twice                                             | 1      | 0      | OK     | 2.05               |
+--------------+---------------+---------------------------------+-----------------------------------------------------------------+--------+--------+--------+--------------------+
mbedgt: test case results: 7 OK
mbedgt: completed in 23.69 sec

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Functionality change
[ ] Breaking change

Without DEVICE_RTC defined set_time() was not being tested. When
DEVICE_LPTICKER is defined set_time() only works correctly on
the first call. This test calls set_time() twice and ensures the
time set by both calls is correct.
@TacoGrandeTX
Copy link
Contributor Author

Forgot to supply the failing test output:

The failing verbose output (without PR #7849):

[1536763888.73][CONN][RXD] >>> Running case #7: 'test set_time twice'...
[1536763888.78][CONN][INF] found KV pair in stream: {{__testcase_start;test set_time twice}}, queued...
[1536763890.81][CONN][RXD] :194::FAIL: Expected 1 Was 0
[1536763890.86][CONN][INF] found KV pair in stream: {{__testcase_finish;test set_time twice;0;1}}, queued...
[1536763890.93][CONN][RXD] >>> 'test set_time twice': 0 passed, 1 failed with reason 'Assertion Failed'
[1536763890.93][CONN][RXD]
[1536763891.01][CONN][RXD] >>> Test cases: 6 passed, 1 failed with reason 'Assertion Failed'
[1536763891.03][CONN][RXD] >>> TESTS FAILED!
...
mbedgt: test suite 'mbed-os-tests-mbed_hal-rtc_time' ................................................. FAIL in 21.18 sec
        test case: 'test is leap year - RTC leap years full support' ................................. OK in 0.08 sec
        test case: 'test is leap year - RTC leap years partial support' .............................. OK in 0.08 sec
        test case: 'test local time - invalid param' ................................................. OK in 0.06 sec
        test case: 'test make time - invalid param' .................................................. OK in 0.06 sec
        test case: 'test make time boundary values - RTC leap years full support' .................... OK in 0.09 sec
        test case: 'test make time boundary values - RTC leap years partial support' ................. OK in 0.10 sec
        test case: 'test set_time twice' ............................................................. FAIL in 2.08 sec
mbedgt: test case summary: 6 passes, 1 failure
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.3339403916
mbedgt: test suite report:
+--------------+---------------+---------------------------------+--------+--------------------+-------------+
| target       | platform_name | test suite                      | result | elapsed_time (sec) | copy_method |
+--------------+---------------+---------------------------------+--------+--------------------+-------------+
| NRF52_DK-ARM | NRF52_DK      | mbed-os-tests-mbed_hal-rtc_time | FAIL   | 21.18              | default     |
+--------------+---------------+---------------------------------+--------+--------------------+-------------+
mbedgt: test suite results: 1 FAIL
mbedgt: test case report:
...
mbedgt: test case results: 1 FAIL / 6 OK
mbedgt: completed in 23.11 sec
mbedgt: exited with code 1

@TacoGrandeTX
Copy link
Contributor Author

Closing... this is now incorporated into #7849.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants