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

Update AttributePathExpandIterator to be able to use the IM/DM DataModel split #34288

Merged
merged 28 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
272ac40
Ember invoke implementation with unit tests inside DataModel
andy31415 Jul 6, 2024
95243b7
Support ember/datamodel/dual(checked) attribute path expand iterators
andy31415 Jul 6, 2024
c801b4c
Code review comments
andy31415 Jul 9, 2024
1e72d43
Merge branch 'imdm/5-ember-invoke-clean' into imdm/6-start-using-iter…
andy31415 Jul 9, 2024
9935d05
Merge branch 'master' into imdm/5-ember-invoke-clean
andy31415 Jul 10, 2024
2263249
Merge branch 'imdm/5-ember-invoke-clean' into imdm/6-start-using-iter…
andy31415 Jul 10, 2024
6a135cd
Fix interactionmodel::status compilation in icd-management-server whe…
andy31415 Jul 10, 2024
3a13e4a
Do not include CodegeDataModelInstance if we do not use the codegen d…
andy31415 Jul 10, 2024
abf2143
Fix linter
andreilitvin Jul 11, 2024
9339ac3
Fix java controller linkage.
andreilitvin Jul 11, 2024
492362c
Fix Amebad compilation: OUT is defined in Ameba
andreilitvin Jul 11, 2024
8b5b471
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 11, 2024
9972019
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 11, 2024
15136da
Update log formatting
andreilitvin Jul 17, 2024
0702f68
Review comment: use GlobalAttributesNotInMetadata directly
andreilitvin Jul 17, 2024
4e1bf41
Remove debug bits
andreilitvin Jul 17, 2024
17124ff
Code review update: we just need to match next logic in the ember cod…
andreilitvin Jul 17, 2024
0985403
Restyle
andreilitvin Jul 17, 2024
29f9cb0
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 17, 2024
d451f5a
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 17, 2024
a72c584
Do not check for differences if result is false ... this is what peop…
andreilitvin Jul 18, 2024
25d3294
Fix typo
andreilitvin Jul 18, 2024
381602b
Restyle
andreilitvin Jul 18, 2024
1e7cfbd
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 18, 2024
108ef01
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 18, 2024
cb42ae6
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 18, 2024
c3fa7d4
Merge branch 'master' into imdm/6-start-using-iterator
andreilitvin Jul 18, 2024
0c4134b
Update src/app/AttributePathExpandIterator-DataModel.cpp
andy31415 Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ jobs:
':(exclude)src/app/util/attribute-table.cpp' \
':(exclude)src/app/util/attribute-table.h' \
':(exclude)src/app/util/ember-compatibility-functions.cpp' \
':(exclude)src/app/util/mock/CodegenEmberMocks.cpp' \
':(exclude)src/app/zap-templates/templates/app/attributes/Accessors-src.zapt' \
':(exclude)zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp' \
&& exit 1 || exit 0
Expand Down
4 changes: 4 additions & 0 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
if self.app == HostApp.SIMULATED_APP2:
self.extra_gn_options.append('chip_tests_zap_config="app2"')

if self.app in {HostApp.JAVA_MATTER_CONTROLLER, HostApp.KOTLIN_MATTER_CONTROLLER}:
# TODO: controllers depending on a datamodel is odd. For now fix compile dependencies on ember.
self.extra_gn_options.append('chip_use_data_model_interface="disabled"')

if self.app == HostApp.TESTS and fuzzing_type != HostFuzzingType.NONE:
self.build_command = 'fuzz_tests'

Expand Down
99 changes: 99 additions & 0 deletions src/app/AttributePathExpandIterator-Checked.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "lib/support/logging/TextOnlyLogging.h"
#include <app/AttributePathExpandIterator-Checked.h>

namespace chip {
namespace app {
AttributePathExpandIteratorChecked::AttributePathExpandIteratorChecked(InteractionModel::DataModel * dataModel,
SingleLinkedListNode<AttributePathParams> * attributePath) :
mDataModelIterator(dataModel, attributePath),
mEmberIterator(dataModel, attributePath)
{
CheckOutputsIdentical("Constructor");
}

bool AttributePathExpandIteratorChecked::Next()
{
bool dmResult = mDataModelIterator.Next();
bool emResult = mEmberIterator.Next();

CheckOutputsIdentical("Next");

VerifyOrDie(dmResult == emResult);

return emResult;
}

bool AttributePathExpandIteratorChecked::Get(ConcreteAttributePath & aPath)
{
CheckOutputsIdentical("Get");
return mEmberIterator.Get(aPath);
}

void AttributePathExpandIteratorChecked::ResetCurrentCluster()
{
mDataModelIterator.ResetCurrentCluster();
mEmberIterator.ResetCurrentCluster();

CheckOutputsIdentical("ResetCurrentCluster");
}

void AttributePathExpandIteratorChecked::ResetTo(SingleLinkedListNode<AttributePathParams> * paths)

{
mDataModelIterator.ResetTo(paths);
mEmberIterator.ResetTo(paths);
CheckOutputsIdentical("ResetTo");
}

void AttributePathExpandIteratorChecked::CheckOutputsIdentical(const char * msg)
{
ConcreteAttributePath dmPath;
ConcreteAttributePath emPath;

bool dmResult = mDataModelIterator.Get(dmPath);
bool emResult = mEmberIterator.Get(emPath);

if (dmResult == emResult)
{
// We check for:
// - either failed result (in which case path should not matter)
// - or exact match of paths on success
//
// NOTE: extra logic because mExpanded is NOT considered in operator== (ugly...)
if ((dmResult == false) || ((dmPath == emPath) && (dmPath.mExpanded == emPath.mExpanded)))
{
// outputs are identical. All is good
return;
}
}

ChipLogProgress(Test, "Different paths in DM vs EMBER (%d and %d) in %s", dmResult, emResult, msg);
ChipLogProgress(Test, " DM PATH: 0x%X/" ChipLogFormatMEI "/" ChipLogFormatMEI " (%s)", dmPath.mEndpointId,
ChipLogValueMEI(dmPath.mClusterId), ChipLogValueMEI(dmPath.mAttributeId),
dmPath.mExpanded ? "EXPANDED" : "NOT expanded");
ChipLogProgress(Test, " EMBER PATH: 0x%X/" ChipLogFormatMEI "/" ChipLogFormatMEI " (%s)", emPath.mEndpointId,
ChipLogValueMEI(emPath.mClusterId), ChipLogValueMEI(emPath.mAttributeId),
emPath.mExpanded ? "EXPANDED" : "NOT expanded");

chipDie();
}

} // namespace app
} // namespace chip
45 changes: 45 additions & 0 deletions src/app/AttributePathExpandIterator-Checked.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <app/AttributePathExpandIterator-DataModel.h>
#include <app/AttributePathExpandIterator-Ember.h>

namespace chip {
namespace app {

class AttributePathExpandIteratorChecked
{
public:
AttributePathExpandIteratorChecked(InteractionModel::DataModel * dataModel,
SingleLinkedListNode<AttributePathParams> * attributePath);

bool Next();
bool Get(ConcreteAttributePath & aPath);
void ResetCurrentCluster();
void ResetTo(SingleLinkedListNode<AttributePathParams> * paths);

private:
AttributePathExpandIteratorDataModel mDataModelIterator;
AttributePathExpandIteratorEmber mEmberIterator;

void CheckOutputsIdentical(const char * msg);
};

} // namespace app
} // namespace chip
Loading
Loading