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

Switch a few more unit tests to async message delivery. #12482

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

Problem

Our loopback transport defaults to synchronous message delivery, with replies coming in before the send call returns. This causes various problems in code that does not expect this behavior, which can't happen in normal operation.

Change overview

Move the "do async message delivery" up into a class defined in MessagingContext.h, so it's not IM-specific, and use it in two tests that should exercise some edge cases:

  • src/messaging/tests/TestExchangeMgr.cpp to test that tests in src/messaging work with this setup.
  • src/protocols/secure_channel/tests/TestPASESession.cpp to test that tests with a custom transport impl work with this setup.

Testing

Unit tests still pass with the new setup.

@woody-apple
Copy link
Contributor

Fast tracking, given this is updating and adding tests.

@bzbarsky-apple
Copy link
Contributor Author

@woody-apple I'd really like this to get a look from @pan-apple before we merge, to make sure I am not missing something that would make the tests no longer be testing what we want them to test.

@github-actions
Copy link

github-actions bot commented Dec 2, 2021

PR #12482: Size comparison from e2e4c17 to 7b1efef

Full report (33 builds for efr32, esp32, linux, mbed, nrfconnect, p6, telink)
platform target config section e2e4c17 7b1efef change % change
efr32 lighting-app BRD4161A (read only) 751416 751416 0 0.0
(read/write) 119992 119992 0 0.0
.bss 118160 118160 0 0.0
.data 1828 1828 0 0.0
.text 751408 751408 0 0.0
BRD4161A+rpc (read only) 780064 780064 0 0.0
(read/write) 138296 138296 0 0.0
.bss 136360 136360 0 0.0
.data 1936 1936 0 0.0
.text 780056 780056 0 0.0
lock-app BRD4161A (read only) 725256 725256 0 0.0
(read/write) 117696 117696 0 0.0
.bss 115912 115912 0 0.0
.data 1784 1784 0 0.0
.text 725248 725248 0 0.0
window-app BRD4161A (read only) 728568 728568 0 0.0
(read/write) 118120 118120 0 0.0
.bss 116328 116328 0 0.0
.data 1792 1792 0 0.0
.text 728560 728560 0 0.0
esp32 all-clusters-app c3devkit (read only) 847070 847070 0 0.0
(read/write) 1223602 1223602 0 0.0
.dram0.bss 56456 56456 0 0.0
.dram0.data 14052 14052 0 0.0
.flash.rodata 167632 167632 0 0.0
.flash.text 847070 847070 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 917671 917671 0 0.0
(read/write) 422580 422580 0 0.0
.dram0.bss 61848 61848 0 0.0
.dram0.data 34016 34016 0 0.0
.flash.rodata 195436 195436 0 0.0
.flash.text 912287 912287 0 0.0
.iram0.text 122943 122943 0 0.0
linux all-clusters-app debug (read only) 1834545 1834545 0 0.0
(read/write) 123840 123840 0 0.0
.bss 50640 50640 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 66816 66816 0 0.0
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 552 552 0 0.0
.rodata 146485 146485 0 0.0
.text 1546258 1546258 0 0.0
bridge-app debug+rpc (read only) 1417773 1417773 0 0.0
(read/write) 74032 74032 0 0.0
.bss 36048 36048 0 0.0
.data 1728 1728 0 0.0
.data.rel.ro 31248 31248 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 408 408 0 0.0
.rodata 119524 119524 0 0.0
.text 1194245 1194245 0 0.0
chip-tool debug (read only) 6589917 6589917 0 0.0
(read/write) 201616 201616 0 0.0
.bss 34344 34344 0 0.0
.data 1024 1024 0 0.0
.data.rel.ro 160696 160696 0 0.0
.dynamic 592 592 0 0.0
.got 4464 4464 0 0.0
.init 27 27 0 0.0
.init_array 480 480 0 0.0
.rodata 306104 306104 0 0.0
.text 5874469 5874469 0 0.0
lighting-app debug+rpc (read only) 1701561 1701561 0 0.0
(read/write) 107088 107088 0 0.0
.bss 41744 41744 0 0.0
.data 1280 1280 0 0.0
.data.rel.ro 58752 58752 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 536 536 0 0.0
.rodata 139313 139313 0 0.0
.text 1420498 1420498 0 0.0
ota-provider-app debug (read only) 1378297 1378297 0 0.0
(read/write) 72264 72264 0 0.0
.bss 38624 38624 0 0.0
.data 928 928 0 0.0
.data.rel.ro 27592 27592 0 0.0
.dynamic 592 592 0 0.0
.got 4048 4048 0 0.0
.init 27 27 0 0.0
.init_array 448 448 0 0.0
.rodata 120808 120808 0 0.0
.text 1153682 1153682 0 0.0
ota-requestor-app debug (read only) 1478321 1478321 0 0.0
(read/write) 76160 76160 0 0.0
.bss 40736 40736 0 0.0
.data 992 992 0 0.0
.data.rel.ro 29304 29304 0 0.0
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 472 472 0 0.0
.rodata 132720 132720 0 0.0
.text 1238354 1238354 0 0.0
shell debug (read only) 813129 813129 0 0.0
(read/write) 60264 60264 0 0.0
.bss 16904 16904 0 0.0
.data 256 256 0 0.0
.data.rel.ro 38656 38656 0 0.0
.dynamic 592 592 0 0.0
.got 3504 3504 0 0.0
.init 27 27 0 0.0
.init_array 344 344 0 0.0
.rodata 83506 83506 0 0.0
.text 623538 623538 0 0.0
tv-app debug (read only) 1995281 1995281 0 0.0
(read/write) 316760 316760 0 0.0
.bss 246112 246112 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 63440 63440 0 0.0
.dynamic 592 592 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 169352 169352 0 0.0
.text 1673602 1673602 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2308448 2308448 0 0.0
.bss 179516 179516 0 0.0
.data 5184 5184 0 0.0
.heap 851744 851744 0 0.0
.text 1271024 1271024 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2295096 2295096 0 0.0
.bss 173208 173208 0 0.0
.data 5496 5496 0 0.0
.heap 857744 857744 0 0.0
.text 1257696 1257696 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2268128 2268128 0 0.0
.bss 172024 172024 0 0.0
.data 5496 5496 0 0.0
.heap 858928 858928 0 0.0
.text 1230728 1230728 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1140008 1140008 0 0.0
.bss 11756 11756 0 0.0
.data 4376 4376 0 0.0
.heap 1020312 1020312 0 0.0
.text 103392 103392 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2046576 2046576 0 0.0
.bss 156704 156704 0 0.0
.data 4872 4872 0 0.0
.heap 874872 874872 0 0.0
.text 1009176 1009176 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 891339 891339 0 0.0
bss 113712 113712 0 0.0
rodata 99372 99372 0 0.0
text 602688 602688 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 854699 854699 0 0.0
bss 110060 110060 0 0.0
rodata 90732 90732 0 0.0
text 577684 577684 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 817234 817234 0 0.0
bss 115084 115084 0 0.0
rodata 94628 94628 0 0.0
text 533028 533028 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 862163 862163 0 0.0
bss 110748 110748 0 0.0
rodata 95108 95108 0 0.0
text 580940 580940 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 788318 788318 0 0.0
bss 112160 112160 0 0.0
rodata 90400 90400 0 0.0
text 511372 511372 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497463 497463 0 0.0
bss 51820 51820 0 0.0
rodata 45852 45852 0 0.0
text 339492 339492 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 868211 868211 0 0.0
bss 110884 110884 0 0.0
rodata 96844 96844 0 0.0
text 585008 585008 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 861275 861275 0 0.0
bss 110764 110764 0 0.0
rodata 94980 94980 0 0.0
text 580068 580068 0 0.0
shell nrf52840dk_nrf52840 (read/write) 779911 779911 0 0.0
bss 109696 109696 0 0.0
rodata 73796 73796 0 0.0
text 521916 521916 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 694938 694938 0 0.0
bss 110680 110680 0 0.0
rodata 68436 68436 0 0.0
text 442520 442520 0 0.0
p6 all-clusters-app default (read/write) 2338224 2338224 0 0.0
.bss 107704 107704 0 0.0
.data 2456 2456 0 0.0
.heap 923184 923184 0 0.0
.text 1296488 1296488 0 0.0
light-app default (read/write) 2277984 2277984 0 0.0
.bss 98436 98436 0 0.0
.data 2336 2336 0 0.0
.heap 932568 932568 0 0.0
.text 1236248 1236248 0 0.0
lock-app default (read/write) 2253336 2253336 0 0.0
.bss 97092 97092 0 0.0
.data 2296 2296 0 0.0
.heap 933952 933952 0 0.0
.text 1211600 1211600 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 794390 794390 0 0.0
bss 80288 80288 0 0.0
noinit 37160 37160 0 0.0
text 554452 554452 0 0.0

@bzbarsky-apple bzbarsky-apple force-pushed the more-async-test-messages branch from 7b1efef to e515c91 Compare December 2, 2021 19:30
@github-actions
Copy link

github-actions bot commented Dec 2, 2021

PR #12482: Size comparison from 803f3b8 to e515c91

Full report (39 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 803f3b8 e515c91 change % change
efr32 lighting-app BRD4161A (read only) 751432 751432 0 0.0
(read/write) 120008 120008 0 0.0
.bss 118176 118176 0 0.0
.data 1828 1828 0 0.0
.text 751424 751424 0 0.0
BRD4161A+rpc (read only) 780080 780080 0 0.0
(read/write) 138312 138312 0 0.0
.bss 136376 136376 0 0.0
.data 1936 1936 0 0.0
.text 780072 780072 0 0.0
lock-app BRD4161A (read only) 725272 725272 0 0.0
(read/write) 117712 117712 0 0.0
.bss 115928 115928 0 0.0
.data 1784 1784 0 0.0
.text 725264 725264 0 0.0
window-app BRD4161A (read only) 728600 728600 0 0.0
(read/write) 118136 118136 0 0.0
.bss 116344 116344 0 0.0
.data 1792 1792 0 0.0
.text 728592 728592 0 0.0
esp32 all-clusters-app c3devkit (read only) 847268 847268 0 0.0
(read/write) 1223618 1223618 0 0.0
.dram0.bss 56472 56472 0 0.0
.dram0.data 14052 14052 0 0.0
.flash.rodata 167632 167632 0 0.0
.flash.text 847268 847268 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 917827 917827 0 0.0
(read/write) 422596 422596 0 0.0
.dram0.bss 61864 61864 0 0.0
.dram0.data 34016 34016 0 0.0
.flash.rodata 195436 195436 0 0.0
.flash.text 912443 912443 0 0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 728608 728608 0 0.0
.bss 79280 79280 0 0.0
.data 1860 1860 0 0.0
.text 641668 641668 0 0.0
lock-app k32w061+debug (read/write) 617592 617592 0 0.0
.bss 69720 69720 0 0.0
.data 1824 1824 0 0.0
.text 540248 540248 0 0.0
shell k32w061+debug (read/write) 683460 683460 0 0.0
.bss 81376 81376 0 0.0
.data 1796 1796 0 0.0
.text 594488 594488 0 0.0
linux all-clusters-app debug (read only) 1835665 1835665 0 0.0
(read/write) 123840 123840 0 0.0
.bss 50640 50640 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 66816 66816 0 0.0
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 552 552 0 0.0
.rodata 146357 146357 0 0.0
.text 1547506 1547506 0 0.0
bridge-app debug+rpc (read only) 1417669 1417669 0 0.0
(read/write) 74032 74032 0 0.0
.bss 36048 36048 0 0.0
.data 1728 1728 0 0.0
.data.rel.ro 31248 31248 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 408 408 0 0.0
.rodata 119404 119404 0 0.0
.text 1194261 1194261 0 0.0
chip-tool debug (read only) 6613133 6613133 0 0.0
(read/write) 201744 201744 0 0.0
.bss 34344 34344 0 0.0
.data 1024 1024 0 0.0
.data.rel.ro 160824 160824 0 0.0
.dynamic 592 592 0 0.0
.got 4464 4464 0 0.0
.init 27 27 0 0.0
.init_array 480 480 0 0.0
.rodata 307128 307128 0 0.0
.text 5896373 5896373 0 0.0
lighting-app debug+rpc (read only) 1701465 1701465 0 0.0
(read/write) 107088 107088 0 0.0
.bss 41744 41744 0 0.0
.data 1280 1280 0 0.0
.data.rel.ro 58752 58752 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 536 536 0 0.0
.rodata 139185 139185 0 0.0
.text 1420530 1420530 0 0.0
ota-provider-app debug (read only) 1378201 1378201 0 0.0
(read/write) 72264 72264 0 0.0
.bss 38624 38624 0 0.0
.data 928 928 0 0.0
.data.rel.ro 27592 27592 0 0.0
.dynamic 592 592 0 0.0
.got 4048 4048 0 0.0
.init 27 27 0 0.0
.init_array 448 448 0 0.0
.rodata 120680 120680 0 0.0
.text 1153714 1153714 0 0.0
ota-requestor-app debug (read only) 1478225 1478225 0 0.0
(read/write) 76160 76160 0 0.0
.bss 40736 40736 0 0.0
.data 992 992 0 0.0
.data.rel.ro 29304 29304 0 0.0
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 472 472 0 0.0
.rodata 132592 132592 0 0.0
.text 1238386 1238386 0 0.0
shell debug (read only) 813129 813129 0 0.0
(read/write) 60264 60264 0 0.0
.bss 16904 16904 0 0.0
.data 256 256 0 0.0
.data.rel.ro 38656 38656 0 0.0
.dynamic 592 592 0 0.0
.got 3504 3504 0 0.0
.init 27 27 0 0.0
.init_array 344 344 0 0.0
.rodata 83506 83506 0 0.0
.text 623538 623538 0 0.0
tv-app debug (read only) 1995169 1995169 0 0.0
(read/write) 316760 316760 0 0.0
.bss 246112 246112 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 63440 63440 0 0.0
.dynamic 592 592 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 169224 169224 0 0.0
.text 1673618 1673618 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2308576 2308576 0 0.0
.bss 179532 179532 0 0.0
.data 5184 5184 0 0.0
.heap 851728 851728 0 0.0
.text 1271152 1271152 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2295096 2295096 0 0.0
.bss 173224 173224 0 0.0
.data 5496 5496 0 0.0
.heap 857728 857728 0 0.0
.text 1257696 1257696 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2268128 2268128 0 0.0
.bss 172040 172040 0 0.0
.data 5496 5496 0 0.0
.heap 858912 858912 0 0.0
.text 1230728 1230728 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1140008 1140008 0 0.0
.bss 11756 11756 0 0.0
.data 4376 4376 0 0.0
.heap 1020312 1020312 0 0.0
.text 103392 103392 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2046576 2046576 0 0.0
.bss 156704 156704 0 0.0
.data 4872 4872 0 0.0
.heap 874872 874872 0 0.0
.text 1009176 1009176 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 891323 891323 0 0.0
bss 113728 113728 0 0.0
rodata 99372 99372 0 0.0
text 602684 602684 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 854699 854699 0 0.0
bss 110076 110076 0 0.0
rodata 90732 90732 0 0.0
text 577680 577680 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 817234 817234 0 0.0
bss 115100 115100 0 0.0
rodata 94628 94628 0 0.0
text 533024 533024 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 862179 862179 0 0.0
bss 110764 110764 0 0.0
rodata 95108 95108 0 0.0
text 580936 580936 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 788334 788334 0 0.0
bss 112176 112176 0 0.0
rodata 90400 90400 0 0.0
text 511368 511368 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497463 497463 0 0.0
bss 51820 51820 0 0.0
rodata 45852 45852 0 0.0
text 339492 339492 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 868195 868195 0 0.0
bss 110900 110900 0 0.0
rodata 96844 96844 0 0.0
text 585004 585004 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 861275 861275 0 0.0
bss 110780 110780 0 0.0
rodata 94980 94980 0 0.0
text 580064 580064 0 0.0
shell nrf52840dk_nrf52840 (read/write) 779911 779911 0 0.0
bss 109696 109696 0 0.0
rodata 73796 73796 0 0.0
text 521916 521916 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 694938 694938 0 0.0
bss 110680 110680 0 0.0
rodata 68436 68436 0 0.0
text 442520 442520 0 0.0
p6 all-clusters-app default (read/write) 2338416 2338416 0 0.0
.bss 107720 107720 0 0.0
.data 2456 2456 0 0.0
.heap 923168 923168 0 0.0
.text 1296680 1296680 0 0.0
light-app default (read/write) 2278016 2278016 0 0.0
.bss 98452 98452 0 0.0
.data 2336 2336 0 0.0
.heap 932552 932552 0 0.0
.text 1236280 1236280 0 0.0
lock-app default (read/write) 2253368 2253368 0 0.0
.bss 97108 97108 0 0.0
.data 2296 2296 0 0.0
.heap 933936 933936 0 0.0
.text 1211632 1211632 0 0.0
qpg lighting-app qpg6100+debug (read only) 510408 510408 0 0.0
(read/write) 122332 122332 0 0.0
.bss 80240 80240 0 0.0
.data 964 964 0 0.0
.text 505088 505088 0 0.0
lock-app qpg6100+debug (read only) 483232 483232 0 0.0
(read/write) 122332 122332 0 0.0
.bss 79152 79152 0 0.0
.data 916 916 0 0.0
.text 477912 477912 0 0.0
persistent-storage-app qpg6100+debug (read only) 108208 108208 0 0.0
(read/write) 122332 122332 0 0.0
.bss 36696 36696 0 0.0
.data 292 292 0 0.0
.text 102888 102888 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 794430 794430 0 0.0
bss 80304 80304 0 0.0
noinit 37160 37160 0 0.0
text 554474 554474 0 0.0

@bzbarsky-apple bzbarsky-apple merged commit af77cc9 into project-chip:master Dec 2, 2021
@bzbarsky-apple bzbarsky-apple deleted the more-async-test-messages branch December 2, 2021 21:31
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