From patchwork Sat May 24 03:11:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 352069 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 7CB4C1400C6 for ; Sat, 24 May 2014 13:12:12 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 224E04B65D; Sat, 24 May 2014 05:12:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gzPx2grx+kI2; Sat, 24 May 2014 05:12:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DB0AE4B65F; Sat, 24 May 2014 05:12:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC2524B65F for ; Sat, 24 May 2014 05:12:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a7nwVvC1WcQa for ; Sat, 24 May 2014 05:12:02 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ve0-f202.google.com (mail-ve0-f202.google.com [209.85.128.202]) by theia.denx.de (Postfix) with ESMTPS id 66B8A4B662 for ; Sat, 24 May 2014 05:11:58 +0200 (CEST) Received: by mail-ve0-f202.google.com with SMTP id pa12so996033veb.1 for ; Fri, 23 May 2014 20:11:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5ZL6KGUoIyKNoCS+RVh/OW7MdHu1sbd37OTgJ/KtBjA=; b=X5BtAIY/L2PdCq325d/9ua3ZwLaqJ8w39iYDvptfiCWYfsHyC9TtmeF/Uz08lZ08Zd WNG5vN0awaT8F2lAU1z9tFts+AmMfwK19fClGRShirDA0A+CCvdKVitj17R9mz1pLPSN 3vZAxs+BnJBVXK0Uz53uJJIhkfwO6XZiDqEqImiAz1CLwjyKal8qm4/6tayaIG8kbHMP 2N6XFInubv9pZkqpe6jDLEfkGaXkhPz2wKeJNP6jQ8oAkrLTf8YMkhjIqXy1D/zzaFK/ DVWhqVPsildUv0eM8srd81hgQPcQI7Nk+Cr/Vr6/ZYNF5QJiofz5u38s7H5zkGX2uBig LmLw== X-Gm-Message-State: ALoCoQmPKYGWIE7YC/vyopqz77H0iP9jbcdCq45RnXJRQgafBwS9XS0OkOCP8YHegVEJ9AKLhx1y X-Received: by 10.236.209.97 with SMTP id r61mr3913241yho.33.1400901117328; Fri, 23 May 2014 20:11:57 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id i65si26584yhg.2.2014.05.23.20.11.57 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 May 2014 20:11:57 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 2D6E85A4DF5; Fri, 23 May 2014 20:11:57 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id DE238220709; Fri, 23 May 2014 21:11:56 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 23 May 2014 21:11:32 -0600 Message-Id: <1400901095-29391-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1400901095-29391-1-git-send-email-sjg@chromium.org> References: <1400901095-29391-1-git-send-email-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 1/4] Add final result tests for run_command_list() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de run_command_list() is supposed to return a return code of 0 for success and 1 for failure. Add a few simple tests that confirm this. These tests work both with the built-in parser and hush. Signed-off-by: Simon Glass --- test/command_ut.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/command_ut.c b/test/command_ut.c index aaa1ee2..b2666bf 100644 --- a/test/command_ut.c +++ b/test/command_ut.c @@ -61,6 +61,11 @@ static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) "setenv list ${list}3", strlen("setenv list 1"), 0); assert(!strcmp("1", getenv("list"))); + assert(run_command("false", 0) == 1); + assert(run_command("echo", 0) == 0); + assert(run_command_list("false", -1, 0) == 1); + assert(run_command_list("echo", -1, 0) == 0); + #ifdef CONFIG_SYS_HUSH_PARSER /* Test the 'test' command */