#
1c39d7b8 |
| 21-Sep-2023 |
Patrick Rudolph <patrick.rudolph@9elements.com> |
test: Add test for string matching
Add test for regex (?!) to not match a specific sequence. This is useful to exclude specific matches while using wildcard patterns.
Change-Id: I54aec4b5a956af0e81
test: Add test for string matching
Add test for regex (?!) to not match a specific sequence. This is useful to exclude specific matches while using wildcard patterns.
Change-Id: I54aec4b5a956af0e815b7a57c715f4f58af8a4e6 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
show more ...
|
#
e45d8c71 |
| 25-May-2022 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
treewide: comply with the OpenBMC style guidelines
The guidelines say cpp source code filenames should be lower_snake_case: https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#f
treewide: comply with the OpenBMC style guidelines
The guidelines say cpp source code filenames should be lower_snake_case: https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#files
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Change-Id: Ia04017b0eb9a65ce1303af5b6dc36e730410fd91
show more ...
|
#
1983d2f4 |
| 05-Apr-2022 |
Andrew Jeffery <andrew@aj.id.au> |
EntityManager: Make MapperGetSubTreeResponse type comprehensible
From there, rework a bunch of uses of the unaliased types to use the new aliased types and fix up some of the variable names to impro
EntityManager: Make MapperGetSubTreeResponse type comprehensible
From there, rework a bunch of uses of the unaliased types to use the new aliased types and fix up some of the variable names to improve readability.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I498e0d93091cae43e59907ee1908afc97ac601ee
show more ...
|
#
eab4929d |
| 05-Apr-2022 |
Andrew Jeffery <andrew@aj.id.au> |
EntityManager: Rename BasicVariantType to DBusValueVariant
Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: Ifde3020ee286ee6b98951df4bad5c3bd8d0251d2
|
#
a0d1b3f8 |
| 05-Oct-2021 |
Zhikui Ren <zhikui.ren@intel.com> |
Utils: Fix more than one template replace
There is a bug in templateCharReplace function that only the first template gets replaced correctly and additional templates are left unchanged.
Add a new
Utils: Fix more than one template replace
There is a bug in templateCharReplace function that only the first template gets replaced correctly and additional templates are left unchanged.
Add a new test case twoReplacementsWithMath2 to show the issue. Difference with the existing passing test case is key string "ADDRESS" is less than "BAR". nlohmann::json j = {{"foo", "4 / 2 equals $ADDRESS / 2 $BAR"}}; data["ADDRESS"] = 4; data["BAR"] = std::string("bar");
With this change the new test case passes.
Tested: All unit tests passed.
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> Change-Id: I121ec8c0fcfce645f52518ed4429228549ff9371
show more ...
|
#
cd1868e8 |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add support for bytestrings
Add support for bytestrings, and associated unit tests.
Change-Id: I1307b886494784ee3cd510351626297c43c431d6 Signed-off-by: Brad Bishop <bradleyb@
entity-manager: probe: add support for bytestrings
Add support for bytestrings, and associated unit tests.
Change-Id: I1307b886494784ee3cd510351626297c43c431d6 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
5d525413 |
| 26-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: Refactor matching
In a nutshell, rely on nlohmann's comparison operator to make the match instead of rolling our own. A nice side effect is the expected match behavior is wel
entity-manager: probe: Refactor matching
In a nutshell, rely on nlohmann's comparison operator to make the match instead of rolling our own. A nice side effect is the expected match behavior is well documented by nlohmann.
Code size and performance are unaffected (after removing dead code): before: 25121752 bytes unstripped, 3202608 bytes stripped after: 25146552 bytes unstripped, 3202616 bytes stripped before: ~22 seconds for 5000 iterations of the tests after: ~22 seconds for 5000 iterations of the tests
This refactor reduces the number of lines of code we need to maintain and test and increases the number of lines of code used from the extensively tested nlohmann json library.
The refactor simplifies the logic down to: return probe == value; for non-string probes. A string specialization is still required so we can pattern match.
The refactor enables support for matching non-trivial json types such as arrays and objects. New types need only be added to BasicVariantType.
There are several changed testcase expectations introduced by the refactor. Each is discussed in detail below.
- stringRegexError - boolStringError -> boolNeqString - falseEmptyError -> falseNeqEmpty - trueEmptyError -> trueNeqEmpty - uintStringError -> uintNeqString - uintEmptyError -> unitNeqEmpty - intStringError -> intNeqString - intEmptyError -> intNeqEmpty - doubleStringError -> doubleNeqString - doubleEmptyError -> doubleNeqEmpty Configuration file validation of regular expression syntax or the correct json type for a given dbus interface and property is better done by our offline validation tools. Avoid runtime complexity attempting to distinguish between user errors and probe statements that simply do not match by treating them the same and always return "no-match" instead of an invalid argument error for user error situations. stringRegexError could be an exception - there is no additional runtime complexity overhead associated with flagging it as a user error, but doing so would result in inconsistent behavior, so return no-match for it as well.
- stringZeroEqFalse -> stringZeroNeqFalse - stringOneEqTrue -> stringOneNeqTrue - stringEqUnit8 -> stringNeqUint8 - stringEqUint32 -> stringNeqUint32 - stringEqInt32 -> stringNeqInt32 - stringRegexEqInt32 -> stringRegexNeqInt32 - stringEqDouble -> stringNeqDouble Prior to this patch dbus properties are converted to strings in the event of a string probe. This works around mistakes in configuration files where the wrong json type is used but it can provide unexpected results like the probe "1" matching a true and the probe "11" matching a false, and the string "1*2" matching the number 112. Implementing the expected behavior is possible but would add complexity. For these reasons this refactor drops the string conversion and requires the user to use the correct types in their configurations.
- falseEqUint32Zero -> falseNeqUint32Zero - trueEqUint32Zero -> falseNeqUint32Zero - trueEqDoubleOne -> trueNeqDoubleOne - falseEqDoubleZero -> falseNeqDoubleZero - uintEqTrue -> uintNeqTrue - uintEqFalse -> uintNeqFalse - unitEqDoubleRound -> uintNeqDouble Prior to this patch dbus properties are coerced to unsigned integers in the event of a boolean or unsigned integer probes. Like in the previous section this can have unexpected results such as integral json types matching floats with fractional components from dbus. Again, implementing the expected behavior is possible but would add coomplexity, and again these conversions are abandoned and instead require the user to use the correct types in their configurations.
- intEqDoubleRound -> intNeqDoubleRoound - doubleEqFalse -> doubleNeqFalse - doubleEqTrue -> doubleNeqTrue Like the previous two sections, dbus properties are coerced to integers in the event of an integer probe, and dbus properties are coerced to doubles in the event of a double probe, and can result in unexpected behavior. Require the user to use the correct types in their configurations.
Change-Id: I6ce7a9c4a80d9612b15cd5e7bb4647bd96852e48 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
c776c414 |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json null.
Change-Id: I00314b68a587ec9b6bef052fa7ba5a877ce36a15 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.c
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json null.
Change-Id: I00314b68a587ec9b6bef052fa7ba5a877ce36a15 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
6660e2a2 |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json objects.
Change-Id: Ica33fb959d5680e86f3488510e0b841a7430fe2b Signed-off-by: Brad Bishop <bradleyb@fuzziesquirre
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json objects.
Change-Id: Ica33fb959d5680e86f3488510e0b841a7430fe2b Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
d14c2e21 |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json arrays.
Change-Id: Ic6cc068cc4f635a2b33d4b62dc624273560c10b9 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json arrays.
Change-Id: Ic6cc068cc4f635a2b33d4b62dc624273560c10b9 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
3bd8e8d6 |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json floats.
Change-Id: Id600a8299e921bc05addfeb71539bd97126ae236 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json floats.
Change-Id: Id600a8299e921bc05addfeb71539bd97126ae236 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
667e050d |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json integers.
Change-Id: Icacd8f6a687df2a75c0df4b6e0bfe9ad01ceac38 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirr
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json integers.
Change-Id: Icacd8f6a687df2a75c0df4b6e0bfe9ad01ceac38 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
c2af531d |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json unsigned integers.
Change-Id: Icc95cc7d5dccf9aad7e9261932ab20c4b41195f4 Signed-off-by: Brad Bishop <bradleyb@fuz
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json unsigned integers.
Change-Id: Icc95cc7d5dccf9aad7e9261932ab20c4b41195f4 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
c5eba596 |
| 28-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json booleans.
Change-Id: I5f65610b93d9c60a4688af95faf6c135d591ca2d Signed-off-by: Brad Bishop <bradleyb@fuzziesquirr
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json booleans.
Change-Id: I5f65610b93d9c60a4688af95faf6c135d591ca2d Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
9d2ef081 |
| 26-Aug-2020 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json strings.
Change-Id: I327afa06bbf6c6f651e15756963f731776ada251 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirre
entity-manager: probe: add probe logic tests
Add unit tests for matchProbe with json strings.
Change-Id: I327afa06bbf6c6f651e15756963f731776ada251 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|
#
8c505da0 |
| 28-May-2020 |
James Feist <james.feist@linux.intel.com> |
Update to latest clang format
Update to clang-format-10
Change-Id: I91e46a3b27c7ebd9a4813a19c1a62ac19bc2f0a0 Signed-off-by: James Feist <james.feist@linux.intel.com>
|
#
c296c80e |
| 28-Aug-2019 |
James Feist <james.feist@linux.intel.com> |
Add test for hex by itself
Verify this works.
Change-Id: I15b0a836150eccaa5826fab51d4aea51858e85f7 Signed-off-by: James Feist <james.feist@linux.intel.com>
|
#
b0097d41 |
| 15-Aug-2019 |
James Feist <james.feist@linux.intel.com> |
TemplateCharReplace: More tests
Fix case insensitive replace
Tested: Tests pass
Change-Id: I0c650e4761d3c6e464a90ecfe1e2c8b314c2ff57 Signed-off-by: James Feist <james.feist@linux.intel.com>
|
#
8c20febc |
| 14-Aug-2019 |
James Feist <james.feist@linux.intel.com> |
TemplateCharReplace: fix failing testcase and add more
This fix the failing test and adds a couple more tests.
Tested: Test cases pass
Change-Id: I39435c7f938da007826682d17a670609ccc4704d Signed-o
TemplateCharReplace: fix failing testcase and add more
This fix the failing test and adds a couple more tests.
Tested: Test cases pass
Change-Id: I39435c7f938da007826682d17a670609ccc4704d Signed-off-by: James Feist <james.feist@linux.intel.com>
show more ...
|
#
481c5d5c |
| 13-Aug-2019 |
James Feist <james.feist@linux.intel.com> |
Add Unit Test for TemplateCharReplace
We keep finding issues in this function, add some tests.
Tested: The tests pass, this is mostly just moving the code into a header. One test didn't work, but i
Add Unit Test for TemplateCharReplace
We keep finding issues in this function, add some tests.
Tested: The tests pass, this is mostly just moving the code into a header. One test didn't work, but it didn't work before either. It will be fixed later
Change-Id: I3eb60960104e861b0a0313580dc90bfb12051829 Signed-off-by: James Feist <james.feist@linux.intel.com>
show more ...
|