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

String values in YAML should test edge cases better. #11687

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

This adds garbage to the ends of all the strings and octet strings
being sent in yaml tests, and makes sure that garbage is not included
in the length, so the span is correct. The idea is to catch cases
where someone uses a span's pointer without checking its length.

This also adds a way to embed a 0 byte in an octet string (by using
\x00 in the yaml string) and adds support for both sending and
checking for such values.

Problem

No testing of octet string with embedded null.

Change overview

Add support for it, and a test.

Testing

Manual inspection of the generated test code.

@woody-apple
Copy link
Contributor

Fast tracking, given this is editing a test tool to improve tests.

@woody-apple
Copy link
Contributor

/rebase

This adds garbage to the ends of all the strings and octet strings
being sent in yaml tests, and makes sure that garbage is not included
in the length, so the span is correct.  The idea is to catch cases
where someone uses a span's pointer without checking its length.

This also adds a way to embed a 0 byte in an octet string (by using
\x00 in the yaml string) and adds support for both sending and
checking for such values.
@github-actions
Copy link

github-actions bot commented Nov 11, 2021

PR #11687: Size comparison from 4374a54 to 9c0b6dc

Increases above 0.2%:

platform target config section 4374a54 9c0b6dc change % change
linux chip-tool debug .rodata 255946 258186 2240 0.9
Increases (1 build for linux)
platform target config section 4374a54 9c0b6dc change % change
linux chip-tool debug (read only) 4908365 4913869 5504 0.1
.rodata 255946 258186 2240 0.9
.text 4372245 4375509 3264 0.1
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 4374a54 9c0b6dc change % change
efr32 lighting-app BRD4161A (read only) 745240 745240 0 0.0
(read/write) 115764 115764 0 0.0
.bss 113980 113980 0 0.0
.data 1784 1784 0 0.0
.text 745232 745232 0 0.0
BRD4161A+rpc (read only) 732788 732788 0 0.0
(read/write) 132392 132392 0 0.0
.bss 130484 130484 0 0.0
.data 1908 1908 0 0.0
.text 732780 732780 0 0.0
lock-app BRD4161A (read only) 722064 722064 0 0.0
(read/write) 113548 113548 0 0.0
.bss 111804 111804 0 0.0
.data 1740 1740 0 0.0
.text 722056 722056 0 0.0
window-app BRD4161A (read only) 722992 722992 0 0.0
(read/write) 113868 113868 0 0.0
.bss 112124 112124 0 0.0
.data 1744 1744 0 0.0
.text 722984 722984 0 0.0
esp32 all-clusters-app c3devkit (read only) 821852 821852 0 0.0
(read/write) 1221906 1221906 0 0.0
.dram0.bss 55832 55832 0 0.0
.dram0.data 14092 14092 0 0.0
.flash.rodata 166728 166728 0 0.0
.flash.text 821852 821852 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 892951 892951 0 0.0
(read/write) 420080 420080 0 0.0
.dram0.bss 60920 60920 0 0.0
.dram0.data 34056 34056 0 0.0
.flash.rodata 193780 193780 0 0.0
.flash.text 887567 887567 0 0.0
.iram0.text 122987 122987 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 700424 700424 0 0.0
.bss 77476 77476 0 0.0
.data 1908 1908 0 0.0
.text 615240 615240 0 0.0
lock-app k32w061+debug (read/write) 591644 591644 0 0.0
.bss 67996 67996 0 0.0
.data 1876 1876 0 0.0
.text 515972 515972 0 0.0
shell k32w061+debug (read/write) 657324 657324 0 0.0
.bss 78788 78788 0 0.0
.data 1844 1844 0 0.0
.text 570892 570892 0 0.0
linux all-clusters-app debug (read only) 1699113 1699113 0 0.0
(read/write) 125856 125856 0 0.0
.bss 57328 57328 0 0.0
.data 1010 1010 0 0.0
.data.rel.ro 62256 62256 0 0.0
.dynamic 592 592 0 0.0
.got 4088 4088 0 0.0
.init 27 27 0 0.0
.init_array 552 552 0 0.0
.rodata 139125 139125 0 0.0
.text 1426498 1426498 0 0.0
bridge-app debug+rpc (read only) 1298741 1298741 0 0.0
(read/write) 77264 77264 0 0.0
.bss 42800 42800 0 0.0
.data 1568 1568 0 0.0
.data.rel.ro 27928 27928 0 0.0
.dynamic 592 592 0 0.0
.got 3952 3952 0 0.0
.init 27 27 0 0.0
.init_array 408 408 0 0.0
.rodata 110932 110932 0 0.0
.text 1091365 1091365 0 0.0
chip-tool debug (read only) 4908365 4913869 5504 0.1
(read/write) 154120 154120 0 0.0
.bss 41096 41096 0 0.0
.data 2272 2272 0 0.0
.data.rel.ro 105312 105312 0 0.0
.dynamic 592 592 0 0.0
.got 4368 4368 0 0.0
.init 27 27 0 0.0
.init_array 472 472 0 0.0
.rodata 255946 258186 2240 0.9
.text 4372245 4375509 3264 0.1
lighting-app debug+rpc (read only) 1565401 1565401 0 0.0
(read/write) 109936 109936 0 0.0
.bss 47984 47984 0 0.0
.data 1202 1202 0 0.0
.data.rel.ro 55456 55456 0 0.0
.dynamic 608 608 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 536 536 0 0.0
.rodata 128849 128849 0 0.0
.text 1302322 1302322 0 0.0
ota-provider-app debug (read only) 1260153 1260153 0 0.0
(read/write) 75048 75048 0 0.0
.bss 44416 44416 0 0.0
.data 752 752 0 0.0
.data.rel.ro 24776 24776 0 0.0
.dynamic 592 592 0 0.0
.got 4016 4016 0 0.0
.init 27 27 0 0.0
.init_array 448 448 0 0.0
.rodata 112647 112647 0 0.0
.text 1050706 1050706 0 0.0
ota-requestor-app debug (read only) 1345225 1345225 0 0.0
(read/write) 78816 78816 0 0.0
.bss 46880 46880 0 0.0
.data 816 816 0 0.0
.data.rel.ro 26040 26040 0 0.0
.dynamic 592 592 0 0.0
.got 3992 3992 0 0.0
.init 27 27 0 0.0
.init_array 472 472 0 0.0
.rodata 123760 123760 0 0.0
.text 1122114 1122114 0 0.0
shell debug (read only) 788665 788665 0 0.0
(read/write) 65064 65064 0 0.0
.bss 23400 23400 0 0.0
.data 242 242 0 0.0
.data.rel.ro 36928 36928 0 0.0
.dynamic 592 592 0 0.0
.got 3528 3528 0 0.0
.init 27 27 0 0.0
.init_array 344 344 0 0.0
.rodata 77615 77615 0 0.0
.text 609154 609154 0 0.0
tv-app debug (read only) 1843097 1843097 0 0.0
(read/write) 407640 407640 0 0.0
.bss 339656 339656 0 0.0
.data 2736 2736 0 0.0
.data.rel.ro 59600 59600 0 0.0
.dynamic 592 592 0 0.0
.got 4408 4408 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 155821 155821 0 0.0
.text 1542802 1542802 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2289256 2289256 0 0.0
.bss 179412 179412 0 0.0
.data 5216 5216 0 0.0
.heap 851816 851816 0 0.0
.text 1251856 1251856 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2272728 2272728 0 0.0
.bss 172524 172524 0 0.0
.data 5576 5576 0 0.0
.heap 858344 858344 0 0.0
.text 1235328 1235328 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2248352 2248352 0 0.0
.bss 171404 171404 0 0.0
.data 5568 5568 0 0.0
.heap 859472 859472 0 0.0
.text 1210952 1210952 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139744 1139744 0 0.0
.bss 11752 11752 0 0.0
.data 4368 4368 0 0.0
.heap 1020328 1020328 0 0.0
.text 103128 103128 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2048376 2048376 0 0.0
.bss 155912 155912 0 0.0
.data 4968 4968 0 0.0
.heap 875568 875568 0 0.0
.text 1010976 1010976 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 862919 862919 0 0.0
bss 110932 110932 0 0.0
rodata 96856 96856 0 0.0
text 579516 579516 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 825307 825307 0 0.0
bss 107284 107284 0 0.0
rodata 88044 88044 0 0.0
text 553688 553688 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 787974 787974 0 0.0
bss 112304 112304 0 0.0
rodata 92112 92112 0 0.0
text 508984 508984 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 838151 838151 0 0.0
bss 109956 109956 0 0.0
rodata 92920 92920 0 0.0
text 559816 559816 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 763450 763450 0 0.0
bss 111368 111368 0 0.0
rodata 88228 88228 0 0.0
text 489376 489376 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497327 497327 0 0.0
bss 51824 51824 0 0.0
rodata 45780 45780 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 844247 844247 0 0.0
bss 110096 110096 0 0.0
rodata 94632 94632 0 0.0
text 563980 563980 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 838007 838007 0 0.0
bss 109992 109992 0 0.0
rodata 92920 92920 0 0.0
text 559552 559552 0 0.0
shell nrf52840dk_nrf52840 (read/write) 775483 775483 0 0.0
bss 108736 108736 0 0.0
rodata 72160 72160 0 0.0
text 520008 520008 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 690538 690538 0 0.0
bss 109720 109720 0 0.0
rodata 66804 66804 0 0.0
text 440616 440616 0 0.0
p6 all-clusters-app default (read/write) 2297144 2297144 0 0.0
.bss 112416 112416 0 0.0
.data 2520 2520 0 0.0
.heap 918408 918408 0 0.0
.text 1255408 1255408 0 0.0
lock-app default (read/write) 2211752 2211752 0 0.0
.bss 101264 101264 0 0.0
.data 2400 2400 0 0.0
.heap 929680 929680 0 0.0
.text 1170016 1170016 0 0.0
qpg lighting-app qpg6100+debug (read only) 492240 492240 0 0.0
(read/write) 114144 114144 0 0.0
.bss 50624 50624 0 0.0
.data 1008 1008 0 0.0
.text 486920 486920 0 0.0
lock-app qpg6100+debug (read only) 466976 466976 0 0.0
(read/write) 114140 114140 0 0.0
.bss 49560 49560 0 0.0
.data 964 964 0 0.0
.text 461656 461656 0 0.0
persistent-storage-app qpg6100+debug (read only) 105408 105408 0 0.0
(read/write) 114142 114142 0 0.0
.bss 8978 8978 0 0.0
.data 272 272 0 0.0
.text 100088 100088 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 665114 665114 0 0.0
bss 69304 69304 0 0.0
noinit 33216 33216 0 0.0
text 459996 459996 0 0.0

@bzbarsky-apple bzbarsky-apple merged commit 4ae5f21 into project-chip:master Nov 11, 2021
@bzbarsky-apple bzbarsky-apple deleted the better-string-testing branch November 11, 2021 22:40
PSONALl pushed a commit to PSONALl/connectedhomeip that referenced this pull request Dec 3, 2021
)

This adds garbage to the ends of all the strings and octet strings
being sent in yaml tests, and makes sure that garbage is not included
in the length, so the span is correct.  The idea is to catch cases
where someone uses a span's pointer without checking its length.

This also adds a way to embed a 0 byte in an octet string (by using
\x00 in the yaml string) and adds support for both sending and
checking for such values.
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.

2 participants