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

Fix shutting down System::Layer in unit tests #8865

Merged
merged 2 commits into from
Aug 11, 2021

Conversation

kpschoedel
Copy link
Contributor

Problem

Some unit tests either reference System::Layer after its destruction,
or don't call Shutdown before its destruction.

Change overview

  • Shut down System::Layer in test finalization
  • Don't initialize System::Layer repeatedly (although this is currently
    harmless).
  • Separate IOContext, which uses a ‘hidden’ global System::Layer via
    NetworkTestHelpers, from Test::MessagingContext, which is sometimes
    multiply instantiated.

Testing

Quis custodiet ipsos custodes?

#### Problem

Some unit tests either reference System::Layer after its destruction,
or don't call Shutdown before its destruction.

#### Change overview

- Shut down System::Layer in test finalization
- Don't initialize System::Layer repeatedly (although this is currently
  harmless).
- Separate IOContext, which uses a ‘hidden’ global System::Layer via
  NetworkTestHelpers, from Test::MessagingContext, which is sometimes
  multiply instantiated.

#### Testing

Quis custodiet ipsos custodes?
@woody-apple woody-apple merged commit b3f7d9f into project-chip:master Aug 11, 2021
@kpschoedel kpschoedel deleted the test-shutdown branch August 11, 2021 13:11
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Aug 25, 2021
#### Problem

There have been multiple instances of code using a `System::Layer`
object after it has been shut down or destroyed (some previously
fixed in project-chip#8865). In the ancestral code, `System::Layer` was fully
static, so this ‘worked’.

#### Change overview

- More thoroughly track and check `System::Layer` object state.
- Spin out state tracking into `lib/support/ObjectLifeCycle.h`
- Fix several sequencing issues.

#### Testing

CI; no change to visible functionality intended.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Aug 25, 2021
#### Problem

There have been multiple instances of code using a `System::Layer`
object after it has been shut down or destroyed, some previously
fixed in project-chip#8865. (In the ancestral code, `System::Layer` was fully
static.)

#### Change overview

- More thoroughly track and check `System::Layer` object state.
- Spin out state tracking into `lib/support/ObjectLifeCycle.h`
- Fix several sequencing issues.

#### Testing

CI; no change to visible functionality intended.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Aug 27, 2021
#### Problem

There have been multiple instances of code using a `System::Layer`
object after it has been shut down or destroyed, some previously
fixed in project-chip#8865. (In the ancestral code, `System::Layer` was fully
static.)

#### Change overview

- More thoroughly track and check `System::Layer` object state.
- Spin out state tracking into `lib/support/ObjectLifeCycle.h`
- Fix several sequencing issues.

#### Testing

CI; no change to visible functionality intended.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Aug 30, 2021
#### Problem

There have been multiple instances of code using a `System::Layer`
object after it has been shut down or destroyed, some previously
fixed in project-chip#8865. (In the ancestral code, `System::Layer` was fully
static.)

#### Change overview

- More thoroughly track and check `System::Layer` object state.
- Spin out state tracking into `lib/support/ObjectLifeCycle.h`
- Fix several sequencing issues.

#### Testing

CI; no change to visible functionality intended.
mspang pushed a commit that referenced this pull request Aug 31, 2021
#### Problem

There have been multiple instances of code using a `System::Layer`
object after it has been shut down or destroyed, some previously
fixed in #8865. (In the ancestral code, `System::Layer` was fully
static.)

#### Change overview

- More thoroughly track and check `System::Layer` object state.
- Spin out state tracking into `lib/support/ObjectLifeCycle.h`
- Fix several sequencing issues.

#### Testing

CI; no change to visible functionality intended.
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
* Fix shutting down System::Layer in unit tests

#### Problem

Some unit tests either reference System::Layer after its destruction,
or don't call Shutdown before its destruction.

#### Change overview

- Shut down System::Layer in test finalization
- Don't initialize System::Layer repeatedly (although this is currently
  harmless).
- Separate IOContext, which uses a ‘hidden’ global System::Layer via
  NetworkTestHelpers, from Test::MessagingContext, which is sometimes
  multiply instantiated.

#### Testing

Quis custodiet ipsos custodes?

* restyle
mkardous-silabs pushed a commit to mkardous-silabs/connectedhomeip that referenced this pull request Sep 24, 2021
#### Problem

There have been multiple instances of code using a `System::Layer`
object after it has been shut down or destroyed, some previously
fixed in project-chip#8865. (In the ancestral code, `System::Layer` was fully
static.)

#### Change overview

- More thoroughly track and check `System::Layer` object state.
- Spin out state tracking into `lib/support/ObjectLifeCycle.h`
- Fix several sequencing issues.

#### Testing

CI; no change to visible functionality intended.
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