From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Subject: [Patch v2 00/16] UnitTestFrameworkPkg: Enhancements and bug fixes
Date: Wed, 8 Jul 2020 21:05:05 -0700 [thread overview]
Message-ID: <20200709040521.3748-1-michael.d.kinney@intel.com> (raw)
Changes in V2
==============
* Add UnitTestExpectAssertFailure() to UnitTestLib to simplify the macro
UT_EXPECT_ASSERT_FAILURE() and provide better log messages.
* Expand UnitTestFrameworkPkg sample unit tests to cover test cases for the new
UT_EXPECT_ASSERT_FAILURE() macro and all other UnitTestLib macros.
* Add failure type FAILURETYPE_EXPECTASSERT when the macro
UT_EXPECT_ASSERT_FAILURE() does not detect an ASSERT().
* Move print of log messages to end of cleanup function to support log
messages generated in a cleanup function.
* Update running of target-based tests to use SetJump()/LongJump()
around prereq, cleanup, and unit test functions to match the behavior
of host based tests using cmocka. This also requires all UnitTestLib
Assert functions to generate error log message first and then call
UnitTestFailure() where the LongJump() is made to make sure all log
messages are added before the LongJump().
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2797
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2798
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2799
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2800
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2801
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2803
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2804
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2805
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2806
* Add Null base libraries for host based unit tests
* Add host based test version of BaseLib with hooks for services that use
privileged instructions.
* Add new UT_EXPECT_ASSERT_FAILURE() macro to UnitTestLib class
* Enable source level debug of unit tests
* Increase stack size to 256KB for host based tests on Windows
* Update BaseTools to support NULL libs for HOST_APPLICATION modules
* Guarantee print log works even if unit test generates an exception
* Use filename instead of function name in target mode logs
Cc: Liming Gao liming.gao@intel.com
Cc: Bob Feng bob.c.feng@intel.com
Cc: Sean Brogan sean.brogan@microsoft.com
Cc: Bret Barkelew Bret.Barkelew@microsoft.com
Cc: Jiewen Yao jiewen.yao@intel.com
Signed-off-by: Michael D Kinney michael.d.kinney@intel.com
Michael D Kinney (16):
BaseTools/Python: Allow HOST_APPLICATION to use NULL libraries
MdePkg/BaseCpuLibNull: Add Null version of CpuLib for host testing
MdePkg/BaseCacheMaintenanceLibNull: Add Null instance for host testing
MdePkg/BaseLib: Break out IA32/X64 GCC inline privileged functions
MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests
UnitTestFrameworkPkg: Use host libraries from MdePkg
UnitTestFrameworkPkg: Enable source level debug for host tests
UnitTestFrameworkPkg: Set host application stack size to 256KB
UnitTestFrameworkPkg: Change target mode DebugLib mapping
UnitTestFrameworkPkg/UnitTestLib: Move print log into cleanup
UnitTestFrameworkPkg/UnitTestLib: Fix target mode log messages
UnitTestFrameworkPkg/UnitTestLib: Add checks for ASSERT()
MdePkg/Include: Hook DebugLib _ASSERT() for unit tests
MdePkg/Include: Add UT_EXPECT_ASSERT_FAILURE() to UnitTestLib
MdePkg/Library/BaseStackCheckLib: Fix PCD type in INF
UnitTestFramewokPkg/SampleUnitTest: Use UT_EXPECT_ASSERT_FAILURE()
.../Python/Workspace/WorkspaceCommon.py | 4 +-
MdePkg/Include/Library/DebugLib.h | 28 +-
MdePkg/Include/Library/UnitTestLib.h | 90 +
.../BaseCacheMaintenanceLibNull.c | 225 ++
.../BaseCacheMaintenanceLibNull.inf | 29 +
.../BaseCacheMaintenanceLibNull.uni | 12 +
.../Library/BaseCpuLibNull/BaseCpuLibNull.c | 37 +
.../Library/BaseCpuLibNull/BaseCpuLibNull.inf | 26 +
.../Library/BaseCpuLibNull/BaseCpuLibNull.uni | 11 +
MdePkg/Library/BaseLib/BaseLib.inf | 4 +-
MdePkg/Library/BaseLib/Ia32/GccInline.c | 1181 +------
.../Ia32/{GccInline.c => GccInlinePriv.c} | 601 +---
MdePkg/Library/BaseLib/UnitTestHost.c | 140 +
MdePkg/Library/BaseLib/UnitTestHost.h | 66 +
.../Library/BaseLib/UnitTestHostBaseLib.inf | 216 ++
.../Library/BaseLib/UnitTestHostBaseLib.uni | 11 +
MdePkg/Library/BaseLib/X64/GccInline.c | 1240 +------
.../X64/{GccInline.c => GccInlinePriv.c} | 572 +---
MdePkg/Library/BaseLib/X86UnitTestHost.c | 2977 +++++++++++++++++
.../BaseStackCheckLib/BaseStackCheckLib.inf | 2 +-
MdePkg/MdePkg.dec | 3 +-
MdePkg/MdePkg.dsc | 4 +-
MdePkg/Test/MdePkgHostTest.dsc | 5 +
.../Include/HostTest/UnitTestHostBaseLib.h | 582 ++++
.../UnitTestDebugAssertLib.c | 49 +
.../UnitTestDebugAssertLib.inf | 31 +
.../UnitTestDebugAssertLib.uni | 11 +
.../Library/UnitTestLib/Assert.c | 217 +-
.../Library/UnitTestLib/AssertCmocka.c | 68 +
.../Library/UnitTestLib/RunTests.c | 23 +-
.../Library/UnitTestLib/RunTestsCmocka.c | 33 +-
.../UnitTestResultReportLib.c | 3 +-
.../PrivateInclude/UnitTestFrameworkTypes.h | 1 +
.../Sample/SampleUnitTest/SampleUnitTest.c | 510 +++
.../SampleUnitTest/SampleUnitTestDxe.inf | 3 +
.../SampleUnitTest/SampleUnitTestHost.inf | 3 +
.../SampleUnitTest/SampleUnitTestPei.inf | 3 +
.../SampleUnitTest/SampleUnitTestSmm.inf | 3 +
.../SampleUnitTestUefiShell.inf | 3 +
.../Test/UnitTestFrameworkPkgHostTest.dsc | 5 +-
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc | 4 +
.../UnitTestFrameworkPkgHost.dsc.inc | 10 +-
.../UnitTestFrameworkPkgTarget.dsc.inc | 10 +-
43 files changed, 5367 insertions(+), 3689 deletions(-)
create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c
create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.inf
create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.uni
create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c
create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf
create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni
copy MdePkg/Library/BaseLib/Ia32/{GccInline.c => GccInlinePriv.c} (62%)
create mode 100644 MdePkg/Library/BaseLib/UnitTestHost.c
create mode 100644 MdePkg/Library/BaseLib/UnitTestHost.h
create mode 100644 MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
create mode 100644 MdePkg/Library/BaseLib/UnitTestHostBaseLib.uni
copy MdePkg/Library/BaseLib/X64/{GccInline.c => GccInlinePriv.c} (65%)
create mode 100644 MdePkg/Library/BaseLib/X86UnitTestHost.c
create mode 100644 MdePkg/Test/UnitTest/Include/HostTest/UnitTestHostBaseLib.h
create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.c
create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.inf
create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.uni
--
2.21.0.windows.1
next reply other threads:[~2020-07-09 4:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 4:05 Michael D Kinney [this message]
2020-07-09 4:05 ` [Patch v2 01/16] BaseTools/Python: Allow HOST_APPLICATION to use NULL libraries Michael D Kinney
2020-07-09 11:44 ` Bob Feng
2020-07-09 23:50 ` [edk2-devel] " Sean
2020-07-09 4:05 ` [Patch v2 02/16] MdePkg/BaseCpuLibNull: Add Null version of CpuLib for host testing Michael D Kinney
2020-07-09 23:51 ` [edk2-devel] " Sean
2020-07-09 4:05 ` [Patch v2 03/16] MdePkg/BaseCacheMaintenanceLibNull: Add Null instance " Michael D Kinney
2020-07-09 4:05 ` [Patch v2 04/16] MdePkg/BaseLib: Break out IA32/X64 GCC inline privileged functions Michael D Kinney
2020-07-09 4:05 ` [Patch v2 05/16] MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests Michael D Kinney
2020-07-09 14:13 ` Liming Gao
2020-07-09 17:05 ` Michael D Kinney
2020-07-10 7:54 ` Liming Gao
2020-07-10 16:38 ` Michael D Kinney
2020-07-09 4:05 ` [Patch v2 06/16] UnitTestFrameworkPkg: Use host libraries from MdePkg Michael D Kinney
2020-07-09 4:05 ` [Patch v2 07/16] UnitTestFrameworkPkg: Enable source level debug for host tests Michael D Kinney
2020-07-09 4:05 ` [Patch v2 08/16] UnitTestFrameworkPkg: Set host application stack size to 256KB Michael D Kinney
2020-07-09 4:05 ` [Patch v2 09/16] UnitTestFrameworkPkg: Change target mode DebugLib mapping Michael D Kinney
2020-07-09 4:05 ` [Patch v2 10/16] UnitTestFrameworkPkg/UnitTestLib: Move print log into cleanup Michael D Kinney
2020-07-09 4:05 ` [Patch v2 11/16] UnitTestFrameworkPkg/UnitTestLib: Fix target mode log messages Michael D Kinney
2020-07-09 4:05 ` [Patch v2 12/16] UnitTestFrameworkPkg/UnitTestLib: Add checks for ASSERT() Michael D Kinney
2020-07-09 4:05 ` [Patch v2 13/16] MdePkg/Include: Hook DebugLib _ASSERT() for unit tests Michael D Kinney
2020-07-09 4:05 ` [Patch v2 14/16] MdePkg/Include: Add UT_EXPECT_ASSERT_FAILURE() to UnitTestLib Michael D Kinney
2020-07-09 4:05 ` [Patch v2 15/16] MdePkg/Library/BaseStackCheckLib: Fix PCD type in INF Michael D Kinney
2020-07-09 12:45 ` Liming Gao
2020-07-09 4:05 ` [Patch v2 16/16] UnitTestFramewokPkg/SampleUnitTest: Use UT_EXPECT_ASSERT_FAILURE() Michael D Kinney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200709040521.3748-1-michael.d.kinney@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox