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

test: drivers: counter: Test passes even when no instances are found #45647

Closed
albertofloyd opened this issue May 14, 2022 · 1 comment
Closed
Assignees
Labels
area: Counter bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Stale

Comments

@albertofloyd
Copy link
Collaborator

albertofloyd commented May 14, 2022

Describe the bug
Test count iterates over each counter instance and perform the test, however if no instances are found test suite is indicated as pass.

To Reproduce
Steps to reproduce the behavior:

  1. cd tests/drivers/counter/counter_basic_api
  2. Add following change into tests/drivers/counter/counter_basic_api/src/test_counter.c

@@ -146,6 +146,7 @@ static void counter_tear_down_instance(const char *dev_name)
static void test_all_instances(counter_test_func_t func,
counter_capability_func_t capability_check)
{

  •   TC_PRINT("%s. Test %d instances", __func__, ARRAY_SIZE(devices));
      for (int i = 0; i < ARRAY_SIZE(devices); i++) {
              counter_setup_instance(devices[i]);
              if ((capability_check == NULL) ||
    
  1. west build -c -p always -b mec172xevb_assy6906
  2. west flash
  3. Check output. See log below

Expected behavior
If instances are not found, test should fail

Impact
Low test coverage for counter drivers when getting enabled

Logs and console output

Running TESTSUITE test_counter
===================================================================
START - test_set_top_value_with_alarm
test_all_instances. Test 0 devices PASS - test_set_top_value_with_alarm in 0.3 second

@github-actions
Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Jul 17, 2022
@github-actions github-actions bot closed this as completed Aug 1, 2022
hunterhu3000 added a commit to hunterhu3000/zephyr that referenced this issue Sep 3, 2022
In test_all_instances(), if ARRAY_SIZE(devices) is 0, the test is not
performed. At this time, the test result should be TC_FAIL, instead of
TC_PASS. A zassert is needed to filter this case.
Fixes: zephyrproject-rtos#45647

Signed-off-by: Hu Zhenyu <[email protected]>
nashif pushed a commit that referenced this issue Sep 9, 2022
In test_all_instances(), if ARRAY_SIZE(devices) is 0, the test is not
performed. At this time, the test result should be TC_FAIL, instead of
TC_PASS. A zassert is needed to filter this case.
Fixes: #45647

Signed-off-by: Hu Zhenyu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Counter bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Stale
Projects
None yet
Development

No branches or pull requests

4 participants