From patchwork Fri Jun 15 06:18:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Myl=C3=A8ne_Josserand?= X-Patchwork-Id: 929803 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=bootlin.com 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 416VfZ2sByz9s2L for ; Fri, 15 Jun 2018 16:18:14 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4E9EC1A98BA for ; Fri, 15 Jun 2018 08:18:11 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 90F691A9628 for ; Fri, 15 Jun 2018 08:18:10 +0200 (CEST) Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by in-6.smtp.seeweb.it (Postfix) with ESMTP id E57261401B0B for ; Fri, 15 Jun 2018 08:18:09 +0200 (CEST) Received: by mail.bootlin.com (Postfix, from userid 110) id 92E0320775; Fri, 15 Jun 2018 08:18:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it X-Spam-Level: X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 Received: from dell-desktop.home (AAubervilliers-681-1-37-30.w90-88.abo.wanadoo.fr [90.88.156.30]) by mail.bootlin.com (Postfix) with ESMTPSA id 679C720726; Fri, 15 Jun 2018 08:18:08 +0200 (CEST) From: =?utf-8?q?Myl=C3=A8ne_Josserand?= To: ltp@lists.linux.it Date: Fri, 15 Jun 2018 08:18:07 +0200 Message-Id: <20180615061807.15099-1-mylene.josserand@bootlin.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean Cc: thomas.petazzoni@bootlin.com Subject: [LTP] [PATCH] testcase: gethostid: Check if hostid is available 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" On some embedded systems, hostid may not be installed. Because of that, the test will fail with: gethostid01 1 TFAIL : gethostid01.c:171: fgets failed The test should return a TCONF instead. This commit uses tst_get_path function to check if "hostid" is available in $PATH. Otherwise, it will return a TCONF. Signed-off-by: Mylène Josserand --- testcases/kernel/syscalls/gethostid/gethostid01.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testcases/kernel/syscalls/gethostid/gethostid01.c b/testcases/kernel/syscalls/gethostid/gethostid01.c index e6b006759..241335af7 100644 --- a/testcases/kernel/syscalls/gethostid/gethostid01.c +++ b/testcases/kernel/syscalls/gethostid/gethostid01.c @@ -239,6 +239,10 @@ int main(int ac, char **av) void setup(void) { + char path[2048]; + + if (tst_get_path("hostid", path, sizeof(path))) + tst_brkm(TCONF, NULL, "Couldn't find hostid in $PATH"); tst_sig(FORK, DEF_HANDLER, cleanup);