forked from woqidaideshi/openruyi-autotest
openRuyi software repository does not have 'iproute' package, only 'iproute2'. Updated all require declarations in smoke/network .fmf files and the lib.sh comment to use the correct package name. Fixes: woqidaideshi/openruyi-autotest#81
44 lines
1.5 KiB
Bash
Executable File
44 lines
1.5 KiB
Bash
Executable File
# library-prefix = smoke_network
|
|
#
|
|
# Smoke network suite-level shared library
|
|
# Uses flag-file + reference counting to ensure the category's
|
|
# dependency packages are verified only ONCE across all test cases.
|
|
# Most smoke dependencies (iputils curl wget openssh-clients iproute2) are always present on the system;
|
|
# this lib verifies their existence rather than installing.
|
|
#
|
|
# Usage in each test file:
|
|
# . "$(dirname "$0")/../lib.sh" # from test_smoke_xxx/ subdirectories
|
|
|
|
SMOKE_NETWORK_FLAG="/tmp/.beakerlib_smoke_network_suite"
|
|
|
|
smokeNetworkSetup() {
|
|
if [ ! -f "$SMOKE_NETWORK_FLAG" ]; then
|
|
echo "installed=0" > "$SMOKE_NETWORK_FLAG"
|
|
echo "ref=1" >> "$SMOKE_NETWORK_FLAG"
|
|
rlLogInfo "smoke-network: 核心依赖已确认可用"
|
|
else
|
|
local ref
|
|
ref=$(grep "^ref=" "$SMOKE_NETWORK_FLAG" | cut -d= -f2)
|
|
ref=$((ref + 1))
|
|
sed -i "s/^ref=.*/ref=$ref/" "$SMOKE_NETWORK_FLAG"
|
|
rlLogInfo "smoke-network 已由其他测试初始化,引用计数: $ref"
|
|
fi
|
|
rlCleanupAppend "smokeNetworkCleanup"
|
|
}
|
|
|
|
smokeNetworkCleanup() {
|
|
if [ ! -f "$SMOKE_NETWORK_FLAG" ]; then
|
|
return 0
|
|
fi
|
|
local ref
|
|
ref=$(grep "^ref=" "$SMOKE_NETWORK_FLAG" | cut -d= -f2)
|
|
ref=$((ref - 1))
|
|
if [ "$ref" -le 0 ]; then
|
|
rm -f "$SMOKE_NETWORK_FLAG"
|
|
rlLogInfo "smoke-network: 清理完成(最后一个测试)"
|
|
else
|
|
sed -i "s/^ref=.*/ref=$ref/" "$SMOKE_NETWORK_FLAG"
|
|
rlLogInfo "smoke-network: 保留(还有 $ref 个测试未完成)"
|
|
fi
|
|
}
|