tools/testing/selftests/net/test_so_rcv.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/test_so_rcv.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/test_so_rcv.sh- Extension
.sh- Size
- 1291 bytes
- Lines
- 74
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
source lib.sh
HOSTS=("127.0.0.1" "::1")
PORT=1234
TOTAL_TESTS=0
FAILED_TESTS=0
declare -A TESTS=(
["SO_RCVPRIORITY"]="-P 2"
["SO_RCVMARK"]="-M 3"
)
check_result() {
((TOTAL_TESTS++))
if [ "$1" -ne 0 ]; then
((FAILED_TESTS++))
fi
}
cleanup()
{
cleanup_ns $NS
}
trap cleanup EXIT
setup_ns NS
for HOST in "${HOSTS[@]}"; do
PROTOCOL="IPv4"
if [[ "$HOST" == "::1" ]]; then
PROTOCOL="IPv6"
fi
for test_name in "${!TESTS[@]}"; do
echo "Running $test_name test, $PROTOCOL"
arg=${TESTS[$test_name]}
ip netns exec $NS ./so_rcv_listener $arg $HOST $PORT &
LISTENER_PID=$!
sleep 0.5
if ! ip netns exec $NS ./cmsg_sender $arg $HOST $PORT; then
echo "Sender failed for $test_name, $PROTOCOL"
kill "$LISTENER_PID" 2>/dev/null
wait "$LISTENER_PID"
check_result 1
continue
fi
wait "$LISTENER_PID"
LISTENER_EXIT_CODE=$?
if [ "$LISTENER_EXIT_CODE" -eq 0 ]; then
echo "Rcv test OK for $test_name, $PROTOCOL"
check_result 0
else
echo "Rcv test FAILED for $test_name, $PROTOCOL"
check_result 1
fi
done
done
if [ "$FAILED_TESTS" -ne 0 ]; then
echo "FAIL - $FAILED_TESTS/$TOTAL_TESTS tests failed"
exit ${KSFT_FAIL}
else
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.