From patchwork Mon Sep 25 19:45:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 818344 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="N5z5/gov"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3y1F1N1kTDz9s76 for ; Tue, 26 Sep 2017 05:45:26 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9E073C21EE4; Mon, 25 Sep 2017 19:45:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id EACCAC21C71; Mon, 25 Sep 2017 19:45:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 635BFC21C71; Mon, 25 Sep 2017 19:45:17 +0000 (UTC) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by lists.denx.de (Postfix) with ESMTPS id C5473C21C4C for ; Mon, 25 Sep 2017 19:45:16 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id e69so4005501pfg.4 for ; Mon, 25 Sep 2017 12:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2weSJ7A3VlrR4ib2bR1EVwP+8+m94eTaJX+BuWYXcp4=; b=N5z5/govOkio/Im6uZApDcou8v8U8npmNxp7cXUdYXJo0BF2UUAkMWGH9m2FmNk4Kd 9uZQeFKOAT6IgofsCl8d2tSRiheD06vLmidhzFOanluBbUEiCel+b/RPc0BYece2ual5 DGBkeysMR3Ez7kPu1W0ApwTXe+EJ1iHo/08hQv8qR5peO6SkwVyjzal0+JxXG5bgEgGl jqo/BdbiD78yH5SI6/wmeIckIyWZ2Y9Lr4ObdtBGEuB8zTZ7e1XvXnbz3/S4Ti5HKKcL 0lmMEMd/80Jz17lfxWztoE4/wh7+LGqjfAQatKiSNUrm4WleC4pkd6Xg0eFGX0rDHa3Q 8s5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2weSJ7A3VlrR4ib2bR1EVwP+8+m94eTaJX+BuWYXcp4=; b=cjt5Zuu4liUbpLmU8yDUQpi0a7zABDBFtJrofSx4DusTovcM3JqpMQ/OGXMrZ6y4r/ WqhziYFSVVrTQKVmYh+1+d0OXc/iGvTETDWb0bLBxZNtL98g0FYm9ZLhlfKhbTCibBn4 Km4fZyJceo1C1w7lE3LQ7VdFTeeNWVvyroNZPCUe43Td29fgzRuNFJZra2T/PMDqnCFo DbRpS+5tHFpZ4ithItefUVezRk2RP489vXrVdypPh08jat3snc0w03MBZx9fND0lauJw FvyUrKguzt/KvnFKNXP2RRS9Pf7eCI76TWjXck9w8PcILSXp+fb2qXmBB5zgEzBO/jUK xRbA== X-Gm-Message-State: AHPjjUg8GgyKG1TeDmDZDUkWMMPwc9TfMyfJNswokF8k3IlHWx/PDkut NvMe3CnOX6L9rEzYCdLnD+god7f1 X-Google-Smtp-Source: AOwi7QA2sH2QyAhTz1wmvvbJH3pwMp/TwCYrbabN/8q6mrqR1/8GMqDGXsR9dcn5NC35V628rxlrjA== X-Received: by 10.84.235.6 with SMTP id o6mr8431780plk.295.1506368714645; Mon, 25 Sep 2017 12:45:14 -0700 (PDT) Received: from localhost (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id a7sm12000326pgc.40.2017.09.25.12.45.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 12:45:13 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Mon, 25 Sep 2017 15:45:08 -0400 Message-Id: <20170925194511.15872-1-robdclark@gmail.com> X-Mailer: git-send-email 2.13.5 Subject: [U-Boot] [PATCH 1/2] video: test: Helper for writing strings X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" I'll need some more of this, let's not just copy-pasta the vidconsole_put_char() loop. Named to match vidconsole_put_char() in case that is ever useful outside of the tests. Signed-off-by: Rob Clark --- test/dm/video.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/dm/video.c b/test/dm/video.c index 4d000fa1be..6a5626c5e3 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -100,6 +100,14 @@ static int select_vidconsole(struct unit_test_state *uts, const char *drv_name) return 0; } +static void vidconsole_put_string(struct udevice *dev, const char *str) +{ + const char *s; + + for (s = str; *s; s++) + vidconsole_put_char(dev, *s); +} + /* Test text output works on the video console */ static int dm_test_video_text(struct unit_test_state *uts) { @@ -140,13 +148,11 @@ static int dm_test_video_chars(struct unit_test_state *uts) { struct udevice *dev, *con; const char *test_string = "Well\b\b\b\bxhe is\r \n\ta very \amodest \bman\n\t\tand Has much to\b\bto be modest about."; - const char *s; ut_assertok(select_vidconsole(uts, "vidconsole0")); ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - for (s = test_string; *s; s++) - vidconsole_put_char(con, *s); + vidconsole_put_string(con, test_string); ut_asserteq(466, compress_frame_buffer(dev)); return 0; @@ -294,12 +300,10 @@ static int dm_test_video_truetype(struct unit_test_state *uts) { struct udevice *dev, *con; const char *test_string = "Criticism may not be agreeable, but it is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things. Some see private enterprise as a predatory target to be shot, others as a cow to be milked, but few are those who see it as a sturdy horse pulling the wagon. The \aprice OF\b\bof greatness\n\tis responsibility.\n\nBye"; - const char *s; ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - for (s = test_string; *s; s++) - vidconsole_put_char(con, *s); + vidconsole_put_string(con, test_string); ut_asserteq(12619, compress_frame_buffer(dev)); return 0; @@ -312,7 +316,6 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) struct sandbox_sdl_plat *plat; struct udevice *dev, *con; const char *test_string = "Criticism may not be agreeable, but it is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things. Some see private enterprise as a predatory target to be shot, others as a cow to be milked, but few are those who see it as a sturdy horse pulling the wagon. The \aprice OF\b\bof greatness\n\tis responsibility.\n\nBye"; - const char *s; ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); ut_assert(!device_active(dev)); @@ -321,8 +324,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - for (s = test_string; *s; s++) - vidconsole_put_char(con, *s); + vidconsole_put_string(con, test_string); ut_asserteq(33849, compress_frame_buffer(dev)); return 0; @@ -335,7 +337,6 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) struct sandbox_sdl_plat *plat; struct udevice *dev, *con; const char *test_string = "...Criticism may or may\b\b\b\b\b\bnot be agreeable, but seldom it is necessary\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bit is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things."; - const char *s; ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); ut_assert(!device_active(dev)); @@ -344,8 +345,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); - for (s = test_string; *s; s++) - vidconsole_put_char(con, *s); + vidconsole_put_string(con, test_string); ut_asserteq(34871, compress_frame_buffer(dev)); return 0;