From patchwork Mon Aug 20 11:23:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 959603 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="ULkPM9b1"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41vB5b3HrQz9s3Z for ; Mon, 20 Aug 2018 21:14:11 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 021473E6474 for ; Mon, 20 Aug 2018 13:14:09 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id 555843E6433 for ; Mon, 20 Aug 2018 13:14:05 +0200 (CEST) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 88C6510000F6 for ; Mon, 20 Aug 2018 13:14:04 +0200 (CEST) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7KBE0r0136521 for ; Mon, 20 Aug 2018 11:14:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=iuKD5q6IEEfBuiSZv/a97gsHTluq1uDZ8PXiuLuSQfA=; b=ULkPM9b1G2W9uDRQXAzvDAeSI6MCnFCdCO6cQHB4IDY4LE/m6VFKBoE7bHcNv7bAcfmz OZjdKRC53USoNORHhFt3sYqwIdzghtQE7gDjrGzgktvktq+TSk1uu/a2f4hvzLYDLWMS 2yjj9cyODsU/Hapq3wgm3tlafa2jxLrvTYQ55JJK9SSTKR5jJo92xxsdAKiM64BMRoRA Mtc890NpixeFzCvMkMuJWGTdfE9QJnTq93a2nEfySbBaLB/mkoiMtC/A0hdkaO7ok5dq vDY3B9yVWpCO3ICQ5WF+FqIYrOr2PY4+JL6dxnfQk8ebO6IyhTkCdKNf87ksh1UCMfEq BQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2kxbdpnp0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 20 Aug 2018 11:14:02 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w7KBDucC005553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 20 Aug 2018 11:13:56 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w7KBDur4023785 for ; Mon, 20 Aug 2018 11:13:56 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 20 Aug 2018 04:13:55 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Mon, 20 Aug 2018 14:23:48 +0300 Message-Id: <1534764229-26993-3-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1534764229-26993-1-git-send-email-alexey.kodanev@oracle.com> References: <1534764229-26993-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8990 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808200123 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH v2 3/4] lib/tst_test.sh: add TST_RTNL_CHK() helper function X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 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 --- v2: no changes 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 23d66eb..6837eb1 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"