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

twister: using unsupported fixture without defined harness causes an infinite loop during on-target test execution #31194

Closed
PerMac opened this issue Jan 8, 2021 · 4 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@PerMac
Copy link
Member

PerMac commented Jan 8, 2021

Describe the bug
The bug can be observed when the following conditions combine:

  • a test requiring a fixture
  • the test does not have harness: console or ztest
  • the test is called for hardware that does not have the fixture defined.

Even though a test requires a fixture in its yaml, twister will get in an infinite loop waiting for the device to become ready. I think the logic in handle() (line 689 in twisterlib.py) is wrong:

        while not self.device_is_available(self.instance):
            logger.debug("Waiting for device {} to become available".format(self.instance.platform.name))
            time.sleep(1)

The function device_is_available() checks if the fixture exists in the device and returns False. Then the 1 sec sleep is applied and the check for the fixture repeats. This happens until the timeout termination.
If the test defines harness as console or ztest then the test is skipped correctly. If none of these harnesses is used then we end up in the loop.

I am not sure if it is a real error. I found it when I was trying to figure out why #31188 was not getting filtered (now harness: ztest is added to the yamls in PR and fixture is skipped correctly).

@PerMac PerMac added the bug The issue is a bug, or the PR is fixing a bug label Jan 8, 2021
@PerMac
Copy link
Member Author

PerMac commented Jan 8, 2021

@nashif related question: Why in testcase_runnable() (line 1761 of twisterlib.py) fixture requirement is checked only if testcase.harness in [ 'console', 'ztest']?

@PerMac PerMac changed the title twister: using unsupported fixture causes an infinite loop during on-target test execution twister: using unsupported fixture without defined harness causes an infinite loop during on-target test execution Jan 8, 2021
@nashif nashif added the priority: low Low impact/importance bug label Jan 12, 2021
@nashif
Copy link
Member

nashif commented Jan 24, 2021

@nashif related question: Why in testcase_runnable() (line 1761 of twisterlib.py) fixture requirement is checked only if testcase.harness in [ 'console', 'ztest']?

because is the only way we have to deal with test output from fixtures

@nashif
Copy link
Member

nashif commented Jan 24, 2021

a harness_config containing a fixture always needs a fixture in the yaml file. So this is more of a schema dependency validation issue and less of a logical issue I think.

@nashif
Copy link
Member

nashif commented Jan 30, 2021

dont think this is a bug, it is just bad test configuration.

@nashif nashif closed this as completed Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants