diff options
author | Alexey Kodanev <alexey.kodanev@oracle.com> | 2018-08-20 14:23:48 +0300 |
---|---|---|
committer | Petr Vorel <pvorel@suse.cz> | 2018-09-13 14:21:32 +0200 |
commit | c4b090776023bd61f04c038fca6742492f2b2a6e (patch) | |
tree | 763d2285b2d3b4cd4201600a76be8ff6ced44490 /testcases/lib | |
parent | 7599ff232b98b4f8440e1410e8721822995877e2 (diff) |
lib/tst_test.sh: add TST_RTNL_CHK() helper function
It should parse iproute commands output and exit the test with TCONF
if there are certain messages returned from iproute/RTNETLINK.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
Diffstat (limited to 'testcases/lib')
-rw-r--r-- | testcases/lib/tst_test.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index e553b496d..0c388839f 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -202,6 +202,22 @@ TST_RETRY_FUNC() return $2 } +TST_RTNL_CHK() +{ + local msg1="RTNETLINK answers: Function not implemented" + local msg2="RTNETLINK answers: Operation not supported" + local output="$($@ 2>&1 || echo 'LTP_ERR')" + local msg + + echo "$output" | grep -q "LTP_ERR" || return 0 + + for msg in "$msg1" "$msg2"; do + echo "$output" | grep -q "$msg" && tst_brk TCONF "'$@': $msg" + done + + tst_brk TBROK "$@ failed: $output" +} + tst_umount() { local device="$1" |