public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "duntan" <dun.tan@intel.com>
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>, Ray Ni <ray.ni@intel.com>
Subject: [PATCH 3/3] .azurepipelines: Expand PlatformCI template for Shell UnitTest
Date: Tue, 22 Nov 2022 19:47:37 +0800	[thread overview]
Message-ID: <20221122114737.393-4-dun.tan@intel.com> (raw)
In-Reply-To: <20221122114737.393-1-dun.tan@intel.com>

Expand PlatformCI build and run steps template for Shell
UnitTest. Add a new parameter unit_test_list to support
building and running specific Shell UnitTest modules.

In stuart_pr_eval step, if the unit_test_list passed from
platform yml file is not null, it will select some packages
from the packages which contain the module in unit_test_list
and set them into a new variable pkgs_to_build base on its
evaluation rule.
In stuart_build step, if unit_test_list is not null,
'${{ parameters.unit_test_list}} -p $(pkgs_to_build)' will be
added into the arguments to build specific UnitTest modules in
pkgs_to_build.
In 'Run to shell' step, if unit_test_list is not null, all the
UnitTest modules built in stuart_build step will runs in shell.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
---
 .azurepipelines/templates/platform-build-run-steps.yml | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/.azurepipelines/templates/platform-build-run-steps.yml b/.azurepipelines/templates/platform-build-run-steps.yml
index 40a31a509f..51503287c4 100644
--- a/.azurepipelines/templates/platform-build-run-steps.yml
+++ b/.azurepipelines/templates/platform-build-run-steps.yml
@@ -30,6 +30,9 @@ parameters:
 - name: run_flags
   type: string
   default: ''
+- name: unit_test_list
+  type: string
+  default: ''
 
 - name: extra_install_step
   type: stepList
@@ -49,7 +52,9 @@ steps:
   displayName: 'Install/Upgrade pip modules'
 
 # Set default
-- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
+- bash: |
+    echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"
+    echo "##vso[task.setvariable variable=pkgs_to_build]${{ 'all' }}"
 
 # Fetch the target branch so that pr_eval can diff them.
 # Seems like azure pipelines/github changed checkout process in nov 2020.
@@ -62,7 +67,7 @@ steps:
   displayName: Check if ${{ parameters.build_pkg }} need testing
   inputs:
     filename: stuart_pr_eval
-    arguments: -c ${{ parameters.build_file }} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} --pr-target origin/$(System.PullRequest.targetBranch) --output-count-format-string "##vso[task.setvariable variable=pkg_count;isOutpout=true]{pkgcount}"
+    arguments: -c ${{ parameters.build_file }} -t ${{ parameters.build_target}} -a ${{ parameters.build_arch}} --pr-target origin/$(System.PullRequest.targetBranch) --output-count-format-string "##vso[task.setvariable variable=pkg_count;isOutpout=true]{pkgcount}" --output-csv-format-string "##vso[task.setvariable variable=pkgs_to_build]{pkgcsv}" ${{ parameters.unit_test_list}}
   condition: eq(variables['Build.Reason'], 'PullRequest')
 
  # Setup repo
@@ -97,14 +102,22 @@ steps:
   inputs:
     filename: stuart_build
     arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
-  condition: and(gt(variables.pkg_count, 0), succeeded())
+  condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables.unit_test_list, ''))
+
+# Build specific pkg for UnitTest
+- task: CmdLine@1
+  displayName: Build UnitTest
+  inputs:
+    filename: stuart_build
+    arguments: ${{ parameters.unit_test_list}} -p $(pkgs_to_build) -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}}
+  condition: and(and(gt(variables.pkg_count, 0), succeeded()), not(eq(variables.unit_test_list, '')))
 
 # Run
 - task: CmdLine@1
   displayName: Run to shell
   inputs:
     filename: stuart_build
-    arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} ${{ parameters.run_flags }} --FlashOnly
+    arguments: -c ${{ parameters.build_file }} TOOL_CHAIN_TAG=${{ parameters.tool_chain_tag}} TARGET=${{ parameters.build_target}} -a ${{ parameters.build_arch}} ${{ parameters.build_flags}} ${{ parameters.run_flags }} --FlashOnly ${{ parameters.unit_test_list}}
   condition: and(and(gt(variables.pkg_count, 0), succeeded()), eq(variables['Run'], true))
   timeoutInMinutes: 1
 
-- 
2.31.1.windows.1


  parent reply	other threads:[~2022-11-22 11:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 11:47 [PATCH 0/3] Expand Ovmf PlatformCI to enable CI for Shell UnitTest duntan
2022-11-22 11:47 ` [PATCH 1/3] OvmfPkg/PlatformCI: Expand Ovmf PlatformCI " duntan
2022-11-22 11:47 ` [PATCH 2/3] OvmfPkg/PlatformCI: Add new JOB in .yml of OvmfPkg PlatformCI duntan
2022-11-22 11:47 ` duntan [this message]
     [not found] ` <1729E5AF924ED134.5511@groups.io>
2022-11-28  9:33   ` [edk2-devel] [PATCH 1/3] OvmfPkg/PlatformCI: Expand Ovmf PlatformCI for Shell UnitTest duntan
2022-12-05  3:57     ` duntan
2022-12-09  7:03       ` Yao, Jiewen
     [not found] ` <1729E5B1AD6A86B6.31464@groups.io>
2022-11-28  9:34   ` [edk2-devel] [PATCH 3/3] .azurepipelines: Expand PlatformCI template " duntan
2022-12-05  3:57     ` duntan
2022-12-06  1:23       ` Michael Kubacki
2022-12-06  4:46         ` duntan
2022-12-08  2:57           ` Michael Kubacki
2022-12-08  8:17             ` duntan
2022-12-08 22:37               ` Sean Brogan
2022-12-09  7:01                 ` duntan
     [not found] ` <1729E5B0889AD806.5511@groups.io>
2022-11-28  9:36   ` [edk2-devel] [PATCH 2/3] OvmfPkg/PlatformCI: Add new JOB in .yml of OvmfPkg PlatformCI duntan

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=20221122114737.393-4-dun.tan@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