From patchwork Mon Feb 29 22:26:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 590202 X-Patchwork-Delegate: sjg@chromium.org 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 A50E9140783 for ; Tue, 1 Mar 2016 09:30:39 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=cPBahaQM; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 17A0FA76BE; Mon, 29 Feb 2016 23:28:45 +0100 (CET) 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 J8YMT4jXqWHh; Mon, 29 Feb 2016 23:28:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 55E20A76BF; Mon, 29 Feb 2016 23:27:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B4E9FA760C for ; Mon, 29 Feb 2016 23:26:53 +0100 (CET) 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 ZtspbshKhX8P for ; Mon, 29 Feb 2016 23:26:53 +0100 (CET) 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-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by theia.denx.de (Postfix) with ESMTPS id 1CC2EA75EE for ; Mon, 29 Feb 2016 23:26:43 +0100 (CET) Received: by mail-oi0-f43.google.com with SMTP id k67so58962925oia.3 for ; Mon, 29 Feb 2016 14:26:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=bB+/cKHS0SH7C7KxcjpzyzCsaeC01KjU+MsPmFHi8F4=; b=cPBahaQMQCfv7ocThotHPD9PPkSGs1CC5FXOTdo+54YpAd3eLq/Dzcj68+hRQOTIUw FtabgVLvCI5ZFMmu+RiLAwlQXn+5yoqxSBAyXfrXUvGLO8VtGD4ZfphNp9xzeXVcSjDQ pqanvrF2FPUKlNHGwoXVu8+Ubk6eGiqH8EXzaJRoPDn2y0Bn17z95iEVVkgaU6lBxpik XslyXGlnfWHUN0pTtVCWGoa6iwjt2R1dNAj/9ARVXaB7qK10NNdHrSFvp9kK3kkULxaL 1+t2boKIiqC8ejPhYcKxKGrNt87DLfimDfH2MgUwonMohvfpGGW+ph3AaKfMxb43Ws2B 6gFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=bB+/cKHS0SH7C7KxcjpzyzCsaeC01KjU+MsPmFHi8F4=; b=RqITi5BJNjzLUF4evlxEWu9OTpLLcAbAUQIoGCSJh1JCcPbbWPKP3BIWPLj3ZtX+am F0DdnEYJpVaHHahGJ9yOJxsJH/Vw7pSAQEwazpQ53NbH3bEgjuH/hQn7cCzCRzOCEKGy ROtVY8g9g9Qfd6d2agp2U54NHRX/70C/g6qfW7jsQc1kPH3mnMLjvmkWB84IG+6yASWS sAycCu3NmzpwnQ9CGZ2BdwGUvabWuvVKrtmMh7aZiW53gtD4wjtzKof5P4bInV/5P9QX /GNiLMZmckeZ7E57ft5fGQWkxJE/zxr5JP0Wr7uoWTvVcYhcQSNhUuz69w1Ekqgiqj5e 5yeA== X-Gm-Message-State: AD7BkJKXYKK+hSTbqGrv2ei9BQhCUDCu8DSSEjaovldtYPWwqFCKwZHB+4Q9exrtFkjmpmOm X-Received: by 10.202.185.214 with SMTP id j205mr13772786oif.68.1456784802743; Mon, 29 Feb 2016 14:26:42 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id n5sm19495088obi.20.2016.02.29.14.26.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Feb 2016 14:26:38 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 70A842228C1; Mon, 29 Feb 2016 15:26:31 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 29 Feb 2016 15:26:02 -0700 Message-Id: <1456784765-10788-30-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456784765-10788-2-git-send-email-sjg@chromium.org> References: <1456784765-10788-2-git-send-email-sjg@chromium.org> Cc: Marek Vasut , Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH v2 29/32] dm: usb: Clean up USB after each test X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The USB subsystem has a few counters that need to be reset since they are stored in static variables rather than driver-model data. An example is usb_max_devs. Ultimately we should move this data into the USB uclass. For now, make sure that USB is reset after each test, so that the counters go back to zero. Note: this is not a perfect solution: It a USB test fails it will exit immediately and leave USB un-reset. The impact here is that it may cause subsequence test failures in the same run. Signed-off-by: Simon Glass --- Changes in v2: None test/dm/usb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/dm/usb.c b/test/dm/usb.c index 2d20354..b46ae60 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -52,6 +52,7 @@ static int dm_test_usb_flash(struct unit_test_state *uts) memset(cmp, '\0', sizeof(cmp)); ut_asserteq(2, blk_dread(dev_desc, 0, 2, cmp)); ut_assertok(strcmp(cmp, "this is a test")); + ut_assertok(usb_stop()); return 0; } @@ -67,6 +68,7 @@ static int dm_test_usb_multi(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 1, &dev)); ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 2, &dev)); + ut_assertok(usb_stop()); return 0; }