{"action":"closed","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/5004","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/5004/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/5004/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/5004/events","html_url":"https://github.com/ARMmbed/mbed-os/issues/5004","id":254544355,"number":5004,"title":"Ticker test fails when run under Greentea on NUCLEO_F070RB","user":{"login":"maciejbocianski","id":17130713,"avatar_url":"https://avatars0.githubusercontent.com/u/17130713?v=4","gravatar_id":"","url":"https://api.github.com/users/maciejbocianski","html_url":"https://github.com/maciejbocianski","followers_url":"https://api.github.com/users/maciejbocianski/followers","following_url":"https://api.github.com/users/maciejbocianski/following{/other_user}","gists_url":"https://api.github.com/users/maciejbocianski/gists{/gist_id}","starred_url":"https://api.github.com/users/maciejbocianski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maciejbocianski/subscriptions","organizations_url":"https://api.github.com/users/maciejbocianski/orgs","repos_url":"https://api.github.com/users/maciejbocianski/repos","events_url":"https://api.github.com/users/maciejbocianski/events{/privacy}","received_events_url":"https://api.github.com/users/maciejbocianski/received_events","type":"User","site_admin":false},"labels":[{"id":328051906,"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/devices:%20st","name":"devices: st","color":"0052cc","default":false},{"id":28847979,"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/type:%20bug","name":"type: bug","color":"b60205","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-09-01T06:04:37Z","updated_at":"2017-09-12T16:34:43Z","closed_at":"2017-09-12T16:34:43Z","author_association":"CONTRIBUTOR","body":"Below code fails when run under greentea environment\r\nWhen comiled and run manually (mbed compile -vv -t ARM -m nucleo_f070rb) without greentea works fine\r\n\r\n### Description\r\n- Type: Bug\r\n- Priority: Major\r\n\r\n---------------------------------------------------------------\r\n## Bug\r\n\r\n**Target**\r\nonly NUCLEO_F070RB\r\n\r\n**Toolchain:**\r\nall\r\n\r\n**Expected behavior**\r\nBoth counters are equal to 16\r\n**Actual behavior**\r\nOnly first counter is equal to 16 second one (multi_counter2) has random value below 16\r\n**Steps to reproduce**\r\npaste below code into ticker test and run below code\r\n mbed test -t ARM -m nucleo_f070rb -n tests-mbed_drivers-ticker -vv\r\n\r\n-----------------------------------------------------------------\r\n\r\n## Question\r\n\r\n**Any ideas why below test run under greentea fails?**\r\n\r\nFails in line:\r\n    // (2) TEST_ASSERT_EQUAL(TICKER_COUNT, multi_counter2);\r\n\r\n```\r\n#include \"mbed.h\"\r\n\r\n#define TICKER_COUNT 16\r\nvolatile uint32_t multi_counter1;\r\nvolatile uint32_t multi_counter2;\r\n\r\nvoid wait_callback_multi1(void)\r\n{\r\n    multi_counter1++;\r\n}\r\n\r\nvoid wait_callback_multi2(void)\r\n{\r\n    multi_counter2++;\r\n}\r\n\r\n/** Test many tickers run simultaneously\r\n\r\n    Given an 16 tickers\r\n    When schedule them\r\n    Then tickers properly execute callback\r\n */\r\nvoid test_multi_ticker(void)\r\n{\r\n    Ticker ticker[TICKER_COUNT];\r\n\r\n    multi_counter1 = 0;\r\n    for(int i = 0; i < TICKER_COUNT; i++) {\r\n        ticker[i].attach_us(callback(wait_callback_multi1), 100 * 1000 + i * 15);\r\n    }\r\n\r\n    Thread::wait(110);\r\n    for(int i = 0; i < TICKER_COUNT; i++) {\r\n            ticker[i].detach();\r\n    }\r\n\r\n    // (1) TEST_ASSERT_EQUAL(TICKER_COUNT, multi_counter1);\r\n    printf(\"(1) expected: %d was: %d\\r\\n\", TICKER_COUNT, multi_counter1);\r\n\r\n    multi_counter2 = 0;\r\n    for(int i = 0; i < TICKER_COUNT; i++) {\r\n        ticker[i].attach_us(callback(wait_callback_multi2), 100 * 1000);\r\n    }\r\n\r\n    Thread::wait(110);\r\n    for(int i = 0; i < TICKER_COUNT; i++) {\r\n            ticker[i].detach();\r\n    }\r\n\r\n    // (2) TEST_ASSERT_EQUAL(TICKER_COUNT, multi_counter2);\r\n    printf(\"(2) expected: %d was: %d\\r\\n\", TICKER_COUNT, multi_counter2);\r\n}\r\n\r\nint main() {\r\n    test_multi_ticker();\r\n}\r\n```"}}
{"actor":{"display_login":"maciejbocianski"}}