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 unit test of System::Layer timer order #12895

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

kpschoedel
Copy link
Contributor

Problem

Nothing explicitly tests that System::Layer timers fire in
chronological order. Since we can now have a mock system clock,
this is testable.

Change overview

  • Add a unit test verifying that timer callbacks run in order.
  • Add unit test assertions for timer statistics.
  • Revise implementation selection in TestSystemTimer to use the
    Layer class rather than only '#if', since not every configuration
    with sockets/LwIP necessarily needs to use the provided Layer
    implementations.
  • Provide a common MockClock implementation, unifying the
    versions in other unit tests.

Testing

Res ipsa loquitur.

#### Problem

Nothing explicitly tests that `System::Layer` timers fire in
chronological order. Since we can now have a mock system clock,
this is testable.

#### Change overview

- Add a unit test verifying that timer callbacks run in order.
- Add unit test assertions for timer statistics.
- Revise implementation selection in TestSystemTimer to use the
  `Layer` class rather than only '#if', since not every configuration
  with sockets/LwIP necessarily needs to use the provided `Layer`
  implementations.
- Provide a common MockClock implementation.

#### Testing

Res ipsa loquitur.
@andy31415
Copy link
Contributor

fast track: this adds unit tests

@kpschoedel kpschoedel closed this Dec 10, 2021
@kpschoedel kpschoedel deleted the system-layer-timer-tests branch December 10, 2021 17:05
@kpschoedel kpschoedel restored the system-layer-timer-tests branch December 10, 2021 17:05
@kpschoedel kpschoedel reopened this Dec 10, 2021
@andy31415 andy31415 merged commit 03cf99c into project-chip:master Dec 10, 2021
@kpschoedel kpschoedel deleted the system-layer-timer-tests branch December 10, 2021 20:42
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Dec 20, 2021
#### Problem

PR project-chip#12895 included consolidating several unit tests' nearly-identical
mock `System::Clock` implementations into one, but missed a couple.

#### Change overview

Use `System::Clock::Internal::MockClock` in `TestDnssdCache`
and `TestPeerConnections`.

#### Testing

Yes indeed.
kpschoedel added a commit that referenced this pull request Dec 21, 2021
#### Problem

PR #12895 included consolidating several unit tests' nearly-identical
mock `System::Clock` implementations into one, but missed a couple.

#### Change overview

Use `System::Clock::Internal::MockClock` in `TestDnssdCache`
and `TestPeerConnections`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants