From patchwork Mon Aug 27 00:05:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 962306 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=none (p=none dis=none) header.from=cn.fujitsu.com 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 41zBxh523Sz9ryt for ; Mon, 27 Aug 2018 10:06:16 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0CAD23E63D5 for ; Mon, 27 Aug 2018 02:06:14 +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 87C263E6080 for ; Mon, 27 Aug 2018 02:06:11 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-4.smtp.seeweb.it (Postfix) with ESMTP id EB53410005A6 for ; Mon, 27 Aug 2018 02:06:09 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="43978846" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 27 Aug 2018 08:06:08 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 545AE4B6AE18; Mon, 27 Aug 2018 08:06:09 +0800 (CST) Received: from RHEL7U5Alpha_SERVER.g08.fujitsu.local (10.167.220.156) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 27 Aug 2018 08:06:09 +0800 From: Xiao Yang To: Date: Mon, 27 Aug 2018 08:05:55 +0800 Message-ID: <1535328355-16759-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <20180824145656.GA5131@rei> References: <20180824145656.GA5131@rei> MIME-Version: 1.0 X-Originating-IP: [10.167.220.156] X-yoursite-MailScanner-ID: 545AE4B6AE18.AA016 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No, score=0.0 required=7.0 tests=none autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Cc: ltp@lists.linux.it Subject: [LTP] [PATCH v2] newlib_tests/test_exec.c: Fix compiler error before glibc v2.11 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" Before glibc v2.11, execvpe() was not introduced and resulted in compiler error, so we replace execvpe() with execve() and update test-writing-guidelines.txt. Signed-off-by: Xiao Yang Reviewed-by: Petr Vorel --- doc/test-writing-guidelines.txt | 8 ++++++-- lib/newlib_tests/test_exec.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt index a169724..0b89cf9 100644 --- a/doc/test-writing-guidelines.txt +++ b/doc/test-writing-guidelines.txt @@ -697,14 +697,18 @@ a non zero exit code. ------------------------------------------------------------------------------- /* test.c */ #define _GNU_SOURCE -#include +#include #include "tst_test.h" static void do_test(void) { char *const argv[] = {"test_exec_child", NULL}; + char path[4096]; - execvpe(argv[0], argv, environ); + if (tst_get_path("test_exec_child", path, sizeof(path))) + tst_brk(TCONF, "Couldn't find test_exec_child in $PATH"); + + execve(path, argv, environ); tst_res(TBROK | TERRNO, "EXEC!"); } diff --git a/lib/newlib_tests/test_exec.c b/lib/newlib_tests/test_exec.c index 8aef621..2c86568 100644 --- a/lib/newlib_tests/test_exec.c +++ b/lib/newlib_tests/test_exec.c @@ -25,14 +25,18 @@ */ #define _GNU_SOURCE -#include +#include #include "tst_test.h" static void do_test(void) { char *const argv[] = {"test_exec_child", NULL}; + char path[4096]; - execvpe(argv[0], argv, environ); + if (tst_get_path("test_exec_child", path, sizeof(path))) + tst_brk(TCONF, "Couldn't find test_exec_child in $PATH"); + + execve(path, argv, environ); tst_res(TBROK | TERRNO, "EXEC!"); }