From patchwork Thu Mar 1 10:59:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 879714 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=none (p=none dis=none) header.from=suse.cz 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 3zsTwl6YhLz9ryL for ; Thu, 1 Mar 2018 22:00:07 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 01A033E724F for ; Thu, 1 Mar 2018 12:00:04 +0100 (CET) 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 66D413E7226 for ; Thu, 1 Mar 2018 12:00:01 +0100 (CET) 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 069061001F58 for ; Thu, 1 Mar 2018 11:59:59 +0100 (CET) Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E5D9EACBB; Thu, 1 Mar 2018 10:59:58 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Thu, 1 Mar 2018 11:59:42 +0100 Message-Id: <20180301105943.5487-1-pvorel@suse.cz> X-Mailer: git-send-email 2.16.2 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] [RFC PATCH v2 1/2] lib: TCONF on "not supported" errnos in SAFE_SOCKET() 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" *NOSUPPORT errnos likely mean there is configuration issue rather than test failure. e.g. missing dccp module in netstress.c which was sofar set as TBROK: safe_net.c:117: BROK: netstress.c:654: socket(10, 6, 33) failed: ESOCKTNOSUPPORT Signed-off-by: Petr Vorel --- Changes v1->v2: * Add more errnos. Maybe it'd make sense to pick suitable errnos and test it against each safe_*() in lib/safe_net.c or even against all safe_*(). --- lib/safe_net.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/safe_net.c b/lib/safe_net.c index 9ea9d2b42..1f1cd0358 100644 --- a/lib/safe_net.c +++ b/lib/safe_net.c @@ -107,14 +107,25 @@ int tst_getsockport(const char *file, const int lineno, int sockfd) int safe_socket(const char *file, const int lineno, void (cleanup_fn)(void), int domain, int type, int protocol) { - int rval; + int rval, ttype; rval = socket(domain, type, protocol); if (rval < 0) { - tst_brkm(TBROK | TERRNO, cleanup_fn, - "%s:%d: socket(%d, %d, %d) failed", file, lineno, - domain, type, protocol); + switch (errno) { + case EPROTONOSUPPORT: + case ESOCKTNOSUPPORT: + case EOPNOTSUPP: + case EPFNOSUPPORT: + case EAFNOSUPPORT: + ttype = TCONF; + break; + default: + ttype = TBROK; + } + + tst_brkm(ttype | TERRNO, cleanup_fn, "%s:%d: socket(%d, %d, %d) failed", + file, lineno, domain, type, protocol); } return rval;