Skip to content

Adds lib/support/tests to the ESP32 unit-test target. Makes platform-specific fixes to ParseArgs and EncodeTlvElement. #36847

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

feasel0
Copy link
Contributor

@feasel0 feasel0 commented Dec 15, 2024

Fixes errors that were causing libSupportTests (lib/support/tests) unit tests to fail.

Changes

  • Adds the unit tests src/lib/support/tests into the esp32-qemu-tests target.
  • Updates ArgParser::ParseArgs() to work with platforms with a non-POSIX getopt_long (like ESP32). This was causing failures in some of the test cases in TestCHIPArgParser.cpp.
  • Updates EncodeTlvElement() to work with platforms where malloc(0) returns null (like ESP32). This was causing a failure when building zero-length strings, since the null response was being interpreted as "out of memory".
  • Updates .vscode/tasks.json to include Build and Run tasks for the ESP32 unit tests.
  • Adds a clean.sh script for removing the files generated by the ESP32 unit test build.

How is ESP32's getopt_long different from the POSIX version?

  • Sets optopt to '?' when encountering an unknown short option, instead of setting it to the actual value of the character it encountered.
  • Treats an unknown long option like a series of short options.
  • Does not always permute argv to put the nonoptions at the end.

As a result, ParseArgs needs to do a little more work when interpreting the results of getopt_long. This code is only executed if CONFIG_NON_POSIX_GETOPT_LONG is defined, which happens automatically in src/lib/support/BUILD.gn when chip_device_platform is "esp32".

Testing

Automated testing. Used the ESP32_QEMU CI check, which now includes libSupportTests. Also manually built the esp32-qemu-tests target and ran all images.

@feasel0 feasel0 requested a review from a team as a code owner December 15, 2024 03:13
Copy link

semanticdiff-com bot commented Dec 15, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  .vscode/tasks.json  6% smaller
  src/lib/support/BUILD.gn Unsupported file format
  src/lib/support/CHIPArgParser.cpp Unsupported file format
  src/lib/support/CHIPArgParser.hpp Unsupported file format
  src/lib/support/jsontlv/BUILD.gn Unsupported file format
  src/lib/support/jsontlv/JsonToTlv.cpp Unsupported file format
  src/test_driver/esp32/CMakeLists.txt Unsupported file format
  src/test_driver/esp32/README.md Unsupported file format
  src/test_driver/esp32/clean.sh Unsupported file format
  src/test_driver/openiotsdk/unit-tests/main/include/CHIPProjectConfig.h Unsupported file format

Copy link

github-actions bot commented Dec 15, 2024

PR #36847: Size comparison from cfdaf79 to c320ab5

Full report (42 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, nrfconnect, psoc6, qpg, stm32, telink, tizen)
platform target config section cfdaf79 c320ab5 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1353340 1353340 0 0.0
RAM 104112 104112 0 0.0
bl702 lighting-app bl702+eth FLASH 651826 651826 0 0.0
RAM 25353 25353 0 0.0
bl702+wifi FLASH 829154 829154 0 0.0
RAM 14093 14093 0 0.0
bl706+mfd+rpc+littlefs FLASH 1057626 1057626 0 0.0
RAM 23933 23933 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 979000 979000 0 0.0
RAM 16596 16596 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 839760 839760 0 0.0
RAM 123664 123664 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825308 825308 0 0.0
RAM 125552 125552 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772096 772096 0 0.0
RAM 114020 114020 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756300 756300 0 0.0
RAM 114228 114228 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 539605 539605 0 0.0
RAM 205760 205760 0 0.0
lock CC3235SF_LAUNCHXL FLASH 573885 573885 0 0.0
RAM 205904 205904 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681513 681513 0 0.0
RAM 78724 78724 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701357 701357 0 0.0
RAM 81364 81364 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701357 701357 0 0.0
RAM 81364 81364 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658301 658301 0 0.0
RAM 73792 73792 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618073 618073 0 0.0
RAM 71708 71708 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637701 637701 0 0.0
RAM 74252 74252 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637701 637701 0 0.0
RAM 74252 74252 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637473 637473 0 0.0
RAM 74724 74724 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657181 657181 0 0.0
RAM 77268 77268 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657181 657181 0 0.0
RAM 77268 77268 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 613933 613933 0 0.0
RAM 68812 68812 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 633785 633785 0 0.0
RAM 71444 71444 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 633785 633785 0 0.0
RAM 71444 71444 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 917880 917880 0 0.0
RAM 143292 143292 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890360 890360 0 0.0
RAM 141487 141487 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 851772 851772 0 0.0
RAM 142200 142200 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646812 1646812 0 0.0
RAM 212104 212104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554236 1554236 0 0.0
RAM 208904 208904 0 0.0
light cy8ckit_062s2_43012 FLASH 1469564 1469564 0 0.0
RAM 200880 200880 0 0.0
lock cy8ckit_062s2_43012 FLASH 1467292 1467292 0 0.0
RAM 225240 225240 0 0.0
qpg lighting-app qpg6105+debug FLASH 664024 664024 0 0.0
RAM 105424 105424 0 0.0
lock-app qpg6105+debug FLASH 621812 621812 0 0.0
RAM 99868 99868 0 0.0
stm32 light STM32WB5MM-DK FLASH 484728 484728 0 0.0
RAM 144880 144880 0 0.0
telink bridge-app tlsr9258a FLASH 682916 682916 0 0.0
RAM 91208 91208 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623346 623346 0 0.0
RAM 31440 31440 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772176 772176 0 0.0
RAM 49300 49300 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 710770 710770 0 0.0
RAM 73504 73504 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 627790 627790 0 0.0
RAM 142140 142140 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 813804 813804 0 0.0
RAM 99684 99684 0 0.0
tizen all-clusters-app arm unknown 4988 4988 0 0.0
FLASH 1734440 1734448 8 0.0
RAM 90744 90744 0 0.0
chip-tool-ubsan arm unknown 10804 10804 0 0.0
FLASH 17973406 17973406 0 0.0
RAM 7842608 7842608 0 0.0

Copy link

github-actions bot commented Dec 15, 2024

PR #36847: Size comparison from cfdaf79 to 37bd427

Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section cfdaf79 37bd427 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1353340 1353340 0 0.0
RAM 104112 104112 0 0.0
bl702 lighting-app bl702+eth FLASH 651826 651826 0 0.0
RAM 25353 25353 0 0.0
bl702+wifi FLASH 829154 829154 0 0.0
RAM 14093 14093 0 0.0
bl706+mfd+rpc+littlefs FLASH 1057626 1057626 0 0.0
RAM 23933 23933 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 979000 979000 0 0.0
RAM 16596 16596 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 839760 839760 0 0.0
RAM 123664 123664 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825308 825308 0 0.0
RAM 125552 125552 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772096 772096 0 0.0
RAM 114020 114020 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756300 756300 0 0.0
RAM 114228 114228 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 539605 539605 0 0.0
RAM 205760 205760 0 0.0
lock CC3235SF_LAUNCHXL FLASH 573885 573885 0 0.0
RAM 205904 205904 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681513 681513 0 0.0
RAM 78724 78724 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701357 701357 0 0.0
RAM 81364 81364 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701357 701357 0 0.0
RAM 81364 81364 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658301 658301 0 0.0
RAM 73792 73792 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618073 618073 0 0.0
RAM 71708 71708 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637701 637701 0 0.0
RAM 74252 74252 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637701 637701 0 0.0
RAM 74252 74252 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637473 637473 0 0.0
RAM 74724 74724 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657181 657181 0 0.0
RAM 77268 77268 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657181 657181 0 0.0
RAM 77268 77268 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 613933 613933 0 0.0
RAM 68812 68812 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 633785 633785 0 0.0
RAM 71444 71444 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 633785 633785 0 0.0
RAM 71444 71444 0 0.0
efr32 lock-app BRD4187C FLASH 932340 932340 0 0.0
RAM 160192 160192 0 0.0
BRD4338a FLASH 746256 746248 -8 -0.0
RAM 233320 233320 0 0.0
window-app BRD4187C FLASH 1024912 1024912 0 0.0
RAM 128296 128296 0 0.0
esp32 all-clusters-app c3devkit DRAM 95360 95360 0 0.0
FLASH 1543380 1543380 0 0.0
IRAM 82542 82542 0 0.0
m5stack DRAM 116312 116312 0 0.0
FLASH 1549950 1549950 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4720 4720 0 0.0
FLASH 2715629 2715631 2 0.0
RAM 129800 129800 0 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 6009314 6009316 2 0.0
RAM 523544 523544 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5345370 5345372 2 0.0
RAM 242600 242600 0 0.0
bridge-app debug unknown 5440 5440 0 0.0
FLASH 4684938 4684940 2 0.0
RAM 218416 218416 0 0.0
chip-tool debug unknown 5992 5992 0 0.0
FLASH 12849310 12849310 0 0.0
RAM 582506 582506 0 0.0
chip-tool-ipv6only arm64 unknown 21352 21352 0 0.0
FLASH 10983936 10983936 0 0.0
RAM 633424 633424 0 0.0
fabric-admin debug unknown 5816 5816 0 0.0
FLASH 11255859 11255859 0 0.0
RAM 582850 582850 0 0.0
fabric-bridge-app debug unknown 4696 4696 0 0.0
FLASH 4510514 4510516 2 0.0
RAM 205600 205600 0 0.0
fabric-sync debug unknown 4936 4936 0 0.0
FLASH 5610549 5610549 0 0.0
RAM 472584 472584 0 0.0
lighting-app debug+rpc+ui unknown 6104 6104 0 0.0
FLASH 5621633 5621633 0 0.0
RAM 228792 228792 0 0.0
lock-app debug unknown 5376 5376 0 0.0
FLASH 4734178 4734180 2 0.0
RAM 204776 204776 0 0.0
ota-provider-app debug unknown 4752 4752 0 0.0
FLASH 4359916 4359918 2 0.0
RAM 198448 198448 0 0.0
ota-requestor-app debug unknown 4688 4688 0 0.0
FLASH 4498908 4498910 2 0.0
RAM 203032 203032 0 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3032765 3032765 0 0.0
RAM 160424 160424 0 0.0
thermostat-no-ble arm64 unknown 9536 9536 0 0.0
FLASH 4104176 4104192 16 0.0
RAM 243040 243040 0 0.0
tv-app debug unknown 5704 5704 0 0.0
FLASH 5959461 5959461 0 0.0
RAM 596016 596016 0 0.0
tv-casting-app debug unknown 5288 5288 0 0.0
FLASH 11055165 11055165 0 0.0
RAM 692184 692184 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 917880 917880 0 0.0
RAM 143292 143292 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890360 890360 0 0.0
RAM 141487 141487 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 851772 851772 0 0.0
RAM 142200 142200 0 0.0
nxp contact k32w0+release FLASH 585440 585440 0 0.0
RAM 71080 71080 0 0.0
mcxw71+release FLASH 600048 600048 0 0.0
RAM 63176 63176 0 0.0
light k32w0+release FLASH 612412 612412 0 0.0
RAM 70472 70472 0 0.0
k32w1+release FLASH 686592 686592 0 0.0
RAM 48808 48808 0 0.0
lock mcxw71+release FLASH 762928 762928 0 0.0
RAM 70844 70844 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646812 1646812 0 0.0
RAM 212104 212104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554236 1554236 0 0.0
RAM 208904 208904 0 0.0
light cy8ckit_062s2_43012 FLASH 1469564 1469564 0 0.0
RAM 200880 200880 0 0.0
lock cy8ckit_062s2_43012 FLASH 1467292 1467292 0 0.0
RAM 225240 225240 0 0.0
qpg lighting-app qpg6105+debug FLASH 664024 664024 0 0.0
RAM 105424 105424 0 0.0
lock-app qpg6105+debug FLASH 621812 621812 0 0.0
RAM 99868 99868 0 0.0
stm32 light STM32WB5MM-DK FLASH 484728 484728 0 0.0
RAM 144880 144880 0 0.0
telink bridge-app tlsr9258a FLASH 682916 682916 0 0.0
RAM 91208 91208 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623346 623346 0 0.0
RAM 31440 31440 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772176 772176 0 0.0
RAM 49300 49300 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 710770 710770 0 0.0
RAM 73504 73504 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 627790 627790 0 0.0
RAM 142140 142140 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 813804 813804 0 0.0
RAM 99684 99684 0 0.0
tizen all-clusters-app arm unknown 4988 4988 0 0.0
FLASH 1734440 1734448 8 0.0
RAM 90744 90744 0 0.0
chip-tool-ubsan arm unknown 10804 10804 0 0.0
FLASH 17973406 17973406 0 0.0
RAM 7842608 7842608 0 0.0

Copy link

github-actions bot commented Dec 15, 2024

PR #36847: Size comparison from cfdaf79 to da758f2

Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section cfdaf79 da758f2 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1353340 1353340 0 0.0
RAM 104112 104112 0 0.0
bl702 lighting-app bl702+eth FLASH 651826 651826 0 0.0
RAM 25353 25353 0 0.0
bl702+wifi FLASH 829154 829154 0 0.0
RAM 14093 14093 0 0.0
bl706+mfd+rpc+littlefs FLASH 1057626 1057626 0 0.0
RAM 23933 23933 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 979000 979000 0 0.0
RAM 16596 16596 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 839760 839760 0 0.0
RAM 123664 123664 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825308 825308 0 0.0
RAM 125552 125552 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772096 772096 0 0.0
RAM 114020 114020 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756300 756300 0 0.0
RAM 114228 114228 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 539605 539605 0 0.0
RAM 205760 205760 0 0.0
lock CC3235SF_LAUNCHXL FLASH 573885 573885 0 0.0
RAM 205904 205904 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681513 681513 0 0.0
RAM 78724 78724 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701357 701357 0 0.0
RAM 81364 81364 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701357 701357 0 0.0
RAM 81364 81364 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658301 658301 0 0.0
RAM 73792 73792 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618073 618073 0 0.0
RAM 71708 71708 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637701 637701 0 0.0
RAM 74252 74252 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637701 637701 0 0.0
RAM 74252 74252 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637473 637473 0 0.0
RAM 74724 74724 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657181 657181 0 0.0
RAM 77268 77268 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657181 657181 0 0.0
RAM 77268 77268 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 613933 613933 0 0.0
RAM 68812 68812 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 633785 633785 0 0.0
RAM 71444 71444 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 633785 633785 0 0.0
RAM 71444 71444 0 0.0
efr32 lock-app BRD4187C FLASH 932340 932340 0 0.0
RAM 160192 160192 0 0.0
BRD4338a FLASH 746256 746248 -8 -0.0
RAM 233320 233320 0 0.0
window-app BRD4187C FLASH 1024912 1024912 0 0.0
RAM 128296 128296 0 0.0
esp32 all-clusters-app c3devkit DRAM 95360 95360 0 0.0
FLASH 1543380 1543380 0 0.0
IRAM 82542 82542 0 0.0
m5stack DRAM 116312 116312 0 0.0
FLASH 1549950 1549950 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4720 4720 0 0.0
FLASH 2715629 2715631 2 0.0
RAM 129800 129800 0 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 6009314 6009316 2 0.0
RAM 523544 523544 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5345370 5345372 2 0.0
RAM 242600 242600 0 0.0
bridge-app debug unknown 5440 5440 0 0.0
FLASH 4684938 4684940 2 0.0
RAM 218416 218416 0 0.0
chip-tool debug unknown 5992 5992 0 0.0
FLASH 12849310 12849310 0 0.0
RAM 582506 582506 0 0.0
chip-tool-ipv6only arm64 unknown 21352 21352 0 0.0
FLASH 10983936 10983936 0 0.0
RAM 633424 633424 0 0.0
fabric-admin debug unknown 5816 5816 0 0.0
FLASH 11255859 11255859 0 0.0
RAM 582850 582850 0 0.0
fabric-bridge-app debug unknown 4696 4696 0 0.0
FLASH 4510514 4510516 2 0.0
RAM 205600 205600 0 0.0
fabric-sync debug unknown 4936 4936 0 0.0
FLASH 5610549 5610549 0 0.0
RAM 472584 472584 0 0.0
lighting-app debug+rpc+ui unknown 6104 6104 0 0.0
FLASH 5621633 5621633 0 0.0
RAM 228792 228792 0 0.0
lock-app debug unknown 5376 5376 0 0.0
FLASH 4734178 4734180 2 0.0
RAM 204776 204776 0 0.0
ota-provider-app debug unknown 4752 4752 0 0.0
FLASH 4359916 4359918 2 0.0
RAM 198448 198448 0 0.0
ota-requestor-app debug unknown 4688 4688 0 0.0
FLASH 4498908 4498910 2 0.0
RAM 203032 203032 0 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3032765 3032765 0 0.0
RAM 160424 160424 0 0.0
thermostat-no-ble arm64 unknown 9536 9536 0 0.0
FLASH 4104176 4104192 16 0.0
RAM 243040 243040 0 0.0
tv-app debug unknown 5704 5704 0 0.0
FLASH 5959461 5959461 0 0.0
RAM 596016 596016 0 0.0
tv-casting-app debug unknown 5288 5288 0 0.0
FLASH 11055165 11055165 0 0.0
RAM 692184 692184 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 917880 917880 0 0.0
RAM 143292 143292 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890360 890360 0 0.0
RAM 141487 141487 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 851772 851772 0 0.0
RAM 142200 142200 0 0.0
nxp contact k32w0+release FLASH 585440 585440 0 0.0
RAM 71080 71080 0 0.0
mcxw71+release FLASH 600048 600048 0 0.0
RAM 63176 63176 0 0.0
light k32w0+release FLASH 612412 612412 0 0.0
RAM 70472 70472 0 0.0
k32w1+release FLASH 686592 686592 0 0.0
RAM 48808 48808 0 0.0
lock mcxw71+release FLASH 762928 762928 0 0.0
RAM 70844 70844 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646812 1646812 0 0.0
RAM 212104 212104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554236 1554236 0 0.0
RAM 208904 208904 0 0.0
light cy8ckit_062s2_43012 FLASH 1469564 1469564 0 0.0
RAM 200880 200880 0 0.0
lock cy8ckit_062s2_43012 FLASH 1467292 1467292 0 0.0
RAM 225240 225240 0 0.0
qpg lighting-app qpg6105+debug FLASH 664024 664024 0 0.0
RAM 105424 105424 0 0.0
lock-app qpg6105+debug FLASH 621812 621812 0 0.0
RAM 99868 99868 0 0.0
stm32 light STM32WB5MM-DK FLASH 484728 484728 0 0.0
RAM 144880 144880 0 0.0
telink bridge-app tlsr9258a FLASH 682916 682916 0 0.0
RAM 91208 91208 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623346 623346 0 0.0
RAM 31440 31440 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772176 772176 0 0.0
RAM 49300 49300 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 710770 710770 0 0.0
RAM 73504 73504 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 627790 627790 0 0.0
RAM 142140 142140 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 813804 813804 0 0.0
RAM 99684 99684 0 0.0
tizen all-clusters-app arm unknown 4988 4988 0 0.0
FLASH 1734440 1734448 8 0.0
RAM 90744 90744 0 0.0
chip-tool-ubsan arm unknown 10804 10804 0 0.0
FLASH 17973406 17973406 0 0.0
RAM 7842608 7842608 0 0.0

Copy link

github-actions bot commented Dec 18, 2024

PR #36847: Size comparison from cfdaf79 to ebaafcf

Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section cfdaf79 ebaafcf change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1353340 1353786 446 0.0
RAM 104112 104136 24 0.0
bl702 lighting-app bl702+eth FLASH 651826 651960 134 0.0
RAM 25353 25353 0 0.0
bl702+wifi FLASH 829154 829548 394 0.0
RAM 14093 14093 0 0.0
bl706+mfd+rpc+littlefs FLASH 1057626 1058020 394 0.0
RAM 23933 23933 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 979000 979394 394 0.0
RAM 16596 16596 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 839760 839968 208 0.0
RAM 123664 123672 8 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825308 825492 184 0.0
RAM 125552 125560 8 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772096 772372 276 0.0
RAM 114020 114036 16 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756300 756560 260 0.0
RAM 114228 114236 8 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 539605 539853 248 0.0
RAM 205760 205776 16 0.0
lock CC3235SF_LAUNCHXL FLASH 573885 574149 264 0.0
RAM 205904 205920 16 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681513 681737 224 0.0
RAM 78724 78732 8 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701357 701589 232 0.0
RAM 81364 81372 8 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701357 701589 232 0.0
RAM 81364 81372 8 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658301 658517 216 0.0
RAM 73792 73800 8 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618073 618353 280 0.0
RAM 71708 71724 16 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637701 637981 280 0.0
RAM 74252 74268 16 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637701 637981 280 0.0
RAM 74252 74268 16 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637473 637753 280 0.0
RAM 74724 74732 8 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657181 657461 280 0.0
RAM 77268 77276 8 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657181 657461 280 0.0
RAM 77268 77276 8 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 613933 614205 272 0.0
RAM 68812 68820 8 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 633785 634065 280 0.0
RAM 71444 71452 8 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 633785 634065 280 0.0
RAM 71444 71452 8 0.0
efr32 lock-app BRD4187C FLASH 932340 932620 280 0.0
RAM 160192 160204 12 0.0
BRD4338a FLASH 746256 746584 328 0.0
RAM 233320 233332 12 0.0
window-app BRD4187C FLASH 1024912 1025224 312 0.0
RAM 128296 128308 12 0.0
esp32 all-clusters-app c3devkit DRAM 95360 95376 16 0.0
FLASH 1543380 1543590 210 0.0
IRAM 82542 82542 0 0.0
m5stack DRAM 116312 116320 8 0.0
FLASH 1549950 1550190 240 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4720 4720 0 0.0
FLASH 2715629 2716227 598 0.0
RAM 129800 129928 128 0.1
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 6009314 6009538 224 0.0
RAM 523544 523640 96 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5345370 5346046 676 0.0
RAM 242600 242728 128 0.1
bridge-app debug unknown 5440 5440 0 0.0
FLASH 4684938 4685582 644 0.0
RAM 218416 218528 112 0.1
chip-tool debug unknown 5992 5992 0 0.0
FLASH 12849310 12849428 118 0.0
RAM 582506 582506 0 0.0
chip-tool-ipv6only arm64 unknown 21352 21352 0 0.0
FLASH 10983936 10984032 96 0.0
RAM 633424 633432 8 0.0
fabric-admin debug unknown 5816 5816 0 0.0
FLASH 11255859 11255977 118 0.0
RAM 582850 582850 0 0.0
fabric-bridge-app debug unknown 4696 4696 0 0.0
FLASH 4510514 4511114 600 0.0
RAM 205600 205696 96 0.0
fabric-sync debug unknown 4936 4936 0 0.0
FLASH 5610549 5611173 624 0.0
RAM 472584 472696 112 0.0
lighting-app debug+rpc+ui unknown 6104 6104 0 0.0
FLASH 5621633 5622305 672 0.0
RAM 228792 228888 96 0.0
lock-app debug unknown 5376 5376 0 0.0
FLASH 4734178 4734854 676 0.0
RAM 204776 204872 96 0.0
ota-provider-app debug unknown 4752 4752 0 0.0
FLASH 4359916 4360560 644 0.0
RAM 198448 198560 112 0.1
ota-requestor-app debug unknown 4688 4688 0 0.0
FLASH 4498908 4499584 676 0.0
RAM 203032 203144 112 0.1
shell debug unknown 4248 4248 0 0.0
FLASH 3032765 3033469 704 0.0
RAM 160424 160552 128 0.1
thermostat-no-ble arm64 unknown 9536 9552 16 0.2
FLASH 4104176 4104832 656 0.0
RAM 243040 243168 128 0.1
tv-app debug unknown 5704 5704 0 0.0
FLASH 5959461 5960165 704 0.0
RAM 596016 596128 112 0.0
tv-casting-app debug unknown 5288 5288 0 0.0
FLASH 11055165 11055821 656 0.0
RAM 692184 692328 144 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 917880 918112 232 0.0
RAM 143292 143308 16 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890360 890256 -104 -0.0
RAM 141487 141495 8 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 851772 851992 220 0.0
RAM 142200 142220 20 0.0
nxp contact k32w0+release FLASH 585440 585624 184 0.0
RAM 71080 71088 8 0.0
mcxw71+release FLASH 600048 600320 272 0.0
RAM 63176 63184 8 0.0
light k32w0+release FLASH 612412 612548 136 0.0
RAM 70472 70480 8 0.0
k32w1+release FLASH 686592 686808 216 0.0
RAM 48808 48816 8 0.0
lock mcxw71+release FLASH 762928 763216 288 0.0
RAM 70844 70852 8 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1646812 1647132 320 0.0
RAM 212104 212104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554236 1554564 328 0.0
RAM 208904 208920 16 0.0
light cy8ckit_062s2_43012 FLASH 1469564 1469884 320 0.0
RAM 200880 200888 8 0.0
lock cy8ckit_062s2_43012 FLASH 1467292 1467604 312 0.0
RAM 225240 225248 8 0.0
qpg lighting-app qpg6105+debug FLASH 664024 664288 264 0.0
RAM 105424 105432 8 0.0
lock-app qpg6105+debug FLASH 621812 622108 296 0.0
RAM 99868 99884 16 0.0
stm32 light STM32WB5MM-DK FLASH 484728 485004 276 0.1
RAM 144880 144888 8 0.0
telink bridge-app tlsr9258a FLASH 682916 683206 290 0.0
RAM 91208 91224 16 0.0
contact-sensor-app tlsr9528a_retention FLASH 623346 623620 274 0.0
RAM 31440 31456 16 0.1
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772176 772438 262 0.0
RAM 49300 49316 16 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 710770 711060 290 0.0
RAM 73504 73520 16 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 627790 628076 286 0.0
RAM 142140 142156 16 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 813804 814094 290 0.0
RAM 99684 99700 16 0.0
tizen all-clusters-app arm unknown 4988 4996 8 0.2
FLASH 1734440 1734952 512 0.0
RAM 90744 90788 44 0.0
chip-tool-ubsan arm unknown 10804 10804 0 0.0
FLASH 17973406 17973686 280 0.0
RAM 7842608 7842724 116 0.0

@feasel0 feasel0 changed the title Fix ParseArgs for ESP32 and add lib/support/tests to the ESP32 unit tests target. Adds lib/support/tests to the ESP32 unit-test target. Makes platform-specific fixes to ParseArgs and EncodeTlvElement. Dec 31, 2024
@shripad621git
Copy link
Contributor

@feasel0 , can you please post a list of the test logs before and after your changes. If they are many in number, can you please post one log for each type: for e.g.: 1.ParseArgs tests and 2. EnocdeTLV tests in PR description.

@feasel0
Copy link
Contributor Author

feasel0 commented Mar 10, 2025

Added logs to the description:

Copy link
Contributor

@shripad621git shripad621git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

github-actions bot commented Mar 26, 2025

PR #36847: Size comparison from 1739c88 to fc8eb8f

Full report (75 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 1739c88 fc8eb8f change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1098468 1098468 0 0.0
RAM 94866 94866 0 0.0
bl702 lighting-app bl702+eth FLASH 653398 653398 0 0.0
RAM 33533 33533 0 0.0
bl702+wifi FLASH 830654 830654 0 0.0
RAM 22257 22257 0 0.0
bl706+mfd+rpc+littlefs FLASH 1063158 1063158 0 0.0
RAM 32181 32181 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 893960 893960 0 0.0
RAM 26920 26920 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 976836 976836 0 0.0
RAM 24668 24668 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 818604 818604 0 0.0
RAM 120296 120296 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 827516 827516 0 0.0
RAM 125392 125392 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 774360 774360 0 0.0
RAM 113764 113764 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 758644 758644 0 0.0
RAM 113972 113972 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 541966 541966 0 0.0
RAM 205152 205152 0 0.0
lock CC3235SF_LAUNCHXL FLASH 576066 576066 0 0.0
RAM 205400 205400 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 660173 660173 0 0.0
RAM 75436 75436 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 680033 680033 0 0.0
RAM 78076 78076 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 680033 680033 0 0.0
RAM 78076 78076 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 636957 636957 0 0.0
RAM 70504 70504 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 620469 620469 0 0.0
RAM 71676 71676 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 640105 640105 0 0.0
RAM 74220 74220 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 640105 640105 0 0.0
RAM 74220 74220 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 639925 639925 0 0.0
RAM 74684 74684 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 659641 659641 0 0.0
RAM 77228 77228 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 659641 659641 0 0.0
RAM 77228 77228 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 616265 616265 0 0.0
RAM 68772 68772 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 636125 636125 0 0.0
RAM 71412 71412 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 636125 636125 0 0.0
RAM 71412 71412 0 0.0
efr32 lock-app BRD4187C FLASH 941128 941128 0 0.0
RAM 159944 159944 0 0.0
BRD4338a FLASH 735200 735200 0 0.0
RAM 234856 234856 0 0.0
window-app BRD4187C FLASH 1033536 1033528 -8 -0.0
RAM 128048 128048 0 0.0
esp32 all-clusters-app c3devkit DRAM 103384 103384 0 0.0
FLASH 1785454 1785454 0 0.0
IRAM 83846 83846 0 0.0
m5stack DRAM 121964 121964 0 0.0
FLASH 1751930 1751930 0 0.0
IRAM 117043 117043 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2659589 2659591 2 0.0
RAM 112304 112304 0 0.0
all-clusters-app debug unknown 5584 5584 0 0.0
FLASH 6124544 6124546 2 0.0
RAM 517584 517584 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5317520 5317522 2 0.0
RAM 222616 222616 0 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4631416 4631418 2 0.0
RAM 201000 201000 0 0.0
camera-app debug unknown 5456 5456 0 0.0
FLASH 4693950 4693952 2 0.0
RAM 196448 196448 0 0.0
camera-controller debug unknown 5776 5776 0 0.0
FLASH 11346267 11346267 0 0.0
RAM 597408 597408 0 0.0
chip-tool debug unknown 6112 6112 0 0.0
FLASH 13366455 13366455 0 0.0
RAM 606048 606048 0 0.0
chip-tool-ipv6only arm64 unknown 22120 22120 0 0.0
FLASH 11552024 11552024 0 0.0
RAM 658728 658728 0 0.0
fabric-admin debug unknown 5800 5800 0 0.0
FLASH 11637485 11637485 0 0.0
RAM 605832 605832 0 0.0
fabric-bridge-app debug unknown 4720 4720 0 0.0
FLASH 4462368 4462370 2 0.0
RAM 188200 188200 0 0.0
fabric-sync debug unknown 4976 4976 0 0.0
FLASH 5579573 5579573 0 0.0
RAM 472064 472064 0 0.0
lighting-app debug+rpc+ui unknown 6192 6192 0 0.0
FLASH 5526017 5526017 0 0.0
RAM 205200 205200 0 0.0
lock-app debug unknown 5424 5424 0 0.0
FLASH 4698160 4698162 2 0.0
RAM 192360 192360 0 0.0
ota-provider-app debug unknown 4760 4760 0 0.0
FLASH 4320366 4320368 2 0.0
RAM 181016 181016 0 0.0
ota-requestor-app debug unknown 4712 4712 0 0.0
FLASH 4450722 4450724 2 0.0
RAM 185504 185504 0 0.0
shell debug unknown 4240 4240 0 0.0
FLASH 2958124 2958124 0 0.0
RAM 145616 145616 0 0.0
thermostat-no-ble arm64 unknown 9456 9456 0 0.0
FLASH 4147192 4147208 16 0.0
RAM 229848 229848 0 0.0
tv-app debug unknown 5752 5752 0 0.0
FLASH 5918389 5918405 16 0.0
RAM 595496 595496 0 0.0
tv-casting-app debug unknown 5320 5320 0 0.0
FLASH 11539197 11539197 0 0.0
RAM 721840 721840 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 916320 916320 0 0.0
RAM 167447 167447 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 908992 908992 0 0.0
RAM 145691 145691 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 852776 852776 0 0.0
RAM 141227 141227 0 0.0
nxp contact k32w0+release FLASH 588608 588608 0 0.0
RAM 71004 71004 0 0.0
mcxw71+release FLASH 607144 607144 0 0.0
RAM 63280 63280 0 0.0
light k32w0+release FLASH 614420 614420 0 0.0
RAM 70292 70292 0 0.0
k32w1+release FLASH 691440 691440 0 0.0
RAM 72128 72128 0 0.0
lock mcxw71+release FLASH 756896 756896 0 0.0
RAM 67692 67692 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1661724 1661724 0 0.0
RAM 212336 212336 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1565692 1565692 0 0.0
RAM 208544 208544 0 0.0
light cy8ckit_062s2_43012 FLASH 1442596 1442596 0 0.0
RAM 197320 197320 0 0.0
lock cy8ckit_062s2_43012 FLASH 1471492 1471492 0 0.0
RAM 224984 224984 0 0.0
qpg lighting-app qpg6105+debug FLASH 665196 665196 0 0.0
RAM 105180 105180 0 0.0
lock-app qpg6105+debug FLASH 623664 623664 0 0.0
RAM 99792 99792 0 0.0
stm32 light STM32WB5MM-DK FLASH 461160 461160 0 0.0
RAM 141496 141496 0 0.0
telink bridge-app tl7218x FLASH 665952 665952 0 0.0
RAM 90712 90712 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623544 623544 0 0.0
RAM 31488 31488 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 762730 762730 0 0.0
RAM 40436 40436 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 755838 755838 0 0.0
RAM 97548 97548 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 682902 682902 0 0.0
RAM 52200 52200 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 711460 711460 0 0.0
RAM 73416 73416 0 0.0
light-switch-app-ota-shell-factory-data tl3218x_retention FLASH 704010 704010 0 0.0
RAM 37680 37680 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 603470 603470 0 0.0
RAM 138648 138648 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 790904 790904 0 0.0
RAM 96404 96404 0 0.0
tizen all-clusters-app arm unknown 5152 5152 0 0.0
FLASH 1784016 1784024 8 0.0
RAM 94280 94280 0 0.0
chip-tool-ubsan arm unknown 11560 11560 0 0.0
FLASH 19107902 19107902 0 0.0
RAM 8356268 8356268 0 0.0

@dhrishi
Copy link
Contributor

dhrishi commented Mar 29, 2025

Approving as per the review from @shripad621git

@@ -332,48 +394,115 @@ bool ParseArgs(const char * progName, int argc, char * const argv[], OptionSet *
goto done;
}

#ifdef CONFIG_NON_POSIX_GETOPT_LONG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use #if instead of #ifdef to force defines to exist as need.

This does mean that th define will have to be set somewhere else than just a specific file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use #if

@@ -315,7 +315,13 @@ CHIP_ERROR EncodeTlvElement(const Json::Value & val, TLV::TLVWriter & writer, co

Platform::ScopedMemoryBuffer<uint8_t> byteString;
byteString.Alloc(BASE64_MAX_DECODED_LEN(static_cast<uint16_t>(encodedLen)));
VerifyOrReturnError(byteString.Get() != nullptr, CHIP_ERROR_NO_MEMORY);

// On a platform where malloc(0) is null (which could be misinterpreted as "out of memory")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have the check for encodedLen on all platforms?
Is there extra benefit to check for non-null even if encoded length is 0 ? If encoded length is 0, does it make sense to short-circuit and set decoded length 0 immediately?

Copy link
Contributor Author

@feasel0 feasel0 Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this to break out of the case and skip setting decodedLen and calling writer.PutBytes if it's a zero length string. For now I only have this "check and break" performed if it's a platform like esp32 (where we have to do that because malloc(0)==null).

    case TLV::kTLVType_ByteString: {
        VerifyOrReturnError(val.isString(), CHIP_ERROR_INVALID_ARGUMENT);
        const std::string valAsString = val.asString();
        size_t encodedLen             = valAsString.length();
        VerifyOrReturnError(CanCastTo<uint16_t>(encodedLen), CHIP_ERROR_INVALID_ARGUMENT);

//BEGIN NEW CODE
#if CONFIG_MALLOC_0_IS_NULL
        // Skip PutBytes for 0-length strings.
        if (encodedLen == 0)
            break;
#endif
//END NEW CODE

        // Check if the length is a multiple of 4 as strict padding is required.
        VerifyOrReturnError(encodedLen % 4 == 0, CHIP_ERROR_INVALID_ARGUMENT);

        Platform::ScopedMemoryBuffer<uint8_t> byteString;
        byteString.Alloc(BASE64_MAX_DECODED_LEN(static_cast<uint16_t>(encodedLen)));

        VerifyOrReturnError(byteString.Get() != nullptr, CHIP_ERROR_NO_MEMORY);

        auto decodedLen = Base64Decode(valAsString.c_str(), static_cast<uint16_t>(encodedLen), byteString.Get());
        VerifyOrReturnError(decodedLen < UINT16_MAX, CHIP_ERROR_INVALID_ARGUMENT);
        ReturnErrorOnFailure(writer.PutBytes(tag, byteString.Get(), decodedLen));
        break;
    }

However we have the option of performing the "check and break" on all platforms if we just get rid of the #if directive and drop the CONFIG_MALLOC_0_IS_NULL macro entirely. This makes the code slightly larger on all platforms (an extra "if" statement and an extra "break" statement), but it saves some execution time every time we need to encode an empty string (an extra 6 lines of code). Is this worth it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andy31415
If the way I have it now looks good, then I have no more changes to add to this PR.

#

#
# This script cleans the files generated by building the unit tests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to apply only if using build_examples (since that determines the output directory in /out.

We should add this info to the comment as this seems to be designed to be specific to build_examples usage with exactly esp32-qemu-tests target.

Copy link
Contributor Author

@feasel0 feasel0 Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated comment

@feasel0 feasel0 requested a review from andy31415 April 4, 2025 15:03
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