From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web12.7936.1594978616554419117 for ; Fri, 17 Jul 2020 02:36:56 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R1+JKeJ+; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594978615; 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=6kOjrhRuhg4A+PjB1KPPt4ThjqD3FvS2C0SRp7wkWwE=; b=R1+JKeJ+rUa9uNlJncB29opz65TY5DaqStiXrVK/nl4uKxbmju3jrwVABTK5hTbiywKgib 5rvyndDkfqiz0vUABf2iUWAjl+Bn+BzcMvgNqAnhAnYpPYRSa2QYJltMngVitrosjDFLzf c42Wl3krrY5ZqpzxchPYUQsLk6zwvqE= 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-254-A042a7_SPmqPxqj7tUnOlQ-1; Fri, 17 Jul 2020 05:36:51 -0400 X-MC-Unique: A042a7_SPmqPxqj7tUnOlQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED0D71DE1; Fri, 17 Jul 2020 09:36:49 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-237.ams2.redhat.com [10.36.114.237]) by smtp.corp.redhat.com (Postfix) with ESMTP id D981A6FECD; Fri, 17 Jul 2020 09:36:47 +0000 (UTC) Subject: Re: [PATCH] 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: <20200717073318.877-1-ray.ni@intel.com> From: "Laszlo Ersek" Message-ID: <59a058cf-8c9b-b2a3-f672-921f11e634d3@redhat.com> Date: Fri, 17 Jul 2020 11:36:46 +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: <20200717073318.877-1-ray.ni@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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/17/20 09:33, 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: Ming Shao > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Sean Brogan > Cc: Bret Barkelew > Cc: Jiewen Yao > --- > .../MtrrLib/UnitTest/MtrrLibUnitTest.c | 1094 +++++++++++++++++ > .../MtrrLib/UnitTest/MtrrLibUnitTest.h | 171 +++ > .../MtrrLib/UnitTest/MtrrLibUnitTestHost.inf | 39 + > UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c | 913 ++++++++++++++ > UefiCpuPkg/Test/UefiCpuPkgHostTest.dsc | 31 + > 5 files changed, 2248 insertions(+) > 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