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

Refactoring Unit Tests into a Test Free Function and a Standalone/Native Driver #644

Conversation

gerickson
Copy link
Contributor

Problem

Currently, unit tests are only runnable in the context of a standalone/native test driver. There is a desire, however, to run unit tests on an embedded device, potentially one that doesn't support discrete program executables (such as embedded systems).

Refactor the unit test such that the test is a free function, linkable from an archive library and a standalone/native test driver in main().

Summary of Changes

This refactors the unit tests into separable test functions and drivers.

… a 'main()' driver for standalone/native tests.
@gerickson gerickson added the enhancement New feature or request label May 11, 2020
@gerickson gerickson requested a review from pan-apple May 11, 2020 18:50
@gerickson gerickson self-assigned this May 11, 2020
@gerickson gerickson marked this pull request as draft May 11, 2020 18:51
@gerickson gerickson changed the title Refactoring Unit Tests into a Test Free Function and a Standalone/Native Driver WIP: Refactoring Unit Tests into a Test Free Function and a Standalone/Native Driver May 11, 2020
@pan-apple
Copy link
Contributor

LGTM

Grant Erickson and others added 6 commits May 11, 2020 14:23
* adding first plugins for chip's application layer zcl implementation

* Updated readme.md for inclusion in CHIP repo

* updated to conform with formatting required by CHIP and updates to the README.md

* removing binaries accidentally added

* updated prefixes to CHIP_ZCL, ChipZcl, chipZcl from zap etc...

* Added identify cluster server plugin and test

* Ignore *.o and *.out.

* adding more unit testing with actual generated message dispatch layer

* addressed some points about constants, bool check etc...

* Added inherited copyrights and other headers with comments

* Resolving comments around special values in level-control command handling

* Add the attribute db plugin.

* Start adding in the attribute database.

* Moved some files around, added some more generated files, and beginnings of general message dispatch

* Add attribute database. It compiles now, still has few linker problems since the current org of stubs is not what generator expects.

* Get to a point where only callbacks are left.

* Ok, attribute db now compiles, links and executes a unittest.

* Include attribute DB to identify.

* Add the generated stubs.

* Resolve all linker problems via generated stubs file.

* Added testing for message dispatch

* Fixing formatting issues

* Start tying together the API with the core internal functions.

0. Location of metadata.
1. Proper translation of search records and actual metadata structs.
2. Callback orchestration.

* Add a unit test that perform attribute locating.

* Some cleanup.

* Minor resorting of functions so that the folded view makes more sense.

* Remove the masks that define callbacks. That is done completely differently in this case and should not be propagated into CHIP world.

* Rename a mis-named "attribute-db" into a "zcl-data-model", since that's what it really is.

* Adding beginnings of general command handling, space for interaction with zcl-data-model and codecs

Co-authored-by: Timotej Ecimovic <[email protected]>
This reverts commit a3028b696691ce105112a858ee8147f153caf945.
* Add CHIPCounter and PersistedCounter from OpenWeave.

CHIPCounter/PersistedCounter is used by weave message layer. Adding this as an independent
patch in the interest of keeping pull requests small.

Changes from original weave implementation:
  - Renaming weave to chip (namespaces, constants)
  - fix includes
  - update copyright
  - clean up includes (add required include in header, drop unnecessary includes from cpp file)
  - Update PersistedCounter unit test files to run (updated includes, changed defines)
  - Added a TestCHIPCounter unit test.

Additional changes:
  - Created separate InetArgParser h/cpp to remove dependency between
    support layer and inet layer. This makes the inet layer support
    inet-specific argument parsing

Tested: compilation works and CHIPCounter is included in the support library
Tested: PersistedCounter and CHIPCounter unit tests pass in `make check`

* Fix order of initialization in persistent counter. Make empty key be templated, to support all platforms.

Co-authored-by: Andrei Litvin <[email protected]>
@gerickson
Copy link
Contributor Author

@woody-apple woody-apple merged commit 20b4f84 into project-chip:master May 12, 2020
mkardous-silabs pushed a commit to mkardous-silabs/connectedhomeip that referenced this pull request May 2, 2023
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
shgutte pushed a commit to shgutte/connectedhomeip that referenced this pull request Oct 5, 2023
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
shgutte pushed a commit to shgutte/connectedhomeip that referenced this pull request Jan 11, 2024
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
mkardous-silabs pushed a commit to mkardous-silabs/connectedhomeip that referenced this pull request Jan 29, 2024
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
mkardous-silabs pushed a commit to mkardous-silabs/connectedhomeip that referenced this pull request Jan 29, 2024
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
rcasallas-silabs pushed a commit to rcasallas-silabs/connectedhomeip that referenced this pull request Jun 20, 2024
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
rcasallas-silabs pushed a commit to rcasallas-silabs/connectedhomeip that referenced this pull request Jun 20, 2024
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
chirag-silabs pushed a commit to rosahay-silabs/connectedhomeip that referenced this pull request Jul 15, 2024
Merge in WMN_TOOLS/matter from unify_codeowners to silabs

Squashed commit of the following:

commit 95bc78bd6813c79be10a5a968c80ff9aae4d18e6
Author: Milind Dumbare <[email protected]>
Date:   Mon Mar 13 12:51:25 2023 +0100

    Update CODEOWNERS for Unify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants