From patchwork Thu Dec 13 08:35:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 1011665 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 ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F8kM3BLRz9s3Z for ; Wed, 12 Dec 2018 19:15:07 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DA8CE3E6F4E for ; Wed, 12 Dec 2018 09:15:03 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 5CEC33E6F0A for ; Wed, 12 Dec 2018 09:15:02 +0100 (CET) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-3.smtp.seeweb.it (Postfix) with ESMTP id 625921A01204 for ; Wed, 12 Dec 2018 09:14:59 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.56,343,1539619200"; d="scan'208";a="49588658" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 Dec 2018 16:14:57 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 069844B6ED63; Wed, 12 Dec 2018 16:14:56 +0800 (CST) Received: from RHEL7U5GA_Intel64.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; Wed, 12 Dec 2018 16:14:55 +0800 From: Xiao Yang To: , Date: Thu, 13 Dec 2018 16:35:58 +0800 Message-ID: <1544690160-13900-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <20181211151733.GC1180@rei> References: <20181211151733.GC1180@rei> MIME-Version: 1.0 X-Originating-IP: [10.167.220.156] X-yoursite-MailScanner-ID: 069844B6ED63.A72FB X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No, score=1.2 required=7.0 tests=DATE_IN_FUTURE_24_48 autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-3.smtp.seeweb.it Cc: ltp@lists.linux.it Subject: [LTP] [PATCH v3 1/3] lib: Introduce tst_strttype() 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" Rename strttype() to tst_strttype() and introduce the function for old and new library. Signed-off-by: Xiao Yang --- include/old/test.h | 2 +- include/tst_test.h | 4 ++++ lib/tst_res.c | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/old/test.h b/include/old/test.h index 0738237..3dce395 100644 --- a/include/old/test.h +++ b/include/old/test.h @@ -113,7 +113,7 @@ void tst_parse_opts(int argc, char *argv[], const option_t *user_optarg, void (*user_help)(void)); /* lib/tst_res.c */ -const char *strttype(int ttype); +const char *tst_strttype(int ttype); void tst_resm_(const char *file, const int lineno, int ttype, const char *arg_fmt, ...) diff --git a/include/tst_test.h b/include/tst_test.h index 2ebf746..f3d1546 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -222,6 +222,10 @@ extern void *TST_RET_PTR; */ const char *tst_strerrno(int err); const char *tst_strsig(int sig); + +// Function to convert ttype to its name. +const char *tst_strttype(int ttype); + /* * Returns string describing status as returned by wait(). * diff --git a/lib/tst_res.c b/lib/tst_res.c index c35f41b..8c69b75 100644 --- a/lib/tst_res.c +++ b/lib/tst_res.c @@ -139,7 +139,7 @@ struct pair { return pair_arr[idx].name; \ } while (0) -const char *strttype(int ttype) +const char *tst_strttype(int ttype) { static const struct pair ttype_pairs[] = { PAIR(TPASS) @@ -296,7 +296,7 @@ static void tst_print(const char *tcid, int tnum, int ttype, const char *tmesg) /* * Build the result line and print it. */ - type = strttype(ttype); + type = tst_strttype(ttype); if (T_mode == VERBOSE) { size += snprintf(message + size, sizeof(message) - size,