From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web11.8775.1595930291587640291 for ; Tue, 28 Jul 2020 02:58:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R/3Axf8M; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595930290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ubzq+Nv4oy7IAzb9eFYsTJQA/qF9Qv8H4Gkdcz/rVSo=; b=R/3Axf8MNwROqIqPwVzGvDM9b+xzVYkRGdJC8zwyURVwnBuyqzUoTNE6C+kFwkSu9J/E23 4cnOp53En3oFDAK1jgF8ZTJLv+RGu3vdo/HF5c6k61DblWw2ozscBIGs9YkqMvAeFfBJPm wtNQOx/gC/d2g+Yf+sJkRkTZ7e2JGSA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-OlbOwXw8O3-CcBIJ7iOt8w-1; Tue, 28 Jul 2020 05:58:08 -0400 X-MC-Unique: OlbOwXw8O3-CcBIJ7iOt8w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7C5F658; Tue, 28 Jul 2020 09:58:07 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-229.ams2.redhat.com [10.36.113.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6EC910013D7; Tue, 28 Jul 2020 09:58:05 +0000 (UTC) Subject: Re: [PATCH v3] UefiCpuPkg/MtrrLib/UnitTest: Add host based unit test To: Ray Ni , devel@edk2.groups.io Cc: Michael D Kinney , Ming Shao , Eric Dong , Sean Brogan , Bret Barkelew , Jiewen Yao References: <20200728023007.610-1-ray.ni@intel.com> From: "Laszlo Ersek" Message-ID: <29252ab5-be05-2289-e311-70e8002bc704@redhat.com> Date: Tue, 28 Jul 2020 11:58:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200728023007.610-1-ray.ni@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 07/28/20 04:30, Ray Ni wrote: > Add host based unit tests for the MtrrLib services. > The BaseLib services AsmCpuid(), AsmReadMsr64(), and > AsmWriteMsr64() are hooked and provide simple emulation > of the CPUID leafs and MSRs required by the MtrrLib to > run as a host based unit test. > > Test cases are developed for each of the API. > > For the most important APIs MtrrSetMemoryAttributesInMtrrSettings() > and MtrrSetMemoryAttributeInMtrrSettings(), random inputs are > generated and fed to the APIs to make sure the implementation is > good. The test application accepts an optional parameter which > specifies how many iterations of feeding random inputs to the two > APIs. The overall number of test cases increases when the iteration > increases. Default iteration is 10 when no parameter is specified. > > Signed-off-by: Ray Ni > Signed-off-by: Michael D Kinney > Signed-off-by: Ming Shao > Cc: Michael D Kinney > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Ming Shao > Cc: Sean Brogan > Cc: Bret Barkelew > Cc: Jiewen Yao > --- > .../MtrrLib/UnitTest/MtrrLibUnitTest.c | 1140 +++++++++++++++++ > .../MtrrLib/UnitTest/MtrrLibUnitTest.h | 171 +++ > .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf | 39 + > UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c | 913 +++++++++++++ > UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc | 31 + > UefiCpuPkg/UefiCpuPkg.ci.yaml | 12 +- > 6 files changed, 2305 insertions(+), 1 deletion(-) > create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.c > create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTest.h > create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/MtrrLibUnitTestHost.inf > create mode 100644 UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c > create mode 100644 UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc Acked-by: Laszlo Ersek