#!/bin/bash
#
# This test is for checking rtnetlink callpaths, and get as much coverage as possible.
#
# set -e
ALL_TESTS="
kci_test_polrouting
kci_test_route_get
kci_test_addrlft
kci_test_addrlft_route_cleanup
kci_test_promote_secondaries
kci_test_tc
kci_test_gre
kci_test_gretap
kci_test_ip6gretap
kci_test_erspan
kci_test_ip6erspan
kci_test_bridge
kci_test_addrlabel
kci_test_ifalias
kci_test_vrf
kci_test_encap
kci_test_macsec
kci_test_macsec_vlan
kci_test_team_bridge_macvlan
kci_test_bridge_promisc_netlink
kci_test_bridge_promisc_sysfs
kci_test_ipsec
kci_test_ipsec_offload
kci_test_fdb_get
kci_test_fdb_del
kci_test_neigh_get
kci_test_neigh_update
kci_test_bridge_parent_id
kci_test_address_proto
kci_test_enslave_bonding
kci_test_mngtmpaddr
kci_test_operstate
"
devdummy="test-dummy0"
VERBOSE=0
PAUSE=no
PAUSE_ON_FAIL=no
source lib.sh
# set global exit status, but never reset nonzero one.
check_err()
{
if [ $ret -eq 0 ]; then
ret=$1
fi
[ -n "$2" ] && echo "$2"
}
# same but inverted -- used when command must fail for test to pass
check_fail()
{
if [ $1 -eq 0 ]; then
ret=1
fi
}
sysfs_write()
{
local val="$1"
local path="$2"
echo "$val" > "$path"
}
run_cmd_common()
{
local cmd="$*"
local out
if [ "$VERBOSE" = "1" ]; then
echo "COMMAND: ${cmd}"
fi
out=$($cmd 2>&1)
rc=$?
if [ "$VERBOSE" = "1" -a -n "$out" ]; then
echo " $out"
fi
return $rc
}
run_cmd() {
run_cmd_common "$@"
rc=$?
check_err $rc
return $rc
}
run_cmd_fail()
{
run_cmd_common "$@"
rc=$?
check_fail $rc
return $rc
}
run_cmd_grep_common()
{
local find="$1"; shift
local cmd="$*"
local out
if [ "$VERBOSE" = "1" ]; then
echo "COMMAND: ${cmd}