Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edk2 host test v2 mdk updates v4 - Personal build #315

Closed

Conversation

mdkinney
Copy link
Member

Personal build

@mergify
Copy link

mergify bot commented Jan 23, 2020

PR can not be merged due to a PatchCheck failure. Please resolve and resubmit

@mergify
Copy link

mergify bot commented Jan 23, 2020

PR can not be merged due to an Ubuntu GCC5 failure. Please resolve and resubmit

@mdkinney mdkinney force-pushed the edk2-host-test_v2_mdk_updates_v4 branch from 2b63ca8 to 725c4e9 Compare January 23, 2020 18:42
@mergify
Copy link

mergify bot commented Jan 23, 2020

PR can not be merged due to a PatchCheck failure. Please resolve and resubmit

@mdkinney mdkinney force-pushed the edk2-host-test_v2_mdk_updates_v4 branch from 725c4e9 to 1fb4ad8 Compare January 24, 2020 18:34
@mergify mergify bot closed this Jan 24, 2020
@mergify
Copy link

mergify bot commented Jan 24, 2020

All checks passed. Auto close personal build.

@mdkinney mdkinney reopened this Feb 7, 2020
@mdkinney mdkinney force-pushed the edk2-host-test_v2_mdk_updates_v4 branch from 1fb4ad8 to 5a876e6 Compare February 7, 2020 01:50
@mergify
Copy link

mergify bot commented Feb 7, 2020

PR can not be merged due to an Ubuntu GCC5 failure. Please resolve and resubmit

mdkinney and others added 6 commits February 7, 2020 08:46
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

* Add plugin to build and run host based unit tests
* Add plugin that performs a DSC complete check DSC files
  used to build host based tests
* Update DscCompleteCheck plugin to ignore module INFs with
  a MODULE_TYPE of HOST_APPLICATION and library INFs that
  only support a module type of HOST_APPLICATION.
* Fix issues in XML reports from checkers.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

Add plugin to BaseTools to run host based unit tests.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
Acked-by: Bob Feng <bob.c.feng@intel.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

Add UnitTestLib class to MdePkg that provides services
and macros to implement unit tests.  These services and
macros support the following features:

* Create a Unit Test Framework
* Add a Unit Test Suite to a Unit Test Framework
  + Support optional step that executes before a Unit
    Test Suite is started.
  + Support optional step that executes after a Unit
    Test Suite is finished.
* Add a Unit Test to a Unit Test Suite
  + Support optional step that executes before a Unit
    Test is started.
  + Support optional step that executes after a Unit
    Test is finished.
* Run all unit tests added to a Unit Test Framework
* Save Unit Test Framework state to persistent storage
* Support assertion checks in a unit test for TRUE, FALSE,
  EQUAL, MEM_EQUAL, NOT_EFI_ERROR, STATUS_EQUAL, and NOT_NULL.
* Support generation of log messages at ERROR, WARN, INFO,
  and VERBOSE levels.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

Add public interfaces for use by unit test implementations.

* Include path to cmocka library interfaces.
* PcdUnitTestLogLevel to set the unit test logging message
  level to filter log messages.

Add private interfaces that are used by UnitTestLib
implementations.

* [Private] UnitTestBootLib - Set boot next to continue unit
  tests across a reboot.
* [Private] UnitTestPersistenceLib - Save unit test framework
  state to a persistent storage device.
* [Private] UnitTestResultLib - Output unit test results to a
  console device.
* [Private] UnitTestFrameworkTypes.h - Internal structures
  used by UnitTestLib implementations to keep track if unit
  test frameworks, unit test suites, and unit tests along with
  the serialized storage format to save a unit test framework
  state to persistent storage.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

Add the following library instances that are used to
build unit tests for host and target environments.

* CmockaLib with cmocka submodule to:

  https://git.cryptomilk.org/projects/cmocka.git

* DebugLibPosix - Instance of DebugLib based on POSIX
  APIs (e.g. printf).
* MemoryAllocationLibPosix - Instance of MemoryAllocationLib
  based on POSIX APIs (e.g. malloc/free).
* UnitTestBootLibNull - Null instance of the UnitTestBootLib
* UnitTestBootLibUsbClass - UnitTestBootLib instances that
  supports setting boot next to a USB device.
* UnitTestLib - UnitTestLib instance that is designed to work
  with PEI, DXE, SMM, and UEFI Shell target environments.
* UnitTestLibCmocka - UintTestLib instance that uses cmocka
  APIs and can only be use in a host environment.
* UnitTestPersistenceLibNull - Null instance of the
  UnitTestPersistenceLib
* UnitTestPersistenceLibSimpleFileSystem - UnitTestPersistenceLib
  instance that can safe the unit test framework state to a
  media device that supports the UEFI Simple File System
  Protocol.
* UnitTestResultReportLibConOut - UnitTestResultReportLib
  instance that sends report results to the UEFI standard
  output console.
* UnitTestResultReportLibDebugLib - UnitTestResultReportLib
  instance that sends report results to a DebugLib using
  DEBUG() macros.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

Add an implementation of a sample unit test that
demonstrates the use of the UnitTestLib services and
macros and supports being built for execution in a
host environment or for execution on a target in PEI,
DXE, SMM, or UEFI Shell.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
@mdkinney mdkinney force-pushed the edk2-host-test_v2_mdk_updates_v4 branch from 5a876e6 to 738a703 Compare February 7, 2020 16:47
@mergify
Copy link

mergify bot commented Feb 7, 2020

PR can not be merged due to an Ubuntu GCC5 failure. Please resolve and resubmit

2 similar comments
@mergify
Copy link

mergify bot commented Feb 7, 2020

PR can not be merged due to an Ubuntu GCC5 failure. Please resolve and resubmit

@mergify
Copy link

mergify bot commented Feb 7, 2020

PR can not be merged due to an Ubuntu GCC5 failure. Please resolve and resubmit

https://bugzilla.tianocore.org/show_bug.cgi?id=2505

* DSC in root of package file to perform a package
  build of the UnitTestFrameworkPkg and build sample
  unit test for all supported target environments.
* DSC file in Test directory to build the sample
  unit test for the host environment.
* UnitTestFrameworkPkgTarget.dsc.inc - DSC include
  file to !include when building unit tests for
  target environments.
* UnitTestFrameworkPkgHost.dsc.inc - DSC include
  file to !include when building unit tests for
  target environments.
* YAML file with set of CI checks to perform on UnitTestFrameworkPkg.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

* Add unit tests for SafeIntLib class
* Add unit tests for BaseLib Base64 conversion APIs.
* Add Test/MdePkgHostTest.dsc -to build host based unit
  tests
* Update MdePkg.dsc to build target based tests for
  SafeIntLib and BaseLib
* Update MdePkg.ci.yaml to build and run host based
  tests for SafeIntLib and BaseLib

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

* Add unit test of DxeResetSystemLib library
  instance that uses cmocka interfaces to mock the
  UEFI Runtime Services Table and its ResetSystem()
  service.  When a unit test uses the cmocka
  interfaces, the unit test does not support being
  run from target environments.

  cmocka APIs: https://api.cmocka.org/index.html

  This example puts the unit test in a UnitTest
  directory below the library INF file and this location
  means the unit test is only designed to work this
  this one library instance.

* Add Test/MdeModulePkgHostTest.dsc to build host
  based unit tests

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

* Add NOOPT target to MdePkg, MdeModulePkg, and
  UnitTestFrameworkPkg to support building host
  based unit tests with optimization disabled.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

Add maintainers and reviewers for UnitTestFrameworkPkg

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
@mdkinney mdkinney force-pushed the edk2-host-test_v2_mdk_updates_v4 branch from c40976a to 8591822 Compare February 7, 2020 18:00
@mergify mergify bot closed this Feb 7, 2020
@mergify
Copy link

mergify bot commented Feb 7, 2020

All checks passed. Auto close personal build.

@mdkinney mdkinney mentioned this pull request Feb 7, 2020
VivianNK pushed a commit to VivianNK/edk2 that referenced this pull request Apr 5, 2023
…core#315)

# Preface

Please ensure you have read the [contribution
docs](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md) prior
to submitting the pull request. In particular,
[pull request
guidelines](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md#pull-request-best-practices).

## Description

Instead of saving the files to the same file system of unit test
application, this change will save the cache file to the path where the
user ran this test application.

This will also bring parity with where the system will store the final
result in the format of xml.

For each item, place an "x" in between `[` and `]` if true. Example:
`[x]`.
_(you can also check items in the GitHub UI)_

- [x] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

This change was tested on proprietary physical hardware platforms and
ARM FVP platform.

## Integration Instructions

The change should be transparent to end users as the cache files are
transient and internal to the unit tests.
kuqin12 added a commit to kuqin12/edk2 that referenced this pull request Oct 3, 2023
…core#315)

Please ensure you have read the [contribution
docs](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md) prior
to submitting the pull request. In particular,
[pull request
guidelines](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md#pull-request-best-practices).

Instead of saving the files to the same file system of unit test
application, this change will save the cache file to the path where the
user ran this test application.

This will also bring parity with where the system will store the final
result in the format of xml.

For each item, place an "x" in between `[` and `]` if true. Example:
`[x]`.
_(you can also check items in the GitHub UI)_

- [x] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

This change was tested on proprietary physical hardware platforms and
ARM FVP platform.

The change should be transparent to end users as the cache files are
transient and internal to the unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant