tools/testing/selftests/net/lib.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/lib.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/lib.sh- Extension
.sh- Size
- 12424 bytes
- Lines
- 692
- 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
net_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
source "$net_dir/lib/sh/defer.sh"
##############################################################################
# Defines
: "${WAIT_TIMEOUT:=20}"
# Whether to pause on after a failure.
: "${PAUSE_ON_FAIL:=no}"
BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms
# Kselftest framework constants.
ksft_pass=0
ksft_fail=1
ksft_xfail=2
ksft_skip=4
# namespace list created by setup_ns
NS_LIST=()
# Exit status to return at the end. Set in case one of the tests fails.
EXIT_STATUS=0
# Per-test return value. Clear at the beginning of each test.
RET=0
##############################################################################
# Helpers
__ksft_status_merge()
{
local a=$1; shift
local b=$1; shift
local -A weights
local weight=0
local i
for i in "$@"; do
weights[$i]=$((weight++))
done
if [[ ${weights[$a]} -ge ${weights[$b]} ]]; then
echo "$a"
return 0
else
echo "$b"
return 1
fi
}
ksft_status_merge()
{
local a=$1; shift
local b=$1; shift
__ksft_status_merge "$a" "$b" \
$ksft_pass $ksft_xfail $ksft_skip $ksft_fail
}
ksft_exit_status_merge()
{
local a=$1; shift
local b=$1; shift
__ksft_status_merge "$a" "$b" \
$ksft_xfail $ksft_pass $ksft_skip $ksft_fail
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.