Commit 4cec9db0 authored by Vadim Kochan's avatar Vadim Kochan Committed by Stephen Hemminger

tests: Add few 'ip link' related tests

Added two tests which checks the following fixed issues:

    1) Bug when not possible add new virtual interface via:

        $ ip link add dev XXX type

       It was fixed a few releases ago.

    2) Crash on older kernels when VF rate info does not exist:

        $ ip link show

       Used dump file from William Dauchy <william@gandi.net>:
           testsuite/tests/ip/link/dev_wo_vf_rate.nl

       So 'ip link show' replaced by 'ip -d monitor file ...' which does
       the same thing.

Also added new func in testsuite/lib/generic.sh to gen new random dev name.

Added 'clean' dependency on running all tests.
Signed-off-by: default avatarVadim Kochan <vadim4j@gmail.com>
parent f42a4574
......@@ -31,12 +31,13 @@ listtests:
alltests: $(TESTS)
clean:
@echo "Removing $(RESULTS_DIR) dir ..."
@rm -rf $(RESULTS_DIR)
distclean: clean
echo "Entering iproute2" && cd iproute2 && $(MAKE) distclean && cd ..;
$(TESTS):
$(TESTS): clean
@mkdir -p $(RESULTS_DIR)
@for d in $(TESTS_DIR); do \
......
......@@ -62,8 +62,9 @@ ts_ip()
TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX` || exit
$IP $@ 2> $TMP_ERR > $TMP_OUT
RET=$?
if [ -s $TMP_ERR ]; then
if [ -s $TMP_ERR ] || [ "$RET" != "0" ]; then
ts_err "${SCRIPT}: ${DESC} failed:"
ts_err "command: $IP $@"
ts_err "stderr output:"
......@@ -91,3 +92,8 @@ ts_qdisc_available()
return 1;
fi
}
rand_dev()
{
echo "dev-$(tr -dc "[:alpha:]" < /dev/urandom | head -c 6)"
}
#!/bin/sh
source lib/generic.sh
ts_log "[Testing add/del virtual links]"
NEW_DEV="$(rand_dev)"
ts_ip "$0" "Add $NEW_DEV dummy interface" link add dev $NEW_DEV type dummy
ts_ip "$0" "Show $NEW_DEV dummy interface" link show dev $NEW_DEV
ts_ip "$0" "Del $NEW_DEV dummy interface" link del dev $NEW_DEV
#!/bin/sh
source lib/generic.sh
NL_FILE="tests/ip/link/dev_wo_vf_rate.nl"
ts_ip "$0" "Show VF devices w/o VF rate info" -d monitor file $NL_FILE
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment