examples/rpmsgsocket: add rpmsg socket test cases #3372
+371
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Analyze parameters to determine whether to use non blocking mode and whether to delay before exiting.
Mainly used for quickly establishing connections, sending a small message and immediately disconnecting, multiple runs can simulate the "multiple connections" scenario, and cooperate with server-side logic to verify the reliability or concurrency pressure of short connections.f the delay parameter is enabled, sleep for 1 second after normal completion, then close the socket and release the buffer.
Analyze parameters to determine whether to use non blocking mode and whether to delay before exiting.
Impact
none
Testing
server cmd and log
qemu-armv8a-server> rpsock_server server_multi_times block hh ap 3
server_multi_times: 0
server: create socket SOCK_STREAM nonblock 0
server: bind cpu ap, name hh ...
server: listen ...
server: try accept ...
server: Connection accepted -- 1068
server Complete ret 64, errno 0
server: Terminating
server_multi_times: 1
server: create socket SOCK_STREAM nonblock 0
server: bind cpu ap, name hh ...
server: listen ...
server: try accept ...
server: Connection accepted -- 1070
server Complete ret 64, errno 0
server: Terminating
server_multi_times: 2
server: create socket SOCK_STREAM nonblock 0
server: bind cpu ap, name hh ...
server: listen ...
server: try accept ...
server: Connection accepted -- 1072
server Complete ret 64, errno 0
server: Terminating
ap cmd and log
qemu-armv8a-ap> rpsock_client conn_multi_times block hh droid 3
client conn_multi_times: 0
client: create socket SOCK_STREAM nonblock 0
client: Connecting to droid,hh...
client: Connected
client send data, total len 64, BUFHEAD process0060, name:hh
client: Terminating
client conn_multi_times: 1
client: create socket SOCK_STREAM nonblock 0
client: Connecting to droid,hh...
client: Connected
client send data, total len 64, BUFHEAD process0060, name:hh
client: Terminating
client conn_multi_times: 2
client: create socket SOCK_STREAM nonblock 0
client: Connecting to droid,hh...
client: Connected
client send data, total len 64, BUFHEAD process0060, name:hh
client: Terminating
if we use delay ,client will exit for a while
qemu-armv8a-ap> rpsock_client conn_multi_times block hh droid 1 delay
client conn_multi_times: 0
client: create socket SOCK_STREAM nonblock 0
client: Connecting to droid,hh...
client: Connected
client send data, total len 64, BUFHEAD process0028, name:hh
client: Terminating