From patchwork Tue Oct 17 22:02:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 827331 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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yGqBV5q2Hz9t3H for ; Wed, 18 Oct 2017 09:10:26 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9B79CC21E76; Tue, 17 Oct 2017 22:08:35 +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_MSPIKE_H2 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 BFCA4C21F10; Tue, 17 Oct 2017 22:03:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 20909C21DC1; Tue, 17 Oct 2017 22:03:23 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 3DE54C21E51 for ; Tue, 17 Oct 2017 22:03:14 +0000 (UTC) Received: from workstation4.fritz.box ([94.114.42.150]) by mail.gmx.com (mrgmx102 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MSp1l-1ddFWn41Mj-00RpaB; Wed, 18 Oct 2017 00:03:13 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Wed, 18 Oct 2017 00:02:43 +0200 Message-Id: <20171017220244.8549-18-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171017220244.8549-1-xypron.glpk@gmx.de> References: <20171017220244.8549-1-xypron.glpk@gmx.de> X-Provags-ID: V03:K0:UsDuTNntL7OdPj45NYIDat3oz4/L25P75u5Sg2c4AFUZnZiFMjg PAZb0QkTDtjaGWhvBPH0wY9Gz7y4QSfKLPIM4e3nCeR631DDgESd0VtsrmJYiPYjHnn+iRd noe7ESTcf9loztwqTCNmGZDM0EVlj53EJE3RDQAayQLof4cBTs68mJTRq0UaZYd058CFTWd A0MTrUNKrU8xULfkJTsjA== X-UI-Out-Filterresults: notjunk:1; V01:K0:ZF+QcEqLPsU=:iVQJcWApICTPPZGIEpPM6/ atpdttCiplvUCAtT75ngrO69C99pRKELhzfbet8prB49yvNXfKhardD0yHokzD4JY23LtDlCA E1cYRDefe3aEx4niKn6iB9HK3D4vIuDpuQ0Yp11pj1jPOmoD5Y+xgEoRf5SmdS+bebpR28TMU yl3Vw8h2JUDFGr3TQVsFlXbx6CL7+5LPoL7TtbGzkgM5rInfW4l1GGGgSinsp9JLgXK/4JoAj RRqv+YICph2kXKNj8ACyNiADe70VWybSKGOinY7+d1kWChoyldhKmfURS642di3N8sHBDG7gZ 49LzgnbXKUyp+/45s+8NFwtg3TuTa9kQS+tG2A6ZBx6l2nwcYRWKlZ+UvsoKpHIftwAh5ykdP T/4xsOLtuHm2cIqnLXVlOnv+MMKbAQ2vqZqTheZE5f/kSp3GirMxGDXg49O1v8fL5BRxizy5a RjKc5nzW7/1LvpLo+ddUv9ZJYH6sJaSnk6nz+qdw+DBdvL3THP1Hh2BpwgYplNxjkQmxuRKvY Vog+Y5s+Zy2chD95Kz6mT+MQ6hlKvTyqcBVBfoxJoaVh/VTCUi17O+xIbmMiz5ZJCfx1EPZR4 YO0kNXufvSVl/AuFQN6a3xfkkWBoSNQn2hzDR2tlOlQmYaAy+QE7N/6iqU/EJsB3RwgpfGfCY aefYkMzIwlQrbSH57lnY+Y4cC+yJKPxtpHKProDXyizYUgBlaf13/fkJx23C/AXNj2ec2Utma RkOJ52GKI40uoZw4tcWowwXrDsZiaE0k8zsS7vwc1gl71a2tlYoTv1xtaiWgtdG0/78vIAy8p DUsvGXdgV/o1QF+ePLhvwg5S+a5hw== Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 17/18] efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL 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" The following services are tested: OutputString, TestString, SetAttribute. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- v3 new patch --- lib/efi_selftest/Makefile | 5 ++- lib/efi_selftest/efi_selftest_textoutput.c | 53 ++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 lib/efi_selftest/efi_selftest_textoutput.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 3e5c9a6d16..b1385383ed 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -17,7 +17,9 @@ CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_snp.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_snp.o := $(CFLAGS_NON_EFI) -CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI) +CFLAGS_efi_selftest_text_output.o := $(CFLAGS_EFI) +CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) +CFLAGS_efi_selftest_text_output.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI) CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI) CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI) @@ -30,6 +32,7 @@ efi_selftest_console.o \ efi_selftest_events.o \ efi_selftest_exitbootservices.o \ efi_selftest_snp.o \ +efi_selftest_textoutput.o \ efi_selftest_tpl.o \ efi_selftest_util.o \ efi_selftest_watchdog.o diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c new file mode 100644 index 0000000000..7bc4d2f446 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_textoutput.c @@ -0,0 +1,53 @@ +/* + * efi_selftest_textoutput + * + * Copyright (c) 2017 Heinrich Schuchardt + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Test the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. + * + * The following services are tested: + * OutputString, TestString, SetAttribute. + */ + +#include + +/* + * Execute unit test. + * + * @return: EFI_ST_SUCCESS for success + */ +static int execute(void) +{ + size_t foreground; + size_t background; + size_t attrib; + efi_status_t ret; + + /* SetAttribute */ + efi_st_printf("\nColor palette\n"); + for (foreground = 0; foreground < 0x10; ++foreground) { + for (background = 0; background < 0x80; background += 0x10) { + attrib = foreground | background; + con_out->set_attribute(con_out, attrib); + efi_st_printf("%p", (void *)attrib); + } + con_out->set_attribute(con_out, 0); + efi_st_printf("\n"); + } + /* TestString */ + ret = con_out->test_string(con_out, + L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n"); + if (ret != EFI_ST_SUCCESS) { + efi_st_error("TestString failed for ANSI characters\n"); + return EFI_ST_FAILURE; + } + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(textoutput) = { + .name = "text output", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .execute = execute, +};