From patchwork Thu Aug 9 15:23:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 955700 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=2001:1418:10:5::2; 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="CHe4BP0b"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41mWxX0VZHz9ryt for ; Fri, 10 Aug 2018 01:14:07 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5867D3E7220 for ; Thu, 9 Aug 2018 17:14:04 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 03CFE3E7202 for ; Thu, 9 Aug 2018 17:14:01 +0200 (CEST) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 4151E600F2C for ; Thu, 9 Aug 2018 17:14:00 +0200 (CEST) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79F4oiv107013 for ; Thu, 9 Aug 2018 15:13:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=osuS/PkgUZbimei0iAAklXVEikZHzCuen3IM+9KuR0g=; b=CHe4BP0bWT+TRV2w7S1RkZWubtTPWt8TJJZby/juuQjNCGPzD/8YphdJYRjfxOuMJ5yP UkYTxsmfwjJMCR9+q6mFSKSEY7JvBuSlKUlYuJ14vM9mCupydkHcjPjWNNIUpoeD28LV kUK02p2pg/CMPQYgQNKiZEOO84S6izmrr5WmKrHCQza9GMq9QOVGEcpzJo5xgc8Qrx3u RsKMNbZTl2Yzut6F0nPRS2L3lsY52cDcJ7QUmpUTy1xVix+OvkUVrZ0HgxSAZcrkA63Q PeVzY7/fqYbJcxesNozlKQT8KMMaMDzxZngjTbj/sjalgt93pkNx8UCxonOc3F6ZQinp kw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2kn3jtbqev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 09 Aug 2018 15:13:58 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79FDv7A022298 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 9 Aug 2018 15:13:57 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79FDvU1001981 for ; Thu, 9 Aug 2018 15:13:57 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Aug 2018 08:13:57 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Thu, 9 Aug 2018 18:23:43 +0300 Message-Id: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8979 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-1808090156 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.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-5.smtp.seeweb.it Subject: [LTP] [PATCH RFC 1/4] lib/tst_test.c: add 'needs_drivers' option with tst_check_drivers cmd 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" The drivers are checked with modprobe. If modrpobe is not available on the system, the checks are silently skipped. Signed-off-by: Alexey Kodanev Acked-by: Petr Vorel --- include/tst_test.h | 5 +++++ lib/tst_test.c | 26 ++++++++++++++++++++++++++ testcases/lib/.gitignore | 1 + testcases/lib/Makefile | 2 +- testcases/lib/tst_check_drivers.c | 24 ++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 1 deletions(-) create mode 100644 testcases/lib/tst_check_drivers.c diff --git a/include/tst_test.h b/include/tst_test.h index 98dacf3..221796d 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -170,6 +170,9 @@ struct tst_test { /* NULL terminated array of resource file names */ const char *const *resource_files; + + /* NULL terminated array of needed kernel drivers */ + const char * const *needs_drivers; }; /* @@ -219,6 +222,8 @@ const char *tst_strstatus(int status); void tst_set_timeout(int timeout); +int tst_check_drivers(void); + #ifndef TST_NO_DEFAULT_MAIN static struct tst_test test; diff --git a/lib/tst_test.c b/lib/tst_test.c index 2f3d357..6cb74cf 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -645,6 +645,29 @@ static int needs_tmpdir(void) tst_test->needs_checkpoints; } +int tst_check_drivers(void) +{ + const char *name; + int i, res; + + for (i = 0; (name = tst_test->needs_drivers[i]); ++i) { + const char * const argv[] = { "modprobe", name, NULL }; + + res = tst_run_cmd_(NULL, argv, "/dev/null", "/dev/null", 1); + if (res == 255) + return res; /* it looks like modprobe not available */ + if (res) { + if (tst_test->test || tst_test->test_all) { + tst_brk(TCONF, "%s driver not available", name); + } else { + fprintf(stderr, "%s", name); + return res; + } + } + } + return 0; +} + static void copy_resources(void) { unsigned int i; @@ -767,6 +790,9 @@ static void do_setup(int argc, char *argv[]) if (tst_test->min_kver) check_kver(); + if (tst_test->needs_drivers) + tst_check_drivers(); + if (tst_test->format_device) tst_test->needs_device = 1; diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore index a9034e4..d83a48e 100644 --- a/testcases/lib/.gitignore +++ b/testcases/lib/.gitignore @@ -1,5 +1,6 @@ /tst_sleep /tst_random +/tst_check_drivers /tst_checkpoint /tst_rod /tst_kvcmp diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile index 3547e16..e1dea3b 100644 --- a/testcases/lib/Makefile +++ b/testcases/lib/Makefile @@ -28,6 +28,6 @@ INSTALL_TARGETS := *.sh MAKE_TARGETS := tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\ tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\ - tst_getconf tst_supported_fs + tst_getconf tst_supported_fs tst_check_drivers include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/lib/tst_check_drivers.c b/testcases/lib/tst_check_drivers.c new file mode 100644 index 0000000..3f722f2 --- /dev/null +++ b/testcases/lib/tst_check_drivers.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. + */ + +#include +#define TST_NO_DEFAULT_MAIN +#include "tst_test.h" + +struct tst_test *tst_test; + +int main(int argc, const char *argv[]) +{ + if (argc < 2) { + fprintf(stderr, "Please provide kernel driver list\n"); + return 1; + } + + struct tst_test test = { + .needs_drivers = &argv[1] + }; + + tst_test = &test; + return tst_check_drivers(); +} From patchwork Thu Aug 9 15:23:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 955702 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="KM1krse+"; 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 41mWxZ62rCz9s7Q for ; Fri, 10 Aug 2018 01:14:10 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 360FB3E721D for ; Thu, 9 Aug 2018 17:14:08 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 533493E7202 for ; Thu, 9 Aug 2018 17:14:03 +0200 (CEST) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 6461C600A57 for ; Thu, 9 Aug 2018 17:14:02 +0200 (CEST) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79F50B3124799 for ; Thu, 9 Aug 2018 15:14:00 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=ht5IGAsNdi14o3Iv7PTpzXjvDeAsr3+QTo6DBYhPNuk=; b=KM1krse+9+OhIF31oXJMx1qrVpXm7WAeOZJOxDWKr0cOeQS0BanR2rldWmTz7MVFhawc t4twT+7nA1yz/xqgonSIupi9+1ty0zKwhl57bnb6fLCcUq38iFhep4cgj983PRK/Cfs/ Qd0IFzJXz2Yg9MEJGObM1qgVsvFWtY+FQJNXBBGSZms5M7oNeMYaXYV5rbdThLj4YGwI wRhnYV205C9GLall+yWNtV4/UldAZ+gtEOSe99AZRdf9HGH9SxI8coF64zSFffxtMXug bKtGt6W6806LJ/QBepgAzFjN0a0yvRSd/HlzMfoFYLZ5gsimOrozKHACr0pjMwSrvDOI KA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2kn1ndbtdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 09 Aug 2018 15:14:00 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w79FDwi4022341 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 9 Aug 2018 15:13:59 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79FDwUp017284 for ; Thu, 9 Aug 2018 15:13:58 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Aug 2018 08:13:58 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Thu, 9 Aug 2018 18:23:44 +0300 Message-Id: <1533828226-24753-2-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> References: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8979 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=636 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808090156 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.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-2.smtp.seeweb.it Subject: [LTP] [PATCH RFC 2/4] lib/tst_test.sh: add TST_NEEDS_DRIVERS parameter 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" The drivers are checked with tst_check_drivers. Signed-off-by: Alexey Kodanev Acked-by: Petr Vorel --- testcases/lib/tst_test.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh index e553b49..30f75b5 100644 --- a/testcases/lib/tst_test.sh +++ b/testcases/lib/tst_test.sh @@ -285,6 +285,15 @@ tst_check_cmds() return 0 } +tst_test_drivers() +{ + local drv="$(tst_check_drivers $@ 2>&1)" + + if [ -n "$drv" ]; then + tst_brk TCONF "'$drv' driver not found" + fi +} + tst_is_int() { [ "$1" -eq "$1" ] 2>/dev/null @@ -332,6 +341,7 @@ tst_run() OPTS|USAGE|PARSE_ARGS|POS_ARGS);; NEEDS_ROOT|NEEDS_TMPDIR|NEEDS_DEVICE|DEVICE);; NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);; + NEEDS_DRIVERS);; IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);; RETRY_FUNC|RETRY_FN_EXP_BACKOFF);; *) tst_res TWARN "Reserved variable TST_$_tst_i used!";; @@ -369,6 +379,7 @@ tst_run() fi tst_test_cmds $TST_NEEDS_CMDS + tst_test_drivers $TST_NEEDS_DRIVERS if [ -n "$TST_MIN_KVER" ]; then tst_kvcmp -lt "$TST_MIN_KVER" && \ From patchwork Thu Aug 9 15:23:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 955705 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="y0s+AtZp"; 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 41mWxl5DTPz9ryt for ; Fri, 10 Aug 2018 01:14:19 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 313323E7336 for ; Thu, 9 Aug 2018 17:14:17 +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 [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id C40213E72AF for ; Thu, 9 Aug 2018 17:14:06 +0200 (CEST) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (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 A74F7100119A for ; Thu, 9 Aug 2018 17:14:05 +0200 (CEST) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79FE48T107064 for ; Thu, 9 Aug 2018 15:14:04 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=pR+/iuOwR5Cljk9FhHP8gOiesbam0AG3NBS5Cg6Vofg=; b=y0s+AtZpOT+23SjIrOh4od7ehN+ur67FKI0OE6dcAb3rXyYXl8Q5QRMc53DzfPyZ/hg4 C+qmLFvmEj2WLfcd3kukWqa7A7BuSmpEIfL2fJugjitNVt4luXvSMIHkxr0NGg/CICHa Vu4Ep5lQRlTq2MNyUvxh8oz27EvcBr5R/f8RL3HsY74/p8mPrwJSUcXiEun6ZlAUrVG2 PwnzZUwr4MFZTJYL2oNd8neuEgNoDda6EuuF7FjFeznnF4njEzpyAJSNN6oPCwgezSTK jYHINoCEQgoiMb11b+AfZaRGOF7B5NSohrUA9Bcropy5T8obb1ESNL6291/k/EYEH5vf 1A== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2kn4sq3mfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 09 Aug 2018 15:14:03 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79FDxYD006196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 9 Aug 2018 15:13:59 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79FDxgq017298 for ; Thu, 9 Aug 2018 15:13:59 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Aug 2018 08:13:59 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Thu, 9 Aug 2018 18:23:45 +0300 Message-Id: <1533828226-24753-3-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> References: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8979 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-1808090157 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 RFC 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 Acked-by: Petr Vorel --- 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 30f75b5..73dcdfb 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" From patchwork Thu Aug 9 15:23:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 955704 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=2001:1418:10:5::2; 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="VoHI3HsU"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41mWxg6wBrz9s1x for ; Fri, 10 Aug 2018 01:14:15 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 597453E72A7 for ; Thu, 9 Aug 2018 17:14:13 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 2CB613E72D1 for ; Thu, 9 Aug 2018 17:14:06 +0200 (CEST) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 85221601A24 for ; Thu, 9 Aug 2018 17:14:05 +0200 (CEST) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79FE4Kj114607 for ; Thu, 9 Aug 2018 15:14:04 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=rkcKOXOAEx81KTpus3a4zNFXFV8Vnm9+456Q8+o6PG0=; b=VoHI3HsU8I/SPj2GQ9dGVt/JVis6hcobnxZwW+wpOX+10oxAPZDiCGcVq7IyyLi9BS62 DEyeCe50z3nDPkCzCLSBIrLWjfW3GxUSWlwu8n9hZd9n9DPWwb23KLMAlFOEjcfexmJG kdXwvaFVTRTikj8exfUJTgyZzWAM6V5In5WvlZTtQUajRJT/TDMDkhUjgATDiVh7nCz5 hQJtiO9WdU6L1OiGhdpgqQoBl5e0W0evKkH2hlFYkQ0jnG1f7dTY81JdM7Yg/uoVhzHg O6xOxhBRZ2DwGF8mDkRzVbZwujiafpDkGienjeChvSAC6I7Y0eNguFEtCOlUcECm2OK0 JQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kn3jtbqf2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 09 Aug 2018 15:14:03 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79FE1ST016108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 9 Aug 2018 15:14:01 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w79FE0IM014236 for ; Thu, 9 Aug 2018 15:14:00 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Aug 2018 08:14:00 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Thu, 9 Aug 2018 18:23:46 +0300 Message-Id: <1533828226-24753-4-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> References: <1533828226-24753-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8979 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=597 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808090157 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.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-2.smtp.seeweb.it Subject: [LTP] [PATCH RFC 4/4] network/ipsec: replace ipsec_try() with TST_RTNL_CHK() 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" Signed-off-by: Alexey Kodanev Acked-by: Petr Vorel --- testcases/network/stress/ipsec/ipsec_lib.sh | 21 +++------------------ 1 files changed, 3 insertions(+), 18 deletions(-) diff --git a/testcases/network/stress/ipsec/ipsec_lib.sh b/testcases/network/stress/ipsec/ipsec_lib.sh index aedba9b..f850166 100644 --- a/testcases/network/stress/ipsec/ipsec_lib.sh +++ b/testcases/network/stress/ipsec/ipsec_lib.sh @@ -157,21 +157,6 @@ ipsec_set_algoline() esac } -ipsec_try() -{ - local output="$($@ 2>&1 || echo 'TERR')" - - if echo "$output" | grep -q "TERR"; then - echo "$output" | grep -q \ - 'RTNETLINK answers: Function not implemented' && \ - tst_brk TCONF "'$@': not implemented" - echo "$output" | grep -q \ - 'RTNETLINK answers: Operation not supported' && \ - tst_brk TCONF "'$@': not supported (maybe missing 'ip${TST_IPV6}_vti' kernel module)" - tst_brk TBROK "$@ failed: $output" - fi -} - # tst_ipsec target src_addr dst_addr: config ipsec # # target: target of the configuration host ( lhost / rhost ) @@ -195,7 +180,7 @@ tst_ipsec() if [ $target = lhost ]; then local spi_1="0x$SPI" local spi_2="0x$(( $SPI + 1 ))" - ipsec_try ip xfrm state add src $src dst $dst spi $spi_1 \ + TST_RTNL_CHK xfrm state add src $src dst $dst spi $spi_1 \ $p $ALG mode $mode sel src $src dst $dst ROD ip xfrm state add src $dst dst $src spi $spi_2 \ $p $ALG mode $mode sel src $dst dst $src @@ -257,12 +242,12 @@ tst_ipsec_vti() cleanup_vti=$vti if [ $target = lhost ]; then - ipsec_try ip li add $vti $type local $src remote $dst $key $d + TST_RTNL_CHK ip li add $vti $type local $src remote $dst $key $d ROD ip li set $vti up local spi_1="spi 0x$SPI" local spi_2="spi 0x$(( $SPI + 1 ))" - ipsec_try $ipx st add $o_dir $p $spi_1 $ALG $m + TST_RTNL_CHK $ipx st add $o_dir $p $spi_1 $ALG $m ROD $ipx st add $i_dir $p $spi_2 $ALG $m ROD $ipx po add dir out tmpl $o_dir $p $m $mrk ROD $ipx po add dir in tmpl $i_dir $p $m $mrk