From patchwork Tue Apr 17 12:42:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 899241 X-Patchwork-Delegate: akodanev@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=none (p=none dis=none) header.from=suse.cz 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 40QPzX3WmJz9s0x for ; Tue, 17 Apr 2018 22:42:47 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CF8F03E6CF3 for ; Tue, 17 Apr 2018 14:42:44 +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 C853E3E6CE4 for ; Tue, 17 Apr 2018 14:42:41 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 478441000750 for ; Tue, 17 Apr 2018 14:42:40 +0200 (CEST) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C7A9CAEF2; Tue, 17 Apr 2018 12:42:39 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Tue, 17 Apr 2018 14:42:07 +0200 Message-Id: <20180417124207.4561-2-pvorel@suse.cz> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180417124207.4561-1-pvorel@suse.cz> References: <20180417124207.4561-1-pvorel@suse.cz> X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=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 2/2] network/in6_02: Don't use default value for LHOST_IFACES 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" in6_02 can be test without help of network.sh. In that case LHOST_IFACES is not defined and "eth0" is used as default value. This can cause failures. Signed-off-by: Petr Vorel --- I'm not sure if we can make all C network tests make independent on loading variables via tst_net.sh, but here it does not make much sense to me to fail when it's not done. --- testcases/network/lib6/in6_02.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/testcases/network/lib6/in6_02.c b/testcases/network/lib6/in6_02.c index e3deb7b7b..c00e5dc0c 100644 --- a/testcases/network/lib6/in6_02.c +++ b/testcases/network/lib6/in6_02.c @@ -33,14 +33,13 @@ #define I2N_RNDCOUNT 10 /* random ints */ #define I2N_LOWCOUNT 10 /* sequential from 0 */ -#define DEFAULT_IFACE "eth0" static struct { char *name; int nonzero; } test_case[] = { { "lo", 1 }, - { DEFAULT_IFACE, 1 }, + { NULL, 1 }, { "hoser75", 0 }, { "6", 0 }, }; @@ -61,6 +60,8 @@ void if_nametoindex_test(void) tst_res(TINFO, "IPv6 if_nametoindex() test"); for (i = 0; i < ARRAY_SIZE(test_case); ++i) { + if (test_case[i].name == NULL) + continue; TEST(if_nametoindex(test_case[i].name)); if (!TEST_RETURN != !test_case[i].nonzero) { tst_res(TFAIL, "if_nametoindex(\"%s\") %ld [should be %szero]", @@ -242,16 +243,16 @@ void setup(void) char *ifnames = getenv("LHOST_IFACES"); if (!ifnames) { - tst_res(TWARN, "LHOST_IFACES not defined, default to %s", DEFAULT_IFACE); + tst_res(TINFO, "LHOST_IFACES not defined, it will not be tested"); return; } static char name[256]; sscanf(ifnames, "%255s", name); - if (!strcmp(name, test_case[1].name)) + if (!strcmp(name, test_case[0].name)) return; - tst_res(TINFO, "change default '%s' name to '%s'", DEFAULT_IFACE, name); + tst_res(TINFO, "LHOST_IFACES \"%s\"", name); test_case[1].name = name; }