From patchwork Mon Dec 31 22:39:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 208897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id E3E072C00A8 for ; Tue, 1 Jan 2013 09:39:32 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tpo13-0001RB-Tk; Mon, 31 Dec 2012 22:39:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tpo12-0001R6-E6 for fwts-devel@lists.ubuntu.com; Mon, 31 Dec 2012 22:39:28 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Tpo12-0000CR-7K for fwts-devel@lists.ubuntu.com; Mon, 31 Dec 2012 22:39:28 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib: framework: log the fwts command line for reference. Date: Mon, 31 Dec 2012 22:39:27 +0000 Message-Id: <1356993567-26256-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Since CERT may be running fwts with options that may be silently ignoring some fwts errors it makes sense to also log the command line options being used so we can see how fwts is being invoked for reference purposes. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Keng-Yu Lin --- src/lib/src/fwts_framework.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index a04215d..7290912 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -811,13 +811,18 @@ static void fwts_framework_syntax(char * const *argv) * fwts_framework_heading_info() * log basic system info so we can track the tests */ -static void fwts_framework_heading_info(fwts_framework *fw, fwts_list *tests_to_run) +static void fwts_framework_heading_info( + fwts_framework *fw, + fwts_list *tests_to_run, + const int argc, + char * const *argv) { struct tm tm; time_t now; struct utsname buf; char *tests = NULL; - size_t len = 1; + char *args = NULL; + size_t len; int i; fwts_list_link *item; @@ -838,6 +843,19 @@ static void fwts_framework_heading_info(fwts_framework *fw, fwts_list *tests_to_ buf.sysname, buf.nodename, buf.release, buf.version, buf.machine); fwts_log_nl(fw); + for (len = 1, i = 1; i < argc; i++) + len += strlen(argv[i]) + 1; + + if ((args = calloc(len, 1)) != NULL) { + for (len = 1, i = 1; i < argc; i++) { + strcat(args, " "); + strcat(args, argv[i]); + } + fwts_log_info(fw, "Command: \"fwts %s\".", args); + free(args); + } + + len = 1; fwts_list_foreach(item, tests_to_run) { fwts_framework_test *test = fwts_list_data(fwts_framework_test *, item); len += strlen(test->name) + 1; @@ -1304,7 +1322,7 @@ int fwts_framework_args(const int argc, char **argv) } fwts_log_section_begin(fw->results, "heading"); - fwts_framework_heading_info(fw, &tests_to_run); + fwts_framework_heading_info(fw, &tests_to_run, argc, argv); fwts_log_section_end(fw->results); fwts_log_section_begin(fw->results, "tests");