[edk2-devel] [PATCH] Revert ".pytool/EccCheck: Disable Ecc error code 10014 for open CI"

2020-09-03 Thread Zhang, Shenglei
This reverts commit d4e0b9607c9a64a8eff20724b2e35ea2cd5bd33f.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2951
Previously false positive Ecc issue whose error code is 10014 was reported
under Linux OS. So we disabled it in EccCheck plugin for edk2 open CI.
As the bug is fixed, we need to revert the change and re-enbale it.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
index 3eaad0bf5623..eee1ff7a77b5 100644
--- a/.pytool/Plugin/EccCheck/EccCheck.py
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -301,7 +301,6 @@ class EccCheck(ICiBuildPlugin):
  "10011",
  "10012",
  "10013",
- "10014", #need to be removed after BZ2904 is fixed
  "10015",
  "10016",
  "10017",
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64996): https://edk2.groups.io/g/devel/message/64996
Mute This Topic: https://groups.io/mt/76601437/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 1/1] .pytool/EccCheck: Enable Ecc error code 10014 for open CI

2020-09-02 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2904
As the false positive issue whose error code is 10014 has been
fixed, we need to re-enable it on open CI.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
index 3eaad0bf5623..eee1ff7a77b5 100644
--- a/.pytool/Plugin/EccCheck/EccCheck.py
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -301,7 +301,6 @@ class EccCheck(ICiBuildPlugin):
  "10011",
  "10012",
  "10013",
- "10014", #need to be removed after BZ2904 is fixed
  "10015",
  "10016",
  "10017",
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64962): https://edk2.groups.io/g/devel/message/64962
Mute This Topic: https://groups.io/mt/76578291/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] .pytool/EccCheck: Disable Ecc error code 10014 for open CI

2020-08-21 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2920
Ecc issues whose error code is 10014, can't be correctly handled
under Linux OS, resulting from a bug in Ecc tool.
So we need to disable it before ecc tool is repaired.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
index eee1ff7a77b5..3eaad0bf5623 100644
--- a/.pytool/Plugin/EccCheck/EccCheck.py
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -301,6 +301,7 @@ class EccCheck(ICiBuildPlugin):
  "10011",
  "10012",
  "10013",
+ "10014", #need to be removed after BZ2904 is fixed
  "10015",
  "10016",
  "10017",
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64529): https://edk2.groups.io/g/devel/message/64529
Mute This Topic: https://groups.io/mt/76325475/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v10 02/16] .pytool/Plugin: Add a plugin EccCheck

2020-08-14 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
EccCheck is a plugin to report Ecc issues for code in pull request
, which will be run on open ci.
But note not each kind of issue could be reported out.
It can only handle the issues, whose line number in CSV report
accurately map with their code in source code files. And Ecc issues
about comments can also be handled.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py   | 309 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 3 files changed, 335 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
new file mode 100644
index 00..eee1ff7a77
--- /dev/null
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -0,0 +1,309 @@
+# @file EccCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import shutil
+import re
+import csv
+import xml.dom.minidom
+from typing import List, Dict, Tuple
+import logging
+from io import StringIO
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class EccCheck(ICiBuildPlugin):
+"""
+A CiBuildPlugin that finds the Ecc issues of newly added code in pull 
request.
+
+Configuration options:
+"EccCheck": {
+"ExceptionList": [],
+"IgnoreFiles": []
+},
+"""
+
+ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
+FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
+LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
+LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for efi coding style for " + packagename, packagename + 
".EccCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+edk2_path = Edk2pathObj.WorkspacePath
+python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
+env = shell_environment.GetEnvironment()
+env.set_shell_var('PYTHONPATH', python_path)
+env.set_shell_var('WORKSPACE', edk2_path)
+self.ECC_PASS = True
+self.ApplyConfig(pkgconfig, edk2_path, packagename)
+modify_dir_list = self.GetModifyDir(packagename)
+patch = self.GetDiff(packagename)
+ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
+self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
+ecc_log = os.path.join(edk2_path, "Ecc.log")
+self.RevertCode()
+if self.ECC_PASS:
+tc.SetSuccess()
+self.RemoveFile(ecc_log)
+return 0
+else:
+with open(ecc_log, encoding='utf8') as output:
+ecc_output = output.readlines()
+for line in ecc_output:
+logging.error(line.strip())
+self.RemoveFile(ecc_log)
+tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc 
detected issues")
+return 1
+
+def RevertCode(self) -> None:
+submoudle_params = "submodule update --init"
+RunCmd("git", submoudle_params)
+reset_params = "reset HEAD --hard"
+RunCmd("git", reset_params)
+
+def GetDiff(self, pkg: str) -> List[str]:
+return_buffer = StringIO()
+params = "diff 

[edk2-devel] [PATCH v10 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-08-14 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
As planed we will enable Ecc check for edk2 on open ci. And they are ready now. 
I appreciate receiving feedback and comments if someone find errors or false 
positive issues.

I created a pipline of EccCheck for my forked edk2. Welcome everyone to create 
pull request to test the quality of this plugin.
My forked tree: https://github.com/shenglei10/edk2

And I also created some test cases for ECC plugin. Below are test cases.
https://github.com/shenglei10/edk2/tree/ECC
Results can be view in below azure server.
https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12&_a=summary

Patches
1/16: It's a lib necessary for py3 to run Ecc on azure servers.

2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
 on azure servers for open ci, or a local virtual environment.

3/16~16/16: We consider some cases that will report out Ecc issues but they 
won't
 be fixed, like submodule and industry standard related things. So we
 add two configuration fields "Exception" and "IgnoreFiles" for people
 to use. These patches add configuration in yaml files for Ecc check.

Cc: Bob Feng 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 

v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.

v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
Update 2/17, designate the version of antlr4 is 4.7.1.
Add 4/17~17/17.

v4. Update 1/17, remove the function EdksetupRebuild(), instead add
function SetupEnvironment(). Update variables' format and type hints
to pass flake8 and mypy.

v5. Conver the former method to plugin solution, to align with
other check points on open ci.

v6. The 1/16 patch is missed in v5 series. Now add it in v6.

v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.

v8. Enable error code config section to ignore certain kinds of issues,
which are always false positive in partial Ecc scaning.
All patches except 2/16 have been R-B and are not updated in v8 series.
To avoid making noise in community, I only send cover letter and 2/16 patch.

v9. Update 2/16, 3/16, 5/16 and 16/16.
1. Enable directory path for "IgnoreFiles" section in xxxPkg.yaml. So that
   users can skip a certain directory and don't need to fill in with file 
names.
2. Add submodule pathes in "IgnoreFiles" in MdeModulePkg.ci.yaml,
   CryptoPkg.ci.yaml and UnitTestFrameworkPkg.ci.yaml.

v10. Update 2/16 patch, adding a step to revert code when ecc plugin ends.
 All patches except 2/16 have been R-B and are not updated in v10 series.
 To avoid making noise in community, I only send cover letter and 2/16 
patch.

Shenglei Zhang (16):
  pip-requirements.txt: Add Ecc required lib
  .pytool/Plugin: Add a plugin EccCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
  FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
  MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
  ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
  UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

 .pytool/Plugin/EccCheck/EccCheck.py   | 309 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 ArmVirtPkg/ArmVirtPkg.ci.yaml |  12 +
 CryptoPkg/CryptoPkg.ci.yaml   |  13 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |  12 +
 FatPkg/FatPkg.ci.yaml |  12 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |  12 +
 MdeModulePkg/MdeModulePkg.ci.yaml |  14 +
 MdePkg/MdePkg.ci.yaml |  12 +
 NetworkPkg/NetworkPkg.ci.yaml |  12 +
 OvmfPkg/OvmfPkg.ci.yaml   |  12 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |  13 +
 SecurityPkg/SecurityPkg.ci.yaml   |  12 +
 ShellPkg/ShellPkg.ci.yaml |  12 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |  12 +
 .../UnitTestFrameworkPkg.ci.yaml  |  12 +
 pip-requirements.txt  |   1 +
 18 files changed, 508 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 

Re: [edk2-devel] [PATCH v9 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-08-11 Thread Zhang, Shenglei
Hi Laszlo,

Sorry for that. I removed it by mistake. I'll re-add it into the patch.

Thanks,
Shenglei

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Laszlo
> Ersek
> Sent: Tuesday, August 11, 2020 11:36 PM
> To: devel@edk2.groups.io; Zhang, Shenglei 
> Cc: Feng, Bob C ; Bret Barkelew
> ; Kinney, Michael D
> ; Gao, Liming ; Sean
> Brogan ; Ard Biesheuvel (ARM address)
> 
> Subject: Re: [edk2-devel] [PATCH v9 00/16] Add a plugin to check Ecc issues
> for edk2 on open ci
> 
> Hello Shenglei,
> 
> (+Ard)
> 
> On 08/11/20 09:01, Zhang, Shenglei wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
> > As planed we will enable Ecc check for edk2 on open ci. And they are
> > ready now. I appreciate receiving feedback and comments if someone
> > find errors or false positive issues.
> >
> > I created a pipline of EccCheck for my forked edk2. Welcome everyone to
> > create pull request to test the quality of this plugin.
> > My forked tree: https://github.com/shenglei10/edk2
> >
> > And I also created some test cases for ECC plugin. Below are test cases.
> > https://github.com/shenglei10/edk2/tree/ECC
> > Results can be view in below azure server.
> >
> https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12
> &_a=summary
> >
> > Patches
> > 1/16: It's a lib necessary for py3 to run Ecc on azure servers.
> >
> > 2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be 
> > run
> >  on azure servers for open ci, or a local virtual environment.
> >
> > 3/16~16/16: We consider some cases that will report out Ecc issues but they
> won't
> >  be fixed, like submodule and industry standard related things. So we
> >  add two configuration fields "Exception" and "IgnoreFiles" for people
> >  to use. These patches add configuration in yaml files for Ecc check.
> >
> > Cc: Bob Feng 
> > Cc: Bret Barkelew 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Sean Brogan 
> >
> > v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.
> >
> > v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
> > Update 2/17, designate the version of antlr4 is 4.7.1.
> > Add 4/17~17/17.
> >
> > v4. Update 1/17, remove the function EdksetupRebuild(), instead add
> > function SetupEnvironment(). Update variables' format and type hints
> > to pass flake8 and mypy.
> >
> > v5. Conver the former method to plugin solution, to align with
> > other check points on open ci.
> >
> > v6. The 1/16 patch is missed in v5 series. Now add it in v6.
> >
> > v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.
> >
> > v8. Enable error code config section to ignore certain kinds of issues,
> > which are always false positive in partial Ecc scaning.
> > All patches except 2/16 have been R-B and are not updated in v8 series.
> > To avoid making noise in community, I only send cover letter and 2/16
> patch.
> 
> 2/16: ".pytool/Plugin: Add a plugin EccCheck"
> 
> >
> > v9. Update 2/16, 3/16, 5/16 and 16/16.
> 
> 2/16: ".pytool/Plugin: Add a plugin EccCheck"
> 3/16: "MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc
> check"
> 5/16: "CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check"
> 16/16: "UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file"
> 
> So no changes to the ArmVirtPkg and OvmfPkg patches since v7.
> 
> In v7, my Acked-by was present on both patches 04/16
> ("ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check"):
> 
>   http://mid.mail-archive.com/20200706084846.12748-5-
> shenglei.zh...@intel.com
>   https://edk2.groups.io/g/devel/message/62075
> 
> and 11/16 ("OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check"):
> 
>   http://mid.mail-archive.com/20200706084846.12748-12-
> shenglei.zh...@intel.com
>   https://edk2.groups.io/g/devel/message/62082
> 
> Why did you drop my A-b from the ArmVirtPkg patch in v9?
> 
> Thanks,
> Laszlo
> 
> > 1. Enable directory path for "IgnoreFiles" section in xxxPkg.yaml. So 
> > that
> >users can skip a certain directory and don't need to fill in with 
> > file names.
> > 2. Add submodule pathes in "IgnoreFiles" in MdeModulePkg.ci.yaml,
> >CryptoPkg.ci.yaml and UnitTestFrameworkPkg.ci.yaml.
> >
> > Shenglei Zhang (16):
&g

[edk2-devel] [PATCH v9 08/16] FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Liming Gao 
Cc: Michael D Kinney 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
Reviewed-by: Liming Gao 
---
 FmpDevicePkg/FmpDevicePkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/FmpDevicePkg/FmpDevicePkg.ci.yaml 
b/FmpDevicePkg/FmpDevicePkg.ci.yaml
index d498ad7d21e1..1b3e2187356d 100644
--- a/FmpDevicePkg/FmpDevicePkg.ci.yaml
+++ b/FmpDevicePkg/FmpDevicePkg.ci.yaml
@@ -2,12 +2,24 @@
 # CI configuration for FmpDevicePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "FmpDevicePkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63963): https://edk2.groups.io/g/devel/message/63963
Mute This Topic: https://groups.io/mt/76121689/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 02/16] .pytool/Plugin: Add a plugin EccCheck

2020-08-11 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
EccCheck is a plugin to report Ecc issues for code in pull request
, which will be run on open ci.
But note not each kind of issue could be reported out.
It can only handle the issues, whose line number in CSV report
accurately map with their code in source code files. And Ecc issues
about comments can also be handled.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py   | 302 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 3 files changed, 328 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
new file mode 100644
index ..249a16a7dddf
--- /dev/null
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -0,0 +1,302 @@
+# @file EccCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import shutil
+import re
+import csv
+import xml.dom.minidom
+from typing import List, Dict, Tuple
+import logging
+from io import StringIO
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class EccCheck(ICiBuildPlugin):
+"""
+A CiBuildPlugin that finds the Ecc issues of newly added code in pull 
request.
+
+Configuration options:
+"EccCheck": {
+"ExceptionList": [],
+"IgnoreFiles": []
+},
+"""
+
+ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
+FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
+LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
+LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for efi coding style for " + packagename, packagename + 
".EccCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+edk2_path = Edk2pathObj.WorkspacePath
+python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
+env = shell_environment.GetEnvironment()
+env.set_shell_var('PYTHONPATH', python_path)
+env.set_shell_var('WORKSPACE', edk2_path)
+self.ECC_PASS = True
+self.ApplyConfig(pkgconfig, edk2_path, packagename)
+modify_dir_list = self.GetModifyDir(packagename)
+patch = self.GetDiff(packagename)
+ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
+self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
+ecc_log = os.path.join(edk2_path, "Ecc.log")
+if self.ECC_PASS:
+tc.SetSuccess()
+self.RemoveFile(ecc_log)
+return 0
+else:
+with open(ecc_log, encoding='utf8') as output:
+ecc_output = output.readlines()
+for line in ecc_output:
+logging.error(line.strip())
+self.RemoveFile(ecc_log)
+tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc 
detected issues")
+return 1
+
+def GetDiff(self, pkg: str) -> List[str]:
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+return patch
+
+def 

[edk2-devel] [PATCH v9 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-08-11 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
As planed we will enable Ecc check for edk2 on open ci. And they are
ready now. I appreciate receiving feedback and comments if someone
find errors or false positive issues.

I created a pipline of EccCheck for my forked edk2. Welcome everyone to
create pull request to test the quality of this plugin.
My forked tree: https://github.com/shenglei10/edk2

And I also created some test cases for ECC plugin. Below are test cases.
https://github.com/shenglei10/edk2/tree/ECC
Results can be view in below azure server.
https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12&_a=summary

Patches
1/16: It's a lib necessary for py3 to run Ecc on azure servers.

2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
 on azure servers for open ci, or a local virtual environment.

3/16~16/16: We consider some cases that will report out Ecc issues but they 
won't
 be fixed, like submodule and industry standard related things. So we
 add two configuration fields "Exception" and "IgnoreFiles" for people
 to use. These patches add configuration in yaml files for Ecc check.

Cc: Bob Feng 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 

v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.

v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
Update 2/17, designate the version of antlr4 is 4.7.1.
Add 4/17~17/17.

v4. Update 1/17, remove the function EdksetupRebuild(), instead add
function SetupEnvironment(). Update variables' format and type hints
to pass flake8 and mypy.

v5. Conver the former method to plugin solution, to align with
other check points on open ci.

v6. The 1/16 patch is missed in v5 series. Now add it in v6.

v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.

v8. Enable error code config section to ignore certain kinds of issues,
which are always false positive in partial Ecc scaning.
All patches except 2/16 have been R-B and are not updated in v8 series.
To avoid making noise in community, I only send cover letter and 2/16 patch.

v9. Update 2/16, 3/16, 5/16 and 16/16.
1. Enable directory path for "IgnoreFiles" section in xxxPkg.yaml. So that
   users can skip a certain directory and don't need to fill in with file 
names.
2. Add submodule pathes in "IgnoreFiles" in MdeModulePkg.ci.yaml,
   CryptoPkg.ci.yaml and UnitTestFrameworkPkg.ci.yaml.

Shenglei Zhang (16):
  pip-requirements.txt: Add Ecc required lib
  .pytool/Plugin: Add a plugin EccCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
  FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
  MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
  ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
  UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

 .pytool/Plugin/EccCheck/EccCheck.py   | 302 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 ArmVirtPkg/ArmVirtPkg.ci.yaml |  11 +
 CryptoPkg/CryptoPkg.ci.yaml   |  13 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |  11 +
 FatPkg/FatPkg.ci.yaml |  12 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |  12 +
 MdeModulePkg/MdeModulePkg.ci.yaml |  13 +
 MdePkg/MdePkg.ci.yaml |  11 +
 NetworkPkg/NetworkPkg.ci.yaml |  12 +
 OvmfPkg/OvmfPkg.ci.yaml   |  11 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |  12 +
 SecurityPkg/SecurityPkg.ci.yaml   |  12 +
 ShellPkg/ShellPkg.ci.yaml |  12 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |  12 +
 .../UnitTestFrameworkPkg.ci.yaml  |  11 +
 pip-requirements.txt  |   1 +
 18 files changed, 494 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63955): https://edk2.groups.io/g/devel/message/63955
Mute This Topic: 

[edk2-devel] [PATCH v9 03/16] MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.
Besides, add submodule path in IgnoreFiles section.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/MdeModulePkg.ci.yaml | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml 
b/MdeModulePkg/MdeModulePkg.ci.yaml
index 0fc8c3633878..1a7e955185d8 100644
--- a/MdeModulePkg/MdeModulePkg.ci.yaml
+++ b/MdeModulePkg/MdeModulePkg.ci.yaml
@@ -2,6 +2,7 @@
 # CI configuration for MdeModulePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
@@ -9,6 +10,19 @@
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+"Library/BrotliCustomDecompressLib/brotli",
+"Universal/RegularExpressionDxe/oniguruma"
+]
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdeModulePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63958): https://edk2.groups.io/g/devel/message/63958
Mute This Topic: https://groups.io/mt/76121682/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 07/16] FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
Reviewed-by: Liming Gao 
---
 FatPkg/FatPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/FatPkg/FatPkg.ci.yaml b/FatPkg/FatPkg.ci.yaml
index 489c4614e9e1..fe95f481b50c 100644
--- a/FatPkg/FatPkg.ci.yaml
+++ b/FatPkg/FatPkg.ci.yaml
@@ -2,12 +2,24 @@
 # CI configuration for FatPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "FatPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63962): https://edk2.groups.io/g/devel/message/63962
Mute This Topic: https://groups.io/mt/76121688/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 05/16] CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.
Besides, add submodule path in IgnoreFiles section.

Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Signed-off-by: Shenglei Zhang 
---
 CryptoPkg/CryptoPkg.ci.yaml | 13 +
 1 file changed, 13 insertions(+)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index e73b79e01fef..e2d190a90c51 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -2,12 +2,25 @@
 # CI configuration for CryptoPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+"Library/OpensslLib/openssl"
+]
+},
 "CompilerPlugin": {
 "DscPath": "CryptoPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63960): https://edk2.groups.io/g/devel/message/63960
Mute This Topic: https://groups.io/mt/76121684/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 09/16] MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Liming Gao 
---
 MdePkg/MdePkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index b088a4344908..15931eaccabf 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -2,6 +2,7 @@
 # CI configuration for MdePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
@@ -9,6 +10,17 @@
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63964): https://edk2.groups.io/g/devel/message/63964
Mute This Topic: https://groups.io/mt/76121690/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 14/16] ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
Reviewed-by: Liming Gao 
---
 ShellPkg/ShellPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/ShellPkg/ShellPkg.ci.yaml b/ShellPkg/ShellPkg.ci.yaml
index 565e08596b2f..30894d44bc3a 100644
--- a/ShellPkg/ShellPkg.ci.yaml
+++ b/ShellPkg/ShellPkg.ci.yaml
@@ -2,12 +2,24 @@
 # CI configuration for ShellPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "ShellPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63969): https://edk2.groups.io/g/devel/message/63969
Mute This Topic: https://groups.io/mt/76121698/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 16/16] UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.
Besides, add submodule path in IgnoreFiles section.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Signed-off-by: Shenglei Zhang 
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml 
b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
index fc5b3b387664..9e9ffc1af113 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
@@ -9,6 +9,18 @@
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+"Library/CmockaLib/cmocka"
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "UnitTestFrameworkPkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63971): https://edk2.groups.io/g/devel/message/63971
Mute This Topic: https://groups.io/mt/76121700/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 13/16] SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Chao Zhang 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Jian J Wang 
Reviewed-by: Liming Gao 
---
 SecurityPkg/SecurityPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml
index 1ef1d2e67ead..03be2e94ca97 100644
--- a/SecurityPkg/SecurityPkg.ci.yaml
+++ b/SecurityPkg/SecurityPkg.ci.yaml
@@ -2,12 +2,24 @@
 # CI configuration for SecurityPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "SecurityPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63968): https://edk2.groups.io/g/devel/message/63968
Mute This Topic: https://groups.io/mt/76121697/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 12/16] PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
Reviewed-by: Liming Gao 
---
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml | 13 +
 1 file changed, 13 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml 
b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
index 5543d15c3248..61f3fd7b5074 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
@@ -2,12 +2,25 @@
 # CI configuration for PcAtChipsetPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "PcAtChipsetPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63967): https://edk2.groups.io/g/devel/message/63967
Mute This Topic: https://groups.io/mt/76121695/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 10/16] NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Maciej Rabeda 
Reviewed-by: Liming Gao 
---
 NetworkPkg/NetworkPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/NetworkPkg.ci.yaml b/NetworkPkg/NetworkPkg.ci.yaml
index aa536830fc27..1a3ab71792d1 100644
--- a/NetworkPkg/NetworkPkg.ci.yaml
+++ b/NetworkPkg/NetworkPkg.ci.yaml
@@ -2,12 +2,24 @@
 # CI configuration for NetworkPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "NetworkPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63965): https://edk2.groups.io/g/devel/message/63965
Mute This Topic: https://groups.io/mt/76121691/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 01/16] pip-requirements.txt: Add Ecc required lib

2020-08-11 Thread Zhang, Shenglei
antlr4-python3-runtime is a lib to support Ecc run with Py3.x.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Liming Gao 
---
 pip-requirements.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pip-requirements.txt b/pip-requirements.txt
index 574dac43b1a6..0fecd37f2a83 100644
--- a/pip-requirements.txt
+++ b/pip-requirements.txt
@@ -14,3 +14,4 @@
 
 edk2-pytool-library==0.10.*
 edk2-pytool-extensions~=0.13.3
+antlr4-python3-runtime==4.7.1
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63956): https://edk2.groups.io/g/devel/message/63956
Mute This Topic: https://groups.io/mt/76121680/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 15/16] UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
Reviewed-by: Eric Dong 
Acked-by: Laszlo Ersek 
Reviewed-by: Liming Gao 
---
 UefiCpuPkg/UefiCpuPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.ci.yaml b/UefiCpuPkg/UefiCpuPkg.ci.yaml
index d54651d43800..48ab710438a9 100644
--- a/UefiCpuPkg/UefiCpuPkg.ci.yaml
+++ b/UefiCpuPkg/UefiCpuPkg.ci.yaml
@@ -2,12 +2,24 @@
 # CI configuration for UefiCpuPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "UefiCpuPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63970): https://edk2.groups.io/g/devel/message/63970
Mute This Topic: https://groups.io/mt/76121699/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 06/16] EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
Reviewed-by: Liming Gao 
---
 EmulatorPkg/EmulatorPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
index dead82f69745..980844c1fdd4 100644
--- a/EmulatorPkg/EmulatorPkg.ci.yaml
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -5,6 +5,7 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
@@ -12,6 +13,17 @@
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63961): https://edk2.groups.io/g/devel/message/63961
Mute This Topic: https://groups.io/mt/76121685/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 11/16] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Shenglei Zhang 
Acked-by: Laszlo Ersek 
Reviewed-by: Liming Gao 
---
 OvmfPkg/OvmfPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
index ed342d7a3d08..3128aefe9ed1 100644
--- a/OvmfPkg/OvmfPkg.ci.yaml
+++ b/OvmfPkg/OvmfPkg.ci.yaml
@@ -5,6 +5,7 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
@@ -12,6 +13,17 @@
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63966): https://edk2.groups.io/g/devel/message/63966
Mute This Topic: https://groups.io/mt/76121694/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v9 04/16] ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check

2020-08-11 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Liming Gao 
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 12 
 1 file changed, 12 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
index 27bb7ff49011..8b2c0305c175 100644
--- a/ArmVirtPkg/ArmVirtPkg.ci.yaml
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -5,6 +5,7 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
@@ -12,6 +13,17 @@
 "LicenseCheck": {
 "IgnoreFiles": []
 },
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+## Both file path and directory path are accepted.
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63959): https://edk2.groups.io/g/devel/message/63959
Mute This Topic: https://groups.io/mt/76121683/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] Meet failure when running open ci env locally

2020-08-09 Thread Zhang, Shenglei
Thanks, Sean. That works.

> -Original Message-
> From: Sean Brogan 
> Sent: Friday, August 7, 2020 11:35 PM
> To: devel@edk2.groups.io; Zhang, Shenglei ;
> Sean Brogan ; Bret Barkelew
> 
> Cc: Kinney, Michael D ; Gao, Liming
> 
> Subject: Re: [edk2-devel] Meet failure when running open ci env locally
> 
> Two issues.
> 
> 1. The tool is saying that your repository is out of date for
> dependencies and you must run stuart_update to pull the required
> dependencies.  To do an update you need to run stuart_update -c
> .pytool/CISettings.py 
> 
> 2. You have TOOL_CHAIN_TAG=NO-TARGET.  NO-TARGET is the target which
> can
> be set by doing -t NO-TARGET.
> 
> 
> Please look here for details.
> https://github.com/tianocore/edk2/tree/master/.pytool#running-ci
> 
> Hope that helps.
> Thanks
> Sean
> 
> 
> 
> On 8/7/2020 1:26 AM, Zhang, Shenglei wrote:
> > ci_build -c .pytool/CISettings.py TOOL_CHAIN_TAG=NO-TARGET

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63896): https://edk2.groups.io/g/devel/message/63896
Mute This Topic: https://groups.io/mt/76045196/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] Meet failure when running open ci env locally

2020-08-07 Thread Zhang, Shenglei
Hi folks,

I met a failure when I tried running a ci plugin locally. Does anybody know how 
to deal with it?
Command and build log are listed below.

cmd: stuart_ci_build -c .pytool/CISettings.py TOOL_CHAIN_TAG=NO-TARGET

build log:
SECTION - Init SDE
ERROR - Dependency 'mu_nasm' is not met!
ERROR - Dependency 'iasl' is not met!
Traceback (most recent call last):
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File 
"C:\code\AllPkg\pytool-ext-venv\Scripts\stuart_ci_build.exe\__main__.py", line 
9, in 
  File 
"c:\code\allpkg\pytool-ext-venv\lib\site-packages\edk2toolext\invocables\edk2_ci_build.py",
 line 246, in main
Edk2CiBuild().Invoke()
  File 
"c:\code\allpkg\pytool-ext-venv\lib\site-packages\edk2toolext\base_abstract_invocable.py",
 line 122, in Invoke
raise RuntimeError("SDE is not current.  Please update your env before 
running this tool.")
RuntimeError: SDE is not current.  Please update your env before running this 
tool.

Thanks,
Shenglei

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63819): https://edk2.groups.io/g/devel/message/63819
Mute This Topic: https://groups.io/mt/76045196/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 1/2] MdePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES

2020-08-05 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2777
Code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES is deprecated.
So remove it.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Library/BaseLib/String.c| 626 -
 MdePkg/Library/BasePcdLibNull/PcdLib.c | 361 --
 MdePkg/Library/BasePrintLib/PrintLib.c | 118 -
 MdePkg/Library/DxePcdLib/DxePcdLib.c   | 399 
 MdePkg/Library/PeiPcdLib/PeiPcdLib.c   | 397 
 MdePkg/Library/UefiLib/UefiLib.c   |  92 
 MdePkg/Include/Library/BaseLib.h   | 409 
 MdePkg/Include/Library/PcdLib.h| 520 
 MdePkg/Include/Library/PrintLib.h  | 110 -
 MdePkg/Include/Library/UefiLib.h   |  53 ---
 MdePkg/MdePkg.dsc  |   1 -
 11 files changed, 3086 deletions(-)

diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c
index 45198373f25c..f4854f357e3a 100644
--- a/MdePkg/Library/BaseLib/String.c
+++ b/MdePkg/Library/BaseLib/String.c
@@ -8,135 +8,6 @@
 
 #include "BaseLibInternals.h"
 
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/**
-  [ATTENTION] This function will be deprecated for security reason.
-
-  Copies one Null-terminated Unicode string to another Null-terminated Unicode
-  string and returns the new Unicode string.
-
-  This function copies the contents of the Unicode string Source to the Unicode
-  string Destination, and returns Destination. If Source and Destination
-  overlap, then the results are undefined.
-
-  If Destination is NULL, then ASSERT().
-  If Destination is not aligned on a 16-bit boundary, then ASSERT().
-  If Source is NULL, then ASSERT().
-  If Source is not aligned on a 16-bit boundary, then ASSERT().
-  If Source and Destination overlap, then ASSERT().
-  If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
-  PcdMaximumUnicodeStringLength Unicode characters, not including the
-  Null-terminator, then ASSERT().
-
-  @param  Destination A pointer to a Null-terminated Unicode string.
-  @param  Source  A pointer to a Null-terminated Unicode string.
-
-  @return Destination.
-
-**/
-CHAR16 *
-EFIAPI
-StrCpy (
-  OUT CHAR16*Destination,
-  IN  CONST CHAR16  *Source
-  )
-{
-  CHAR16*ReturnValue;
-
-  //
-  // Destination cannot be NULL
-  //
-  ASSERT (Destination != NULL);
-  ASSERT (((UINTN) Destination & BIT0) == 0);
-
-  //
-  // Destination and source cannot overlap
-  //
-  ASSERT ((UINTN)(Destination - Source) > StrLen (Source));
-  ASSERT ((UINTN)(Source - Destination) > StrLen (Source));
-
-  ReturnValue = Destination;
-  while (*Source != 0) {
-*(Destination++) = *(Source++);
-  }
-  *Destination = 0;
-  return ReturnValue;
-}
-
-/**
-  [ATTENTION] This function will be deprecated for security reason.
-
-  Copies up to a specified length from one Null-terminated Unicode string  to
-  another Null-terminated Unicode string and returns the new Unicode string.
-
-  This function copies the contents of the Unicode string Source to the Unicode
-  string Destination, and returns Destination. At most, Length Unicode
-  characters are copied from Source to Destination. If Length is 0, then
-  Destination is returned unmodified. If Length is greater that the number of
-  Unicode characters in Source, then Destination is padded with Null Unicode
-  characters. If Source and Destination overlap, then the results are
-  undefined.
-
-  If Length > 0 and Destination is NULL, then ASSERT().
-  If Length > 0 and Destination is not aligned on a 16-bit boundary, then 
ASSERT().
-  If Length > 0 and Source is NULL, then ASSERT().
-  If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
-  If Source and Destination overlap, then ASSERT().
-  If PcdMaximumUnicodeStringLength is not zero, and Length is greater than
-  PcdMaximumUnicodeStringLength, then ASSERT().
-  If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
-  PcdMaximumUnicodeStringLength Unicode characters, not including the 
Null-terminator,
-  then ASSERT().
-
-  @param  Destination A pointer to a Null-terminated Unicode string.
-  @param  Source  A pointer to a Null-terminated Unicode string.
-  @param  Length  The maximum number of Unicode characters to copy.
-
-  @return Destination.
-
-**/
-CHAR16 *
-EFIAPI
-StrnCpy (
-  OUT CHAR16*Destination,
-  IN  CONST CHAR16  *Source,
-  IN  UINTN Length
-  )
-{
-  CHAR16*ReturnValue;
-
-  if (Length == 0) {
-return Destination;
-  }
-
-  //
-  // Destination cannot be NULL if Length is not zero
-  //
-  ASSERT (Destination != NULL);
-  ASSERT (((UINTN) Destination & BIT0) == 0);
-
-  //
-  // Destination and source cannot overlap
-  //
-  ASSERT ((UINTN)(Destination - Source) > StrLen (Source));

[edk2-devel] [PATCH 0/2] Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES

2020-08-05 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2777
Code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES is deprecated.
So remove it from MdePkg and MdeModulePkg.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Michael D Kinney 
Cc: Liming Gao 
Shenglei Zhang (2):
  MdePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES
  MdeModulePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES

 .../DxePrintLibPrint2Protocol/PrintLib.c  | 145 
 MdeModulePkg/Universal/PrintDxe/Print.c   |  37 +-
 MdePkg/Library/BaseLib/String.c   | 626 --
 MdePkg/Library/BasePcdLibNull/PcdLib.c| 361 --
 MdePkg/Library/BasePrintLib/PrintLib.c| 118 
 MdePkg/Library/DxePcdLib/DxePcdLib.c  | 399 ---
 MdePkg/Library/PeiPcdLib/PeiPcdLib.c  | 397 ---
 MdePkg/Library/UefiLib/UefiLib.c  |  92 ---
 MdeModulePkg/MdeModulePkg.dsc |   1 -
 MdePkg/Include/Library/BaseLib.h  | 409 
 MdePkg/Include/Library/PcdLib.h   | 520 ---
 MdePkg/Include/Library/PrintLib.h | 110 ---
 MdePkg/Include/Library/UefiLib.h  |  53 --
 MdePkg/MdePkg.dsc |   1 -
 14 files changed, 6 insertions(+), 3263 deletions(-)

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63717): https://edk2.groups.io/g/devel/message/63717
Mute This Topic: https://groups.io/mt/76002480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 2/2] MdeModulePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES

2020-08-05 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2777
Code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES is deprecated.
So remove it.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 .../DxePrintLibPrint2Protocol/PrintLib.c  | 145 --
 MdeModulePkg/Universal/PrintDxe/Print.c   |  37 +
 MdeModulePkg/MdeModulePkg.dsc |   1 -
 3 files changed, 6 insertions(+), 177 deletions(-)

diff --git a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c 
b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
index 3a051fd58003..edd6572578dd 100644
--- a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
+++ b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c
@@ -592,79 +592,6 @@ UnicodeSPrintAsciiFormat (
   return NumberOfPrinted;
 }
 
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/**
-  [ATTENTION] This function is deprecated for security reason.
-
-  Converts a decimal value to a Null-terminated Unicode string.
-
-  Converts the decimal number specified by Value to a Null-terminated Unicode
-  string specified by Buffer containing at most Width characters. No padding 
of spaces
-  is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is 
assumed.
-  The number of Unicode characters in Buffer is returned not including the 
Null-terminator.
-  If the conversion contains more than Width characters, then only the first
-  Width characters are returned, and the total number of characters
-  required to perform the conversion is returned.
-  Additional conversion parameters are specified in Flags.
-
-  The Flags bit LEFT_JUSTIFY is always ignored.
-  All conversions are left justified in Buffer.
-  If Width is 0, PREFIX_ZERO is ignored in Flags.
-  If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and 
commas
-  are inserted every 3rd digit starting from the right.
-  If RADIX_HEX is set in Flags, then the output buffer will be
-  formatted in hexadecimal format.
-  If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character 
in Buffer is a '-'.
-  If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
-  then Buffer is padded with '0' characters so the combination of the optional 
'-'
-  sign character, '0' characters, digit characters for Value, and the 
Null-terminator
-  add up to Width characters.
-  If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
-  If Buffer is NULL, then ASSERT().
-  If Buffer is not aligned on a 16-bit boundary, then ASSERT().
-  If unsupported bits are set in Flags, then ASSERT().
-  If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
-  If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
-
-  @param  Buffer  Pointer to the output buffer for the produced Null-terminated
-  Unicode string.
-  @param  Flags   The bitmask of flags that specify left justification, zero 
pad, and commas.
-  @param  Value   The 64-bit signed value to convert to a string.
-  @param  Width   The maximum number of Unicode characters to place in Buffer, 
not including
-  the Null-terminator.
-
-  @return The number of Unicode characters in Buffer not including the 
Null-terminator.
-
-**/
-UINTN
-EFIAPI
-UnicodeValueToString (
-  IN OUT CHAR16  *Buffer,
-  IN UINTN   Flags,
-  IN INT64   Value,
-  IN UINTN   Width
-  )
-{
-  RETURN_STATUS  Status;
-  UINTN  BufferSize;
-
-  if (Width == 0) {
-BufferSize = (MAXIMUM_VALUE_CHARACTERS + 1) * sizeof (CHAR16);
-  } else {
-BufferSize = (Width + 1) * sizeof (CHAR16);
-  }
-
-  Status = mPrint2SProtocol->UnicodeValueToStringS (Buffer, BufferSize, Flags, 
Value, Width);
-  if (RETURN_ERROR (Status)) {
-return 0;
-  }
-
-  return StrnLenS (Buffer, BufferSize / sizeof (CHAR16));
-}
-
-#endif
-
 /**
   Converts a decimal value to a Null-terminated Unicode string.
 
@@ -1071,78 +998,6 @@ AsciiSPrintUnicodeFormat (
 }
 
 
-#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
-
-/**
-  [ATTENTION] This function is deprecated for security reason.
-
-  Converts a decimal value to a Null-terminated ASCII string.
-
-  Converts the decimal number specified by Value to a Null-terminated ASCII 
string
-  specified by Buffer containing at most Width characters. No padding of spaces
-  is ever performed.
-  If Width is 0 then a width of  MAXIMUM_VALUE_CHARACTERS is assumed.
-  The number of ASCII characters in Buffer is returned not including the 
Null-terminator.
-  If the conversion contains more than Width characters, then only the first 
Width
-  characters are returned, and the total number of characters required to 
perform
-  the conversion is returned.
-  Additional conversion parameters are specified in Flags.
-  The Flags bit LEFT_JUSTIFY is always ignored.
-  All conversions are left justified in Buffer.
-  If Width is 0, PREFIX_ZERO is ignored in Flags.
-  If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and 
commas
-  are 

Re: [edk2-devel] [PATCH v2 01/15] .pytool/Plugin: Add a plugin LicenseCheck

2020-07-29 Thread Zhang, Shenglei



> -Original Message-
> From: Gao, Liming 
> Sent: Wednesday, July 29, 2020 10:02 PM
> To: Zhang, Shenglei ; devel@edk2.groups.io
> Cc: Sean Brogan ; Bret Barkelew
> ; Kinney, Michael D
> 
> Subject: RE: [PATCH v2 01/15] .pytool/Plugin: Add a plugin LicenseCheck
> 
> Shenglei:
> 
> > -----Original Message-
> > From: Zhang, Shenglei 
> > Sent: Wednesday, July 29, 2020 8:28 PM
> > To: devel@edk2.groups.io
> > Cc: Sean Brogan ; Bret Barkelew
> ; Kinney, Michael D
> > ; Gao, Liming 
> > Subject: [PATCH v2 01/15] .pytool/Plugin: Add a plugin LicenseCheck
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
> > Add a plugin to check license conflict for new added
> > files in a patch. It will report out errors when meeting
> > files which are now contributed under BSD-2-Clause-Patent.
> 
> files which are now contributed under BSD-2-Clause-Patent.
> ==>
> files which are not contributed under BSD-2-Clause-Patent.
> 

Yes. It's typo.

Thanks,
Shenglei

> Thanks
> Liming
> >
> > Cc: Sean Brogan 
> > Cc: Bret Barkelew 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Signed-off-by: Shenglei Zhang 
> > ---
> >  .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 115
> ++
> >  .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
> >  .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
> >  3 files changed, 143 insertions(+)
> >  create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck.py
> >  create mode
> 100644 .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
> >  create mode 100644 .pytool/Plugin/LicenseCheck/Readme.md
> >
> > diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py
> b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
> > new file mode 100644
> > index ..5733f7bf4ec0
> > --- /dev/null
> > +++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
> > @@ -0,0 +1,115 @@
> > +# @file LicenseCheck.py
> > +#
> > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
> > +# SPDX-License-Identifier: BSD-2-Clause-Patent
> > +##
> > +
> > +import os
> > +import logging
> > +import re
> > +from io import StringIO
> > +from typing import List, Tuple
> > +from edk2toolext.environment.plugintypes.ci_build_plugin import
> ICiBuildPlugin
> > +from edk2toolext.environment.var_dict import VarDict
> > +from edk2toollib.utility_functions import RunCmd
> > +
> > +
> > +class LicenseCheck(ICiBuildPlugin):
> > +
> > +"""
> > +A CiBuildPlugin to check the license for new added files.
> > +
> > +Configuration options:
> > +"LicenseCheck": {
> > +"IgnoreFiles": []
> > +},
> > +"""
> > +
> > +license_format_preflix = 'SPDX-License-Identifier'
> > +
> > +bsd2_patent = 'BSD-2-Clause-Patent'
> > +
> > +Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)')
> > +
> > +file_extension_list = [".c", ".h", ".inf", ".dsc", ".dec", ".py", 
> > ".bat", ".sh",
> ".uni", ".yaml",
> > +   ".fdf", ".inc", "yml", ".asm", ".asm16", 
> > ".asl", ".vfr", ".s", ".S",
> ".aslc",
> > +   ".nasm", ".nasmb", ".idf", ".Vfr", ".H"]
> > +
> > +def GetTestName(self, packagename: str, environment: VarDict) ->
> tuple:
> > +""" Provide the testcase name and classname for use in reporting
> > +testclassname: a descriptive string for the testcase can 
> > include
> whitespace
> > +classname: should be patterned
> ..
> > +
> > +Args:
> > +  packagename: string containing name of package to build
> > +  environment: The VarDict for the test to run in
> > +Returns:
> > +a tuple containing the testcase name and the classname
> > +(testcasename, classname)
> > +"""
> > +return ("Check for license for " + packagename, packagename +
> ".LicenseCheck")
> > +
> > +##
> > +# External function of plugin.  This function is used to perform the 
> &g

[edk2-devel] [PATCH v2 01/15] .pytool/Plugin: Add a plugin LicenseCheck

2020-07-29 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
Add a plugin to check license conflict for new added
files in a patch. It will report out errors when meeting
files which are now contributed under BSD-2-Clause-Patent.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 115 ++
 .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
 .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
 3 files changed, 143 insertions(+)
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck.py
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/LicenseCheck/Readme.md

diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py 
b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
new file mode 100644
index ..5733f7bf4ec0
--- /dev/null
+++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
@@ -0,0 +1,115 @@
+# @file LicenseCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import logging
+import re
+from io import StringIO
+from typing import List, Tuple
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class LicenseCheck(ICiBuildPlugin):
+
+"""
+A CiBuildPlugin to check the license for new added files.
+
+Configuration options:
+"LicenseCheck": {
+"IgnoreFiles": []
+},
+"""
+
+license_format_preflix = 'SPDX-License-Identifier'
+
+bsd2_patent = 'BSD-2-Clause-Patent'
+
+Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)')
+
+file_extension_list = [".c", ".h", ".inf", ".dsc", ".dec", ".py", ".bat", 
".sh", ".uni", ".yaml",
+   ".fdf", ".inc", "yml", ".asm", ".asm16", ".asl", 
".vfr", ".s", ".S", ".aslc",
+   ".nasm", ".nasmb", ".idf", ".Vfr", ".H"]
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for license for " + packagename, packagename + 
".LicenseCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+ignore_files = []
+if "IgnoreFiles" in pkgconfig:
+ignore_files = pkgconfig["IgnoreFiles"]
+
+self.ok = True
+self.startcheck = False
+self.license = True
+self.all_file_pass = True
+count = len(patch)
+line_index = 0
+for line in patch:
+if line.startswith('--- /dev/null'):
+nextline = patch[line_index + 1]
+added_file = self.Readdedfileformat.search(nextline).group(1)
+added_file_extension = os.path.splitext(added_file)[1]
+if added_file_extension in self.file_extension_list and 
packagename in added_file:
+if (self.IsIgnoreFile(added_file, ignore_files)):
+line_index = line_index + 1
+continue
+self.startcheck = True
+self.license = False
+if self.startcheck and self.license_format_preflix in line:
+if self.bsd2_patent in line:
+self.license = True
+if line_index + 1 == count or patch[line_index + 
1].startswith('diff --') and self.startcheck:
+if not self.license:
+

[edk2-devel] [PATCHv v2 00/15] Add a plugin LicenseCheck in open ci

2020-07-29 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
LicenseCheck is now enabled in PatchCheck.py. But there's
a patch "Revert 'BaseTools/PatchCheck.py: Add LicenseCheck'"
to suggest revert the change.These patch series introduce
a plugin LicenseCheck into open ci so that license issues can
still be checked after the checker is disabled in PatchCheck.py.
1/15 is the plugin implementation.
2/15 ~ 15/15 introduce sections "IgnoreFiles" to allow developers
to skip license check for some files like generated files.

Only BSD-2-Clause-Patent can pass this checker.

v2: BSD-3-Clause-Patent can not pass this checker in v2 patch.
  * 2/15~15/15 have been given reviewed-by. To avoid making noise,
I only send out cover letter and 1/15.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Zhichao Gao 
Cc: Jiewen Yao 
Cc: Chao Zhang 
Cc: Jordan Justen 
Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Cc: Liming Gao 
Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 


Shenglei Zhang (15):
  .pytool/Plugin: Add a plugin LicenseCheck
  FatPkg/FatPkg.ci.yaml: Add configuration for LicenseCheck
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for LicenseCheck
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for LicenseCheck
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for LicenseCheck
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for LicenseCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for LicenseCheck
  MdePkg/MdePkg.ci.yaml: Add configuration for LicenseCheck
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for LicenseCheck
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for LicenseCheck
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for
LicenseCheck
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for LicenseCheck
  ShellPkg/ShellPkg.ci.yaml: Add configuration for LicenseCheck
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for LicenseCheck
  UnitTestFrameworkPkg: Add configuration for LicenseCheck in yaml file

 .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 115 ++
 .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
 .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
 ArmVirtPkg/ArmVirtPkg.ci.yaml |   4 +
 CryptoPkg/CryptoPkg.ci.yaml   |   3 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |   4 +
 FatPkg/FatPkg.ci.yaml |   3 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |   3 +
 MdeModulePkg/MdeModulePkg.ci.yaml |   4 +
 MdePkg/MdePkg.ci.yaml |   4 +
 NetworkPkg/NetworkPkg.ci.yaml |   3 +
 OvmfPkg/OvmfPkg.ci.yaml   |   4 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |   3 +
 SecurityPkg/SecurityPkg.ci.yaml   |   3 +
 ShellPkg/ShellPkg.ci.yaml |   3 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |   3 +
 .../UnitTestFrameworkPkg.ci.yaml  |   4 +
 17 files changed, 191 insertions(+)
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck.py
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/LicenseCheck/Readme.md

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63447): https://edk2.groups.io/g/devel/message/63447
Mute This Topic: https://groups.io/mt/75863474/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 01/15] .pytool/Plugin: Add a plugin LicenseCheck

2020-07-29 Thread Zhang, Shenglei
Five sorts of license are accepted in edk2(described in readme). They are BSD 
(2-clause), BSD (3-clause), MIT, Python-2.0 and zlib.
Minus non bsd plus patent license, they are BSD (2-clause) and BSD (3-clause).

Thanks,
Shenglei

> -Original Message-
> From: Kinney, Michael D 
> Sent: Wednesday, July 29, 2020 7:29 AM
> To: Zhang, Shenglei ; devel@edk2.groups.io;
> Kinney, Michael D 
> Cc: Sean Brogan ; Bret Barkelew
> ; Gao, Liming 
> Subject: RE: [PATCH 01/15] .pytool/Plugin: Add a plugin LicenseCheck
> 
> Where did the requirement for BSD-3-Clause-Patent come from?
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: Zhang, Shenglei 
> > Sent: Monday, July 20, 2020 1:37 AM
> > To: devel@edk2.groups.io
> > Cc: Sean Brogan ; Bret
> > Barkelew ; Kinney, Michael
> > D ; Gao, Liming
> > 
> > Subject: [PATCH 01/15] .pytool/Plugin: Add a plugin
> > LicenseCheck
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
> > Add a plugin to check license conflict for new added
> > files in a patch. It will report out errors when meeting
> > files which are now contributed under BSD-2-Clause-
> > Patent
> > or BSD-3-Clause-Patent.
> >
> > Cc: Sean Brogan 
> > Cc: Bret Barkelew 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Signed-off-by: Shenglei Zhang 
> > ---
> >  .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 118
> > ++
> >  .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
> >  .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
> >  3 files changed, 146 insertions(+)
> >  create mode 100644
> > .pytool/Plugin/LicenseCheck/LicenseCheck.py
> >  create mode 100644
> > .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
> >  create mode 100644
> > .pytool/Plugin/LicenseCheck/Readme.md
> >
> > diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py
> > b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
> > new file mode 100644
> > index ..98941ddda758
> > --- /dev/null
> > +++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
> > @@ -0,0 +1,118 @@
> > +# @file LicenseCheck.py
> > +#
> > +# Copyright (c) 2020, Intel Corporation. All rights
> > reserved.
> > +# SPDX-License-Identifier: BSD-2-Clause-Patent
> > +##
> > +
> > +import os
> > +import logging
> > +import re
> > +from io import StringIO
> > +from typing import List, Tuple
> > +from
> > edk2toolext.environment.plugintypes.ci_build_plugin
> > import ICiBuildPlugin
> > +from edk2toolext.environment.var_dict import VarDict
> > +from edk2toollib.utility_functions import RunCmd
> > +
> > +
> > +class LicenseCheck(ICiBuildPlugin):
> > +
> > +"""
> > +A CiBuildPlugin to check the license for new added
> > files.
> > +
> > +Configuration options:
> > +"LicenseCheck": {
> > +"IgnoreFiles": []
> > +},
> > +"""
> > +
> > +license_format_preflix = 'SPDX-License-Identifier'
> > +
> > +bsd2_patent = 'BSD-2-Clause-Patent'
> > +
> > +bsd3_patent = 'BSD-3-Clause-Patent'
> > +
> > +Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)')
> > +
> > +file_extension_list = [".c", ".h", ".inf", ".dsc",
> > ".dec", ".py", ".bat", ".sh", ".uni", ".yaml",
> > +   ".fdf", ".inc", "yml",
> > ".asm", ".asm16", ".asl", ".vfr", ".s", ".S", ".aslc",
> > +   ".nasm", ".nasmb", ".idf",
> > ".Vfr", ".H"]
> > +
> > +def GetTestName(self, packagename: str,
> > environment: VarDict) -> tuple:
> > +""" Provide the testcase name and classname for
> > use in reporting
> > +testclassname: a descriptive string for the
> > testcase can include whitespace
> > +classname: should be patterned
> > ..
> > +
> > +Args:
> > +  packagename: string containing name of
> > package to build
> > +  environment: The VarDict for the test to
> > run in
> > +Returns:
> > +a tuple containing the testcase name
> >

[edk2-devel] [PATCH] SimicsOpenBoardPkg: Update usage of functions to be removed

2020-07-28 Thread Zhang, Shenglei
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2777
With some functions to be deprecated, their usage in platforms
should also be updated.

Cc: Agyeman Prince 
Signed-off-by: Shenglei Zhang 
---
 .../Library/BoardBdsHookLib/BoardBdsHookLib.c|  2 +-
 .../Intel/SimicsOpenBoardPkg/SimicsDxe/Platform.c|  4 ++--
 .../Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c   |  6 +++---
 .../Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c| 12 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c 
b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
index 1058dbf3..ba4d2b02 100644
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
+++ 
b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
@@ -1206,7 +1206,7 @@ VisitingFileSystemInstance (
   NULL,
   
   );
-  PcdSet64 (PcdEmuVariableEvent, (UINT64)(UINTN) mEmuVariableEvent);
+  PcdSet64S (PcdEmuVariableEvent, (UINT64)(UINTN) mEmuVariableEvent);
 
   return EFI_SUCCESS;
 }
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsDxe/Platform.c 
b/Platform/Intel/SimicsOpenBoardPkg/SimicsDxe/Platform.c
index b7fd4d1f..c856ff44 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsDxe/Platform.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsDxe/Platform.c
@@ -669,9 +669,9 @@ ExecutePlatformConfig (
 //
 // Pass the preferred resolution to GraphicsConsoleDxe via dynamic PCDs.
 //
-PcdSet32 (PcdVideoHorizontalResolution,
+PcdSet32S (PcdVideoHorizontalResolution,
   PlatformConfig.HorizontalResolution);
-PcdSet32 (PcdVideoVerticalResolution,
+PcdSet32S (PcdVideoVerticalResolution,
   PlatformConfig.VerticalResolution);
   }
 
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c 
b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
index 60aa54be..127afffc 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
@@ -155,7 +155,7 @@ GetFirstNonAddress (
 if (mBootMode != BOOT_ON_S3_RESUME) {
   DEBUG ((EFI_D_INFO, "%a: disabling 64-bit PCI host aperture\n",
 __FUNCTION__));
-  PcdSet64 (PcdPciMmio64Size, 0);
+  PcdSet64S (PcdPciMmio64Size, 0);
 }
 
 //
@@ -187,8 +187,8 @@ GetFirstNonAddress (
 // the GCD memory space map through our PciHostBridgeLib instance; here we
 // only need to set the PCDs.
 //
-PcdSet64 (PcdPciMmio64Base, Pci64Base);
-PcdSet64 (PcdPciMmio64Size, Pci64Size);
+PcdSet64S (PcdPciMmio64Base, Pci64Base);
+PcdSet64S (PcdPciMmio64Size, Pci64Size);
 DEBUG ((EFI_D_INFO, "%a: Pci64Base=0x%Lx Pci64Size=0x%Lx\n",
   __FUNCTION__, Pci64Base, Pci64Size));
   }
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c 
b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c
index 0bec76e4..6963f39a 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Platform.c
@@ -257,8 +257,8 @@ MemMapInitialization (
   //
   PciSize = 0xFC00 - PciBase;
   AddIoMemoryBaseSizeHob (PciBase, PciSize);
-  PcdSet64 (PcdPciMmio32Base, PciBase);
-  PcdSet64 (PcdPciMmio32Size, PciSize);
+  PcdSet64S (PcdPciMmio32Base, PciBase);
+  PcdSet64S (PcdPciMmio32Size, PciSize);
   AddIoMemoryBaseSizeHob (0xFEC0, SIZE_4KB);
   AddIoMemoryBaseSizeHob (0xFED0, SIZE_1KB);
   if (mHostBridgeDevId == INTEL_ICH10_DEVICE_ID) {
@@ -300,8 +300,8 @@ MemMapInitialization (
 PciIoBase,
 PciIoSize
 );
-  PcdSet64 (PcdPciIoBase, PciIoBase);
-  PcdSet64 (PcdPciIoSize, PciIoSize);
+  PcdSet64S (PcdPciIoBase, PciIoBase);
+  PcdSet64S (PcdPciIoSize, PciIoSize);
 
   //
   // Add flash range.
@@ -367,7 +367,7 @@ MiscInitialization (
   ASSERT (FALSE);
   return;
   }
-  PcdSet16 (PcdSimicsX58HostBridgePciDevId, mHostBridgeDevId);
+  PcdSet16S (PcdSimicsX58HostBridgePciDevId, mHostBridgeDevId);
 
   //
   // If the appropriate IOspace enable bit is set, assume the ACPI PMBA
@@ -483,7 +483,7 @@ ReserveEmuVariableNvStore (
   VariableStore,
   (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024
 ));
-  PcdSet64 (PcdEmuVariableNvStoreReserved, VariableStore);
+  PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);
 }
 
 
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63429): https://edk2.groups.io/g/devel/message/63429
Mute This Topic: https://groups.io/mt/75858614/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 10/15] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-27 Thread Zhang, Shenglei
Hi Laszlo,

> -Original Message-
> From: Laszlo Ersek 
> Sent: Monday, July 27, 2020 5:51 PM
> To: Zhang, Shenglei ; Rebecca Cran
> 
> Cc: devel@edk2.groups.io; Justen, Jordan L ;
> Ard Biesheuvel 
> Subject: Re: [PATCH 10/15] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for
> LicenseCheck
> 
> On 07/27/20 08:21, Zhang, Shenglei wrote:
> > Hi Laszlo,
> >
> > VbeShim.h is existing in edk2 now. This plugin only checks the patches to
> be checked in.
> > So there's no need to add existing files to this section.
> 
> OK, thanks, we can always extend this stanza later, if needed.
> 
> Rebecca: once this patch is upstream, please post a separate patch for listing
> "OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.h" in "IgnoreFiles". Otherwise I
> won't be able to merge your patch at
> <https://edk2.groups.io/g/devel/message/62395>.
> 
> 
> Shenglei: I have a question regarding IgnoreFiles syntax. In
> "MdeModulePkg/MdeModulePkg.ci.yaml", there are two syntaxes:
> 
> - The IgnoreFiles stanza for "CharEncodingCheck" uses pathnames that are
> relative to the *project* root:
> 
> > ## options defined ci/Plugin/CharEncodingCheck
> > "CharEncodingCheck": {
> > "IgnoreFiles": [
> >
> "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma/test/testc.c",
> >
> "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma/windows/tes
> tc.c"
> > ]
> > },
> 
> - The IgnoreFiles stanza for "SpellCheck" uses pathnames that are relative to
> the *package* (not project) root:
> 
> > "SpellCheck": {
> > ...
> > "IgnoreFiles": [ # use gitignore syntax to ignore 
> > errors in matching
> files
> > "Library/LzmaCustomDecompressLib/Sdk/DOC/*"
> > ],
> 
> How do we know whether a particular check's IgnoreFiles stanza requires
> project-root-relative or package-root-relative pathnames?

It depends on the designing of the plugins, likes the check scope.
But looks like all checks' IgnoreFiles stanza only requires 
package-root-relative pathnames, currently.
It's recommended to use package-root-relative pathnames because a plugin must 
support this format.

Thanks,
Shenglei

> 
> Thanks!
> Laszlo
> 
> > Thanks,
> > Shenglei
> >
> >> -Original Message-
> >> From: Laszlo Ersek 
> >> Sent: Tuesday, July 21, 2020 6:01 AM
> >> To: Zhang, Shenglei ; devel@edk2.groups.io
> >> Cc: Justen, Jordan L ; Ard Biesheuvel
> >> 
> >> Subject: Re: [PATCH 10/15] OvmfPkg/OvmfPkg.ci.yaml: Add configuration
> for
> >> LicenseCheck
> >>
> >> On 07/20/20 10:37, Shenglei Zhang wrote:
> >>> Add configuration IgnoreFiles for package config files.
> >>> So users can rely on this to skip license conflict for
> >>> some generated files.
> >>>
> >>> Cc: Jordan Justen 
> >>> Cc: Laszlo Ersek 
> >>> Cc: Ard Biesheuvel 
> >>> Signed-off-by: Shenglei Zhang 
> >>> ---
> >>>  OvmfPkg/OvmfPkg.ci.yaml | 4 
> >>>  1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
> >>> index 98992f0429ff..ed342d7a3d08 100644
> >>> --- a/OvmfPkg/OvmfPkg.ci.yaml
> >>> +++ b/OvmfPkg/OvmfPkg.ci.yaml
> >>> @@ -8,6 +8,10 @@
> >>>  # SPDX-License-Identifier: BSD-2-Clause-Patent
> >>>  ##
> >>>  {
> >>> +## options defined .pytool/Plugin/LicenseCheck
> >>> +"LicenseCheck": {
> >>> +"IgnoreFiles": []
> >>> +},
> >>>  ## options defined .pytool/Plugin/CompilerPlugin
> >>>  "CompilerPlugin": {
> >>>  "DscPath": "" # Don't support this test
> >>>
> >>
> >> Can you list the following file at once, please:
> >>
> >>   OvmfPkg/QemuVideoDxe/VbeShim.h
> >>
> >> With that:
> >>
> >> Reviewed-by: Laszlo Ersek 
> >>
> >> Thanks
> >> Laszlo
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63366): https://edk2.groups.io/g/devel/message/63366
Mute This Topic: https://groups.io/mt/75678218/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 15/15] UnitTestFrameworkPkg: Add configuration for LicenseCheck in yaml file

2020-07-27 Thread Zhang, Shenglei
Hi Michael/Sean/Bret,

Could you help review this patch?

Thanks,
Shenglei

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Zhang,
> Shenglei
> Sent: Monday, July 20, 2020 4:37 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Sean Brogan
> ; Bret Barkelew
> 
> Subject: [edk2-devel] [PATCH 15/15] UnitTestFrameworkPkg: Add
> configuration for LicenseCheck in yaml file
> 
> Add configuration IgnoreFiles for package config files.
> So users can rely on this to skip license conflict for
> some generated files.
> 
> Cc: Michael D Kinney 
> Cc: Sean Brogan 
> Cc: Bret Barkelew 
> Signed-off-by: Shenglei Zhang 
> ---
>  UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
> b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
> index 51e172537f8a..2988e03f763f 100644
> --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
> +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
> @@ -5,6 +5,10 @@
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
>  {
> +## options defined .pytool/Plugin/LicenseCheck
> +"LicenseCheck": {
> +"IgnoreFiles": []
> +},
>  ## options defined .pytool/Plugin/CompilerPlugin
>  "CompilerPlugin": {
>  "DscPath": "UnitTestFrameworkPkg.dsc"
> --
> 2.18.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63286): https://edk2.groups.io/g/devel/message/63286
Mute This Topic: https://groups.io/mt/75817306/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 10/15] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-27 Thread Zhang, Shenglei
Hi Laszlo,

VbeShim.h is existing in edk2 now. This plugin only checks the patches to be 
checked in.
So there's no need to add existing files to this section.

Thanks,
Shenglei

> -Original Message-
> From: Laszlo Ersek 
> Sent: Tuesday, July 21, 2020 6:01 AM
> To: Zhang, Shenglei ; devel@edk2.groups.io
> Cc: Justen, Jordan L ; Ard Biesheuvel
> 
> Subject: Re: [PATCH 10/15] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for
> LicenseCheck
> 
> On 07/20/20 10:37, Shenglei Zhang wrote:
> > Add configuration IgnoreFiles for package config files.
> > So users can rely on this to skip license conflict for
> > some generated files.
> >
> > Cc: Jordan Justen 
> > Cc: Laszlo Ersek 
> > Cc: Ard Biesheuvel 
> > Signed-off-by: Shenglei Zhang 
> > ---
> >  OvmfPkg/OvmfPkg.ci.yaml | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
> > index 98992f0429ff..ed342d7a3d08 100644
> > --- a/OvmfPkg/OvmfPkg.ci.yaml
> > +++ b/OvmfPkg/OvmfPkg.ci.yaml
> > @@ -8,6 +8,10 @@
> >  # SPDX-License-Identifier: BSD-2-Clause-Patent
> >  ##
> >  {
> > +## options defined .pytool/Plugin/LicenseCheck
> > +"LicenseCheck": {
> > +"IgnoreFiles": []
> > +},
> >  ## options defined .pytool/Plugin/CompilerPlugin
> >  "CompilerPlugin": {
> >  "DscPath": "" # Don't support this test
> >
> 
> Can you list the following file at once, please:
> 
>   OvmfPkg/QemuVideoDxe/VbeShim.h
> 
> With that:
> 
> Reviewed-by: Laszlo Ersek 
> 
> Thanks
> Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63285): https://edk2.groups.io/g/devel/message/63285
Mute This Topic: https://groups.io/mt/75678218/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v8 02/16] .pytool/Plugin: Add a plugin EccCheck

2020-07-26 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
EccCheck is a plugin to report Ecc issues for code in pull request
, which will be run on open ci.
But note not each kind of issue could be reported out.
It can only handle the issues, whose line number in CSV report
accurately map with their code in source code files. And Ecc issues
about comments can also be handled.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py   | 291 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 3 files changed, 317 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
new file mode 100644
index ..f23b85bc5a2a
--- /dev/null
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -0,0 +1,291 @@
+# @file EccCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import re
+import csv
+import xml.dom.minidom
+from typing import List, Dict, Tuple
+import logging
+from io import StringIO
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class EccCheck(ICiBuildPlugin):
+"""
+A CiBuildPlugin that finds the Ecc issues of newly added code in pull 
request.
+
+Configuration options:
+"EccCheck": {
+"ExceptionList": [],
+"IgnoreFiles": []
+},
+"""
+
+ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
+FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
+LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
+LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for efi coding style for " + packagename, packagename + 
".EccCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+edk2_path = Edk2pathObj.WorkspacePath
+python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
+env = shell_environment.GetEnvironment()
+env.set_shell_var('PYTHONPATH', python_path)
+env.set_shell_var('WORKSPACE', edk2_path)
+self.ECC_PASS = True
+self.ApplyConfig(pkgconfig, edk2_path, packagename)
+modify_dir_list = self.GetModifyDir(packagename)
+patch = self.GetDiff(packagename)
+ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
+self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
+ecc_log = os.path.join(edk2_path, "Ecc.log")
+if self.ECC_PASS:
+tc.SetSuccess()
+self.RemoveFile(ecc_log)
+return 0
+else:
+with open(ecc_log, encoding='utf8') as output:
+ecc_output = output.readlines()
+for line in ecc_output:
+logging.error(line)
+self.RemoveFile(ecc_log)
+tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc 
detected issues")
+return 1
+
+def GetDiff(self, pkg: str) -> List[str]:
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+return patch
+
+def RemoveFile(self, file: str) -> 

[edk2-devel] [PATCH v8 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-26 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
As planed we will enable Ecc check for edk2 on open ci. And they are
ready now. I appreciate receiving feedback and comments if someone
find errors or false positive issues.

I created a pipline of EccCheck for my forked edk2. Welcome everyone to
create pull request to test the quality of this plugin.
My forked tree: https://github.com/shenglei10/edk2

And I also created some test cases for ECC plugin. Below are test cases.
https://github.com/shenglei10/edk2/tree/ECC
Results can be view in below azure server.
https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12&_a=summary

Patches
1/16: It's a lib necessary for py3 to run Ecc on azure servers.

2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
 on azure servers for open ci, or a local virtual environment.

3/16~16/16: We consider some cases that will report out Ecc issues but they 
won't
 be fixed, like submodule and industry standard related things. So we
 add two configuration fields "Exception" and "IgnoreFiles" for people
 to use. These patches add configuration in yaml files for Ecc check.

Cc: Bob Feng 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 

v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.

v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
Update 2/17, designate the version of antlr4 is 4.7.1.
Add 4/17~17/17.

v4. Update 1/17, remove the function EdksetupRebuild(), instead add
function SetupEnvironment(). Update variables' format and type hints
to pass flake8 and mypy.

v5. Conver the former method to plugin solution, to align with
other check points on open ci.

v6. The 1/16 patch is missed in v5 series. Now add it in v6.

v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.

v8. Enable error code config section to ignore certain kinds of issues,
which are always false positive in partial Ecc scaning.
All patches except 2/16 have been R-B and are not updated in v8 series.
To avoid making noise in community, I only send cover letter and 2/16 patch.

Shenglei Zhang (16):
  pip-requirements.txt: Add Ecc required lib
  .pytool/Plugin: Add a plugin EccCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
  FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
  MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
  ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
  UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

 .pytool/Plugin/EccCheck/EccCheck.py   | 291 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 ArmVirtPkg/ArmVirtPkg.ci.yaml |  11 +
 CryptoPkg/CryptoPkg.ci.yaml   |  11 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |  11 +
 FatPkg/FatPkg.ci.yaml |  11 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |  11 +
 MdeModulePkg/MdeModulePkg.ci.yaml |  11 +
 MdePkg/MdePkg.ci.yaml |  11 +
 NetworkPkg/NetworkPkg.ci.yaml |  11 +
 OvmfPkg/OvmfPkg.ci.yaml   |  11 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |  11 +
 SecurityPkg/SecurityPkg.ci.yaml   |  11 +
 ShellPkg/ShellPkg.ci.yaml |  11 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |  11 +
 .../UnitTestFrameworkPkg.ci.yaml  |  10 +
 pip-requirements.txt  |   1 +
 18 files changed, 471 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#63270): https://edk2.groups.io/g/devel/message/63270
Mute This Topic: https://groups.io/mt/75804105/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools/PatchCheck.py: Skip length check for user name in xxx-by

2020-07-20 Thread Zhang, Shenglei
Bob,

Code review is for our internal use. Should I append it on Bugzilla?

Thanks,
Shenglei

> -Original Message-
> From: Feng, Bob C 
> Sent: Tuesday, July 21, 2020 11:39 AM
> To: Zhang, Shenglei ; devel@edk2.groups.io
> Cc: Gao, Liming 
> Subject: RE: [PATCH] BaseTools/PatchCheck.py: Skip length check for user
> name in xxx-by
> 
> Shenglei,
> 
> After you send out the patch for review, please update the Bugzilla status as
> in-progress and provide the code review link.
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Zhang, Shenglei 
> Sent: Thursday, July 16, 2020 11:14 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Gao, Liming 
> Subject: [PATCH] BaseTools/PatchCheck.py: Skip length check for user name
> in xxx-by
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2836
> Current PatchCheck.py checks each line to ensure line's length is not larger
> than 76. But there's a case that length of user's name is much longer than
> that number. So enhance the script to handle this case.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  BaseTools/Scripts/PatchCheck.py | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Scripts/PatchCheck.py
> b/BaseTools/Scripts/PatchCheck.py index 52244b0bc4d8..7db0775d14d1
> 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -268,7 +268,14 @@ class CommitMessageCheck:
>  for i in range(2, count):
>  if (len(lines[i]) >= 76 and
>  len(lines[i].split()) > 1 and
> -not lines[i].startswith('git-svn-id:')):
> +not lines[i].startswith('git-svn-id:') and
> +not lines[i].startswith('Reviewed-by') and
> +not lines[i].startswith('Acked-by:') and
> +not lines[i].startswith('Tested-by:') and
> +not lines[i].startswith('Reported-by:') and
> +not lines[i].startswith('Suggested-by:') and
> +not lines[i].startswith('Signed-off-by:') and
> +not lines[i].startswith('Cc:')):
>  #
>  # Print a warning if body line is longer than 75 characters
>  #
> --
> 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62949): https://edk2.groups.io/g/devel/message/62949
Mute This Topic: https://groups.io/mt/75535068/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 12/15] SecurityPkg/SecurityPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Signed-off-by: Shenglei Zhang 
---
 SecurityPkg/SecurityPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml
index 953219053318..1ef1d2e67ead 100644
--- a/SecurityPkg/SecurityPkg.ci.yaml
+++ b/SecurityPkg/SecurityPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "SecurityPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62822): https://edk2.groups.io/g/devel/message/62822
Mute This Topic: https://groups.io/mt/75678223/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 02/15] FatPkg/FatPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
---
 FatPkg/FatPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/FatPkg/FatPkg.ci.yaml b/FatPkg/FatPkg.ci.yaml
index 8b0fb1d4fcd5..489c4614e9e1 100644
--- a/FatPkg/FatPkg.ci.yaml
+++ b/FatPkg/FatPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "FatPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62808): https://edk2.groups.io/g/devel/message/62808
Mute This Topic: https://groups.io/mt/75678210/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 05/15] EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
---
 EmulatorPkg/EmulatorPkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
index 81f81780ec76..dead82f69745 100644
--- a/EmulatorPkg/EmulatorPkg.ci.yaml
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -8,6 +8,10 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62811): https://edk2.groups.io/g/devel/message/62811
Mute This Topic: https://groups.io/mt/75678213/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 08/15] MdePkg/MdePkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 MdePkg/MdePkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index 3268f1535499..b088a4344908 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -5,6 +5,10 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62814): https://edk2.groups.io/g/devel/message/62814
Mute This Topic: https://groups.io/mt/75678216/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 14/15] UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Shenglei Zhang 
---
 UefiCpuPkg/UefiCpuPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.ci.yaml b/UefiCpuPkg/UefiCpuPkg.ci.yaml
index 99e460a8b090..d54651d43800 100644
--- a/UefiCpuPkg/UefiCpuPkg.ci.yaml
+++ b/UefiCpuPkg/UefiCpuPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "UefiCpuPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62820): https://edk2.groups.io/g/devel/message/62820
Mute This Topic: https://groups.io/mt/75678225/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 13/15] ShellPkg/ShellPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Shenglei Zhang 
---
 ShellPkg/ShellPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ShellPkg/ShellPkg.ci.yaml b/ShellPkg/ShellPkg.ci.yaml
index 67de34a2556e..565e08596b2f 100644
--- a/ShellPkg/ShellPkg.ci.yaml
+++ b/ShellPkg/ShellPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "ShellPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62819): https://edk2.groups.io/g/devel/message/62819
Mute This Topic: https://groups.io/mt/75678224/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 11/15] PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
---
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml 
b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
index be470807bd9e..5543d15c3248 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "PcAtChipsetPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62817): https://edk2.groups.io/g/devel/message/62817
Mute This Topic: https://groups.io/mt/75678220/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 00/15] Add a plugin LicenseCheck in open ci

2020-07-20 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
LicenseCheck is now enabled in PatchCheck.py. But there's
a patch "Revert 'BaseTools/PatchCheck.py: Add LicenseCheck'"
to suggest revert the change.These patch series introduce
a plugin LicenseCheck into open ci so that license issues can
still be checked after the checker is disabled in PatchCheck.py.
1/15 is the plugin implementation.
2/15 ~ 15/15 introduce sections "IgnoreFiles" to allow developers
to skip license check for some files like generated files.

Only BSD-2-Clause-Patent and BSD-3-Clause-Patent can pass this checker.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Zhichao Gao 
Cc: Jiewen Yao 
Cc: Chao Zhang 
Cc: Jordan Justen 
Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Cc: Liming Gao 
Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Shenglei Zhang (15):
  .pytool/Plugin: Add a plugin LicenseCheck
  FatPkg/FatPkg.ci.yaml: Add configuration for LicenseCheck
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for LicenseCheck
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for LicenseCheck
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for LicenseCheck
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for LicenseCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for LicenseCheck
  MdePkg/MdePkg.ci.yaml: Add configuration for LicenseCheck
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for LicenseCheck
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for LicenseCheck
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for
LicenseCheck
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for LicenseCheck
  ShellPkg/ShellPkg.ci.yaml: Add configuration for LicenseCheck
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for LicenseCheck
  UnitTestFrameworkPkg: Add configuration for LicenseCheck in yaml file

 .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 118 ++
 .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
 .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
 ArmVirtPkg/ArmVirtPkg.ci.yaml |   4 +
 CryptoPkg/CryptoPkg.ci.yaml   |   3 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |   4 +
 FatPkg/FatPkg.ci.yaml |   3 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |   3 +
 MdeModulePkg/MdeModulePkg.ci.yaml |   4 +
 MdePkg/MdePkg.ci.yaml |   4 +
 NetworkPkg/NetworkPkg.ci.yaml |   3 +
 OvmfPkg/OvmfPkg.ci.yaml   |   4 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |   3 +
 SecurityPkg/SecurityPkg.ci.yaml   |   3 +
 ShellPkg/ShellPkg.ci.yaml |   3 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |   3 +
 .../UnitTestFrameworkPkg.ci.yaml  |   4 +
 17 files changed, 194 insertions(+)
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck.py
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/LicenseCheck/Readme.md

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62806): https://edk2.groups.io/g/devel/message/62806
Mute This Topic: https://groups.io/mt/75678207/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 10/15] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Shenglei Zhang 
---
 OvmfPkg/OvmfPkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
index 98992f0429ff..ed342d7a3d08 100644
--- a/OvmfPkg/OvmfPkg.ci.yaml
+++ b/OvmfPkg/OvmfPkg.ci.yaml
@@ -8,6 +8,10 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62816): https://edk2.groups.io/g/devel/message/62816
Mute This Topic: https://groups.io/mt/75678218/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 04/15] CryptoPkg/CryptoPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Signed-off-by: Shenglei Zhang 
---
 CryptoPkg/CryptoPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index f54ebfb22e70..e73b79e01fef 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "CryptoPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62810): https://edk2.groups.io/g/devel/message/62810
Mute This Topic: https://groups.io/mt/75678212/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 15/15] UnitTestFrameworkPkg: Add configuration for LicenseCheck in yaml file

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Signed-off-by: Shenglei Zhang 
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml 
b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
index 51e172537f8a..2988e03f763f 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
@@ -5,6 +5,10 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "UnitTestFrameworkPkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62821): https://edk2.groups.io/g/devel/message/62821
Mute This Topic: https://groups.io/mt/75678226/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 09/15] NetworkPkg/NetworkPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Shenglei Zhang 
---
 NetworkPkg/NetworkPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/NetworkPkg.ci.yaml b/NetworkPkg/NetworkPkg.ci.yaml
index 70f2e1014748..aa536830fc27 100644
--- a/NetworkPkg/NetworkPkg.ci.yaml
+++ b/NetworkPkg/NetworkPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "NetworkPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62815): https://edk2.groups.io/g/devel/message/62815
Mute This Topic: https://groups.io/mt/75678217/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 01/15] .pytool/Plugin: Add a plugin LicenseCheck

2020-07-20 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2833
Add a plugin to check license conflict for new added
files in a patch. It will report out errors when meeting
files which are now contributed under BSD-2-Clause-Patent
or BSD-3-Clause-Patent.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/LicenseCheck/LicenseCheck.py   | 118 ++
 .../LicenseCheck/LicenseCheck_plug_in.yaml|  11 ++
 .pytool/Plugin/LicenseCheck/Readme.md |  17 +++
 3 files changed, 146 insertions(+)
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck.py
 create mode 100644 .pytool/Plugin/LicenseCheck/LicenseCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/LicenseCheck/Readme.md

diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py 
b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
new file mode 100644
index ..98941ddda758
--- /dev/null
+++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py
@@ -0,0 +1,118 @@
+# @file LicenseCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import logging
+import re
+from io import StringIO
+from typing import List, Tuple
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class LicenseCheck(ICiBuildPlugin):
+
+"""
+A CiBuildPlugin to check the license for new added files.
+
+Configuration options:
+"LicenseCheck": {
+"IgnoreFiles": []
+},
+"""
+
+license_format_preflix = 'SPDX-License-Identifier'
+
+bsd2_patent = 'BSD-2-Clause-Patent'
+
+bsd3_patent = 'BSD-3-Clause-Patent'
+
+Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)')
+
+file_extension_list = [".c", ".h", ".inf", ".dsc", ".dec", ".py", ".bat", 
".sh", ".uni", ".yaml",
+   ".fdf", ".inc", "yml", ".asm", ".asm16", ".asl", 
".vfr", ".s", ".S", ".aslc",
+   ".nasm", ".nasmb", ".idf", ".Vfr", ".H"]
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for license for " + packagename, packagename + 
".LicenseCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+ignore_files = []
+if "IgnoreFiles" in pkgconfig:
+ignore_files = pkgconfig["IgnoreFiles"]
+
+self.ok = True
+self.startcheck = False
+self.license = True
+self.all_file_pass = True
+count = len(patch)
+line_index = 0
+for line in patch:
+if line.startswith('--- /dev/null'):
+nextline = patch[line_index + 1]
+added_file = self.Readdedfileformat.search(nextline).group(1)
+added_file_extension = os.path.splitext(added_file)[1]
+if added_file_extension in self.file_extension_list and 
packagename in added_file:
+if (self.IsIgnoreFile(added_file, ignore_files)):
+line_index = line_index + 1
+continue
+self.startcheck = True
+self.license = False
+if self.startcheck and self.license_format_preflix in line:
+if self.bsd2_patent in line or self.bsd3_patent in line:
+self.license = True
+if line_index + 1 == count or patch[line_index + 
1].startswith('diff --') 

[edk2-devel] [PATCH 12/15] SecurityPkg/SecurityPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Chao Zhang 
Signed-off-by: Shenglei Zhang 
---
 SecurityPkg/SecurityPkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml
index 953219053318..1ef1d2e67ead 100644
--- a/SecurityPkg/SecurityPkg.ci.yaml
+++ b/SecurityPkg/SecurityPkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "SecurityPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62818): https://edk2.groups.io/g/devel/message/62818
Mute This Topic: https://groups.io/mt/75678223/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 07/15] MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/MdeModulePkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml 
b/MdeModulePkg/MdeModulePkg.ci.yaml
index 1cfc1328390e..0fc8c3633878 100644
--- a/MdeModulePkg/MdeModulePkg.ci.yaml
+++ b/MdeModulePkg/MdeModulePkg.ci.yaml
@@ -5,6 +5,10 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdeModulePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62813): https://edk2.groups.io/g/devel/message/62813
Mute This Topic: https://groups.io/mt/75678215/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 06/15] FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Liming Gao 
Cc: Michael D Kinney 
Signed-off-by: Shenglei Zhang 
---
 FmpDevicePkg/FmpDevicePkg.ci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/FmpDevicePkg/FmpDevicePkg.ci.yaml 
b/FmpDevicePkg/FmpDevicePkg.ci.yaml
index 74a0aefe8e49..d498ad7d21e1 100644
--- a/FmpDevicePkg/FmpDevicePkg.ci.yaml
+++ b/FmpDevicePkg/FmpDevicePkg.ci.yaml
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 "CompilerPlugin": {
 "DscPath": "FmpDevicePkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62812): https://edk2.groups.io/g/devel/message/62812
Mute This Topic: https://groups.io/mt/75678214/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 03/15] ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for LicenseCheck

2020-07-20 Thread Zhang, Shenglei
Add configuration IgnoreFiles for package config files.
So users can rely on this to skip license conflict for
some generated files.

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Shenglei Zhang 
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
index 4553725ee528..27bb7ff49011 100644
--- a/ArmVirtPkg/ArmVirtPkg.ci.yaml
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -8,6 +8,10 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+## options defined .pytool/Plugin/LicenseCheck
+"LicenseCheck": {
+"IgnoreFiles": []
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62809): https://edk2.groups.io/g/devel/message/62809
Mute This Topic: https://groups.io/mt/75678211/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH] BaseTools/PatchCheck.py: Skip length check for user name in xxx-by

2020-07-15 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2836
Current PatchCheck.py checks each line to ensure line's length is not
larger than 76. But there's a case that length of user's name is much
longer than that number. So enhance the script to handle this case.

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 BaseTools/Scripts/PatchCheck.py | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 52244b0bc4d8..7db0775d14d1 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -268,7 +268,14 @@ class CommitMessageCheck:
 for i in range(2, count):
 if (len(lines[i]) >= 76 and
 len(lines[i].split()) > 1 and
-not lines[i].startswith('git-svn-id:')):
+not lines[i].startswith('git-svn-id:') and
+not lines[i].startswith('Reviewed-by') and
+not lines[i].startswith('Acked-by:') and
+not lines[i].startswith('Tested-by:') and
+not lines[i].startswith('Reported-by:') and
+not lines[i].startswith('Suggested-by:') and
+not lines[i].startswith('Signed-off-by:') and
+not lines[i].startswith('Cc:')):
 #
 # Print a warning if body line is longer than 75 characters
 #
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62647): https://edk2.groups.io/g/devel/message/62647
Mute This Topic: https://groups.io/mt/75535068/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v7 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-07 Thread Zhang, Shenglei
Comments below.

> -Original Message-
> From: Leif Lindholm 
> Sent: Tuesday, July 7, 2020 7:57 PM
> To: Zhang, Shenglei 
> Cc: devel@edk2.groups.io; Feng, Bob C ; Bret
> Barkelew ; Kinney, Michael D
> ; Gao, Liming ; Sean
> Brogan 
> Subject: Re: [edk2-devel] [PATCH v7 00/16] Add a plugin to check Ecc issues
> for edk2 on open ci
> 
> On Tue, Jul 07, 2020 at 02:24:14 +, Zhang, Shenglei wrote:
> > Comments below.
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io  On Behalf Of Leif
> > > Lindholm
> > > Sent: Monday, July 6, 2020 4:55 PM
> > > To: devel@edk2.groups.io; Zhang, Shenglei 
> > > Cc: Feng, Bob C ; Bret Barkelew
> > > ; Kinney, Michael D
> > > ; Gao, Liming ;
> Sean
> > > Brogan 
> > > Subject: Re: [edk2-devel] [PATCH v7 00/16] Add a plugin to check Ecc
> issues
> > > for edk2 on open ci
> > >
> > > On Mon, Jul 06, 2020 at 16:48:30 +0800, Zhang, Shenglei wrote:
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
> > > > As planed we will enable Ecc check for edk2 on open ci. And they are
> > > > ready now. I appreciate receiving feedback and comments if someone
> > > > find errors or false positive issues.
> > > >
> > > > I created a pipline of EccCheck for my forked edk2. Welcome everyone
> to
> > > > create pull request to test the quality of this plugin.
> > > > My forked tree: https://github.com/shenglei10/edk2
> > > >
> > > > And I also created some test cases for ECC plugin. Below are test cases.
> > > > https://github.com/shenglei10/edk2/tree/ECC
> > > > Results can be view in below azure server.
> > > >
> > >
> https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12
> > > &_a=summary
> > > >
> > > > Patches
> > > > 1/16: It's a lib necessary for py3 to run Ecc on azure servers.
> > > >
> > > > 2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can 
> > > > be
> run
> > > >  on azure servers for open ci, or a local virtual environment.
> > > >
> > > > 3/16~16/16: We consider some cases that will report out Ecc issues but
> they
> > > won't
> > > >  be fixed, like submodule and industry standard related things. So 
> > > > we
> > > >  add two configuration fields "Exception" and "IgnoreFiles" for 
> > > > people
> > > >  to use. These patches add configuration in yaml files for Ecc 
> > > > check.
> > > >
> > > > Cc: Bob Feng 
> > > > Cc: Bret Barkelew 
> > > > Cc: Michael D Kinney 
> > > > Cc: Liming Gao 
> > > > Cc: Sean Brogan 
> > > >
> > > > v2: Update 1/17, fix the bug that the script can't hanlde multiple
> commits.
> > > >
> > > > v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
> > > > Update 2/17, designate the version of antlr4 is 4.7.1.
> > > > Add 4/17~17/17.
> > > >
> > > > v4. Update 1/17, remove the function EdksetupRebuild(), instead add
> > > > function SetupEnvironment(). Update variables' format and type
> hints
> > > > to pass flake8 and mypy.
> > > >
> > > > v5. Conver the former method to plugin solution, to align with
> > > > other check points on open ci.
> > > >
> > > > v6. The 1/16 patch is missed in v5 series. Now add it in v6.
> > > >
> > > > v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.
> > >
> > > What is the bug? Where is it fixed?
> >
> > V6 plugin pipeline link:
> >
> https://dev.azure.com/shengleizhang/shengleizhang/_build/results?buildId
> =282=logs=9b8d87a5-bd93-5358-8ffa-588e312c4376=282a77bb-
> da29-5801-6299-2bbe15d5aabb
> > v7 plugin pipeline link:
> >
> https://dev.azure.com/shengleizhang/shengleizhang/_build/results?buildId
> =316=logs=5e3952f2-9c8a-5394-82c1-a803bcab3ca3=7ea9e85e-
> 5c3d-5fcf-865e-8449f16cc745
> >
> > For the same pull request, v6 plugin can't report out the Ecc issues under
> Linux OS.
> 
> Right. So *what* was the bug and *where* (which patch or patches) was
> it fixed? This is information that should (in an abbreviated form) be
> provided in the cover letter.
> 
> "Fix a bug" is data, not information. The same is true 

Re: [edk2-devel] [PATCH v7 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-06 Thread Zhang, Shenglei
Comments below.

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Leif
> Lindholm
> Sent: Monday, July 6, 2020 4:55 PM
> To: devel@edk2.groups.io; Zhang, Shenglei 
> Cc: Feng, Bob C ; Bret Barkelew
> ; Kinney, Michael D
> ; Gao, Liming ; Sean
> Brogan 
> Subject: Re: [edk2-devel] [PATCH v7 00/16] Add a plugin to check Ecc issues
> for edk2 on open ci
> 
> On Mon, Jul 06, 2020 at 16:48:30 +0800, Zhang, Shenglei wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
> > As planed we will enable Ecc check for edk2 on open ci. And they are
> > ready now. I appreciate receiving feedback and comments if someone
> > find errors or false positive issues.
> >
> > I created a pipline of EccCheck for my forked edk2. Welcome everyone to
> > create pull request to test the quality of this plugin.
> > My forked tree: https://github.com/shenglei10/edk2
> >
> > And I also created some test cases for ECC plugin. Below are test cases.
> > https://github.com/shenglei10/edk2/tree/ECC
> > Results can be view in below azure server.
> >
> https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12
> &_a=summary
> >
> > Patches
> > 1/16: It's a lib necessary for py3 to run Ecc on azure servers.
> >
> > 2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be 
> > run
> >  on azure servers for open ci, or a local virtual environment.
> >
> > 3/16~16/16: We consider some cases that will report out Ecc issues but they
> won't
> >  be fixed, like submodule and industry standard related things. So we
> >  add two configuration fields "Exception" and "IgnoreFiles" for people
> >  to use. These patches add configuration in yaml files for Ecc check.
> >
> > Cc: Bob Feng 
> > Cc: Bret Barkelew 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Sean Brogan 
> >
> > v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.
> >
> > v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
> > Update 2/17, designate the version of antlr4 is 4.7.1.
> > Add 4/17~17/17.
> >
> > v4. Update 1/17, remove the function EdksetupRebuild(), instead add
> > function SetupEnvironment(). Update variables' format and type hints
> > to pass flake8 and mypy.
> >
> > v5. Conver the former method to plugin solution, to align with
> > other check points on open ci.
> >
> > v6. The 1/16 patch is missed in v5 series. Now add it in v6.
> >
> > v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.
> 
> What is the bug? Where is it fixed?

V6 plugin pipeline link:
https://dev.azure.com/shengleizhang/shengleizhang/_build/results?buildId=282=logs=9b8d87a5-bd93-5358-8ffa-588e312c4376=282a77bb-da29-5801-6299-2bbe15d5aabb
v7 plugin pipeline link:
https://dev.azure.com/shengleizhang/shengleizhang/_build/results?buildId=316=logs=5e3952f2-9c8a-5394-82c1-a803bcab3ca3=7ea9e85e-5c3d-5fcf-865e-8449f16cc745

For the same pull request, v6 plugin can't report out the Ecc issues under 
Linux OS.

Thanks,
Shenglei

> 
> /
> Leif
> 
> > Shenglei Zhang (16):
> >   pip-requirements.txt: Add Ecc required lib
> >   .pytool/Plugin: Add a plugin EccCheck
> >   MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
> >   ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
> >   CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
> >   EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
> >   FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
> >   FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
> >   MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
> >   NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
> >   OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
> >   PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
> >   SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
> >   ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
> >   UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
> >   UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file
> >
> >  .pytool/Plugin/EccCheck/EccCheck.py   | 267 ++
> >  .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
> >  .pytool/Plugin/EccCheck/Readme.md |  15 +
> >  ArmVirtPkg/ArmVirtPkg.ci.yaml |  11 +
> >  CryptoPkg/CryptoPkg.ci.yaml   |  11 +
> >  E

[edk2-devel] [PATCH v7 16/16] UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml 
b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
index 51e172537f8a..7e9fc5d005fb 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
@@ -5,6 +5,16 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "UnitTestFrameworkPkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62087): https://edk2.groups.io/g/devel/message/62087
Mute This Topic: https://groups.io/mt/75329208/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 11/16] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Shenglei Zhang 
Acked-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
index 98992f0429ff..e151cebf7020 100644
--- a/OvmfPkg/OvmfPkg.ci.yaml
+++ b/OvmfPkg/OvmfPkg.ci.yaml
@@ -5,9 +5,20 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62082): https://edk2.groups.io/g/devel/message/62082
Mute This Topic: https://groups.io/mt/75329201/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 15/16] UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
Reviewed-by: Eric Dong 
Acked-by: Laszlo Ersek 
---
 UefiCpuPkg/UefiCpuPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.ci.yaml b/UefiCpuPkg/UefiCpuPkg.ci.yaml
index 99e460a8b090..0e216344cd53 100644
--- a/UefiCpuPkg/UefiCpuPkg.ci.yaml
+++ b/UefiCpuPkg/UefiCpuPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for UefiCpuPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "UefiCpuPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62086): https://edk2.groups.io/g/devel/message/62086
Mute This Topic: https://groups.io/mt/75329207/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 12/16] PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml 
b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
index be470807bd9e..c59287064d65 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for PcAtChipsetPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "PcAtChipsetPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62083): https://edk2.groups.io/g/devel/message/62083
Mute This Topic: https://groups.io/mt/75329202/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 13/16] SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Chao Zhang 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Jian J Wang 
---
 SecurityPkg/SecurityPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml
index 953219053318..a0e143140875 100644
--- a/SecurityPkg/SecurityPkg.ci.yaml
+++ b/SecurityPkg/SecurityPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for SecurityPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "SecurityPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62084): https://edk2.groups.io/g/devel/message/62084
Mute This Topic: https://groups.io/mt/75329203/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 10/16] NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Maciej Rabeda 
---
 NetworkPkg/NetworkPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/NetworkPkg/NetworkPkg.ci.yaml b/NetworkPkg/NetworkPkg.ci.yaml
index 70f2e1014748..d45faf0ac967 100644
--- a/NetworkPkg/NetworkPkg.ci.yaml
+++ b/NetworkPkg/NetworkPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for NetworkPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "NetworkPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62081): https://edk2.groups.io/g/devel/message/62081
Mute This Topic: https://groups.io/mt/75329200/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 14/16] ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 ShellPkg/ShellPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/ShellPkg/ShellPkg.ci.yaml b/ShellPkg/ShellPkg.ci.yaml
index 67de34a2556e..eedc173738dc 100644
--- a/ShellPkg/ShellPkg.ci.yaml
+++ b/ShellPkg/ShellPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for ShellPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "ShellPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62085): https://edk2.groups.io/g/devel/message/62085
Mute This Topic: https://groups.io/mt/75329206/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-06 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
As planed we will enable Ecc check for edk2 on open ci. And they are
ready now. I appreciate receiving feedback and comments if someone
find errors or false positive issues.

I created a pipline of EccCheck for my forked edk2. Welcome everyone to
create pull request to test the quality of this plugin.
My forked tree: https://github.com/shenglei10/edk2

And I also created some test cases for ECC plugin. Below are test cases.
https://github.com/shenglei10/edk2/tree/ECC
Results can be view in below azure server.
https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12&_a=summary

Patches
1/16: It's a lib necessary for py3 to run Ecc on azure servers.

2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
 on azure servers for open ci, or a local virtual environment.

3/16~16/16: We consider some cases that will report out Ecc issues but they 
won't
 be fixed, like submodule and industry standard related things. So we
 add two configuration fields "Exception" and "IgnoreFiles" for people
 to use. These patches add configuration in yaml files for Ecc check.

Cc: Bob Feng 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 

v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.

v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
Update 2/17, designate the version of antlr4 is 4.7.1.
Add 4/17~17/17.

v4. Update 1/17, remove the function EdksetupRebuild(), instead add
function SetupEnvironment(). Update variables' format and type hints
to pass flake8 and mypy.

v5. Conver the former method to plugin solution, to align with
other check points on open ci.

v6. The 1/16 patch is missed in v5 series. Now add it in v6.

v7. Fix a bug that Ecc plugin can not be run correctly under Linux OS.

Shenglei Zhang (16):
  pip-requirements.txt: Add Ecc required lib
  .pytool/Plugin: Add a plugin EccCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
  FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
  MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
  ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
  UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

 .pytool/Plugin/EccCheck/EccCheck.py   | 267 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 ArmVirtPkg/ArmVirtPkg.ci.yaml |  11 +
 CryptoPkg/CryptoPkg.ci.yaml   |  11 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |  11 +
 FatPkg/FatPkg.ci.yaml |  11 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |  11 +
 MdeModulePkg/MdeModulePkg.ci.yaml |  11 +
 MdePkg/MdePkg.ci.yaml |  11 +
 NetworkPkg/NetworkPkg.ci.yaml |  11 +
 OvmfPkg/OvmfPkg.ci.yaml   |  11 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |  11 +
 SecurityPkg/SecurityPkg.ci.yaml   |  11 +
 ShellPkg/ShellPkg.ci.yaml |  11 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |  11 +
 .../UnitTestFrameworkPkg.ci.yaml  |  10 +
 pip-requirements.txt  |   1 +
 18 files changed, 447 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62071): https://edk2.groups.io/g/devel/message/62071
Mute This Topic: https://groups.io/mt/75329189/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 04/16] ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Shenglei Zhang 
Acked-by: Laszlo Ersek 
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
index 4553725ee528..3b321c806a62 100644
--- a/ArmVirtPkg/ArmVirtPkg.ci.yaml
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -5,9 +5,20 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62075): https://edk2.groups.io/g/devel/message/62075
Mute This Topic: https://groups.io/mt/75329193/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 02/16] .pytool/Plugin: Add a plugin EccCheck

2020-07-06 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
EccCheck is a plugin to report Ecc issues for code in pull request
, which will be run on open ci.
But note not each kind of issue could be reported out.
It can only handle the issues, whose line number in CSV report
accurately map with their code in source code files. And Ecc issues
about comments can also be handled.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py   | 267 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 3 files changed, 293 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
new file mode 100644
index ..3857f472eda2
--- /dev/null
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -0,0 +1,267 @@
+# @file EccCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import re
+import csv
+import xml.dom.minidom
+from typing import List, Dict, Tuple
+import logging
+from io import StringIO
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class EccCheck(ICiBuildPlugin):
+"""
+A CiBuildPlugin that finds the Ecc issues of newly added code in pull 
request.
+
+Configuration options:
+"EccCheck": {
+"ExceptionList": [],
+"IgnoreFiles": []
+},
+"""
+
+ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
+FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
+LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
+LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for efi coding style for " + packagename, packagename + 
".EccCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+edk2_path = Edk2pathObj.WorkspacePath
+python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
+env = shell_environment.GetEnvironment()
+env.set_shell_var('PYTHONPATH', python_path)
+env.set_shell_var('WORKSPACE', edk2_path)
+self.ECC_PASS = True
+self.ApplyConfig(pkgconfig, edk2_path, packagename)
+modify_dir_list = self.GetModifyDir(packagename)
+patch = self.GetDiff(packagename)
+ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
+self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
+ecc_log = os.path.join(edk2_path, "Ecc.log")
+if self.ECC_PASS:
+tc.SetSuccess()
+self.RemoveFile(ecc_log)
+return 0
+else:
+with open(ecc_log, encoding='utf8') as output:
+ecc_output = output.readlines()
+for line in ecc_output:
+logging.error(line)
+self.RemoveFile(ecc_log)
+tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc 
detected issues")
+return 1
+
+def GetDiff(self, pkg: str) -> List[str]:
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+return patch
+
+def RemoveFile(self, file: str) -> 

[edk2-devel] [PATCH v7 07/16] FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
---
 FatPkg/FatPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/FatPkg/FatPkg.ci.yaml b/FatPkg/FatPkg.ci.yaml
index 8b0fb1d4fcd5..e6a4c810976f 100644
--- a/FatPkg/FatPkg.ci.yaml
+++ b/FatPkg/FatPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for FatPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "FatPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62078): https://edk2.groups.io/g/devel/message/62078
Mute This Topic: https://groups.io/mt/75329197/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 09/16] MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Liming Gao 
---
 MdePkg/MdePkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index 3268f1535499..b6d7c57de83c 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for MdePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62080): https://edk2.groups.io/g/devel/message/62080
Mute This Topic: https://groups.io/mt/75329199/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 01/16] pip-requirements.txt: Add Ecc required lib

2020-07-06 Thread Zhang, Shenglei
antlr4-python3-runtime is a lib to support Ecc run with Py3.x.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Liming Gao 
---
 pip-requirements.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pip-requirements.txt b/pip-requirements.txt
index 574dac43b1a6..0fecd37f2a83 100644
--- a/pip-requirements.txt
+++ b/pip-requirements.txt
@@ -14,3 +14,4 @@
 
 edk2-pytool-library==0.10.*
 edk2-pytool-extensions~=0.13.3
+antlr4-python3-runtime==4.7.1
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62072): https://edk2.groups.io/g/devel/message/62072
Mute This Topic: https://groups.io/mt/75329190/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 05/16] CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
Reviewed-by: Jian J Wang 
---
 CryptoPkg/CryptoPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index f54ebfb22e70..c60d8bac6dee 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for CryptoPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "CryptoPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62076): https://edk2.groups.io/g/devel/message/62076
Mute This Topic: https://groups.io/mt/75329194/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 03/16] MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/MdeModulePkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml 
b/MdeModulePkg/MdeModulePkg.ci.yaml
index 1cfc1328390e..0ed929855417 100644
--- a/MdeModulePkg/MdeModulePkg.ci.yaml
+++ b/MdeModulePkg/MdeModulePkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for MdeModulePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdeModulePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62074): https://edk2.groups.io/g/devel/message/62074
Mute This Topic: https://groups.io/mt/75329192/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v7 06/16] EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check

2020-07-06 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 EmulatorPkg/EmulatorPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
index 81f81780ec76..a664f4462e5d 100644
--- a/EmulatorPkg/EmulatorPkg.ci.yaml
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -5,9 +5,20 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62077): https://edk2.groups.io/g/devel/message/62077
Mute This Topic: https://groups.io/mt/75329196/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v6 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-05 Thread Zhang, Shenglei
Hi Lazslo,

Looks like I missed your ACK. I  will add it in latter versions.

Thanks,
Shenglei

> -Original Message-
> From: Laszlo Ersek 
> Sent: Saturday, July 4, 2020 12:02 AM
> To: Gao, Liming ; devel@edk2.groups.io; Zhang,
> Shenglei ; Leif Lindholm ;
> af...@apple.com
> Cc: Feng, Bob C ; Bret Barkelew
> ; Kinney, Michael D
> ; Sean Brogan 
> Subject: Re: [edk2-devel] [PATCH v6 00/16] Add a plugin to check Ecc issues
> for edk2 on open ci
> 
> Hi Liming,
> 
> On 07/03/20 17:13, Gao, Liming wrote:
> > Include more people and collect the comments.
> >
> > ECC is the source file coding style checker. Here is its wiki page
> https://github.com/tianocore/tianocore.github.io/wiki/ECC-tool.
> > If the changed code doesn't follow edk2 coding style, ECC will report the
> error.
> >
> > This patch set enables ECC checker in open CI for each patch coming into
> edk2 repo. That means new changes need to follow edk2 coding style.
> > Otherwise, new changes can't be merged.
> >
> > If you have some comments for ECC checker in open CI, please reply this
> mail.
> 
> 
> (1) The ArmVirtPkg (v6 04/16) and OvmfPkg (v6 11/16) patches already
> carry my ACKs; from here:
> 
>   https://edk2.groups.io/g/devel/message/61154
>   https://edk2.groups.io/g/devel/message/61155
> 
> 
> (2) The UefiCpuPkg patch (v6 15/16) *should* also carry my ACK, from here:
> 
>   https://edk2.groups.io/g/devel/message/61156
> 
> Shenglei picked up my ACK for v4 and v5:
> 
>   https://edk2.groups.io/g/devel/message/61283
>   https://edk2.groups.io/g/devel/message/61852
> 
> but then dropped it for v6:
> 
>   https://edk2.groups.io/g/devel/message/61894
> 
> Shenglei, can you please explain why you dropped my ACK from the
> UefiCpuPkg patch, in v6?
> 
> 
> (3) The initial discussion between Shenglei and myself are under the v2
> posting:
> 
>   https://edk2.groups.io/g/devel/message/60665
>   https://edk2.groups.io/g/devel/message/60711
>   https://edk2.groups.io/g/devel/message/60961
> 
> I'm happy with this work because it lets package maintainers tailor ECC
> as they see appropriate.
> 
> Thanks,
> Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62058): https://edk2.groups.io/g/devel/message/62058
Mute This Topic: https://groups.io/mt/75227224/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v6 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-07-02 Thread Zhang, Shenglei
Liming,

Yes we have instructions to run plugins locally. Since they are not good enough 
and not easy to find.
I provide the following steps.

Pre-Requisites
* Windows OS
* Make sure you have python 3.7.x or newer available on path
* Make sure you have git installed and available on path

1. Navigate to edk2
2. run `python -m venv pytool-ext-venv`
3. run `pytool-ext-venv\Scripts\activate.bat`
4. run `pip install --upgrade -r pip-requirements.txt`
5. run `stuart_ci_build -c .pytool/CISettings.py TOOL_CHAIN_TAG=NO-TARGET`

It's strongly to remove any anther plugin when developers want to reproduce Ecc 
issues.

Thanks,
Shenglei

> -Original Message-
> From: Gao, Liming 
> Sent: Thursday, July 2, 2020 10:31 AM
> To: devel@edk2.groups.io; Zhang, Shenglei 
> Cc: Feng, Bob C ; Bret Barkelew
> ; Kinney, Michael D
> ; Sean Brogan 
> Subject: RE: [edk2-devel] [PATCH v6 00/16] Add a plugin to check Ecc issues
> for edk2 on open ci
> 
> Shenglei:
>   Thanks for your work to enable ECC checker in open CI. Have you the step
> to run this checker in local environment? The developer may want to
> reproduce the issue and fix it.
> 
> Thanks
> Liming
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Zhang,
> Shenglei
> Sent: 2020年7月1日 9:55
> To: devel@edk2.groups.io
> Cc: Feng, Bob C ; Bret Barkelew
> ; Kinney, Michael D
> ; Gao, Liming ; Sean
> Brogan 
> Subject: [edk2-devel] [PATCH v6 00/16] Add a plugin to check Ecc issues for
> edk2 on open ci
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
> As planed we will enable Ecc check for edk2 on open ci. And they are ready
> now. I appreciate receiving feedback and comments if someone find errors
> or false positive issues.
> 
> I created a pipline of EccCheck for my forked edk2. Welcome everyone to
> create pull request to test the quality of this plugin.
> My forked tree: https://github.com/shenglei10/edk2
> 
> And I also created some test cases for ECC plugin. Below are test cases.
> https://github.com/shenglei10/edk2/tree/ECC
> Results can be view in below azure server.
> https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12
> &_a=summary
> 
> Patches
> 1/16: It's a lib necessary for py3 to run Ecc on azure servers.
> 
> 2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
>  on azure servers for open ci, or a local virtual environment.
> 
> 3/16~16/16: We consider some cases that will report out Ecc issues but they
> won't
>  be fixed, like submodule and industry standard related things. So we
>  add two configuration fields "Exception" and "IgnoreFiles" for people
>  to use. These patches add configuration in yaml files for Ecc check.
> 
> Cc: Bob Feng 
> Cc: Bret Barkelew 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> 
> v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.
> 
> v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
> Update 2/17, designate the version of antlr4 is 4.7.1.
> Add 4/17~17/17.
> 
> v4. Update 1/17, remove the function EdksetupRebuild(), instead add
> function SetupEnvironment(). Update variables' format and type hints
> to pass flake8 and mypy.
> 
> v5. Conver the former method to plugin solution, to align with
> other check points on open ci.
> 
> v6. The 1/16 patch is missed in v5 series. Now add it in v6.
> 
> Shenglei Zhang (16):
>   pip-requirements.txt: Add Ecc required lib
>   .pytool/Plugin: Add a plugin EccCheck
>   MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
>   ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
>   CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
>   EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
>   FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
>   FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
>   MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
>   NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
>   OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
>   PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
>   SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
>   ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
>   UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
>   UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file
> 
>  .pytool/Plugin/EccCheck/EccCheck.py   | 268 ++
>  .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
>  .pytool/Plugin/EccCheck/Readme.md |  15 +
>  ArmVirtPkg/ArmV

Re: [edk2-devel] [PATCH v2 4/4] .azurepipelines: Add DynamicTablesPkg to CI matrix

2020-06-30 Thread Zhang, Shenglei
Reviewed-by: Shenglei Zhang 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Sami
> Mujawar
> Sent: Wednesday, July 1, 2020 3:37 AM
> To: devel@edk2.groups.io
> Cc: Sami Mujawar ; alexei.fedo...@arm.com;
> sean.bro...@microsoft.com; Gao, Liming ; Kinney,
> Michael D ; bret.barke...@microsoft.com;
> ard.biesheu...@arm.com; matteo.carl...@arm.com;
> laura.more...@arm.com; n...@arm.com
> Subject: [edk2-devel] [PATCH v2 4/4] .azurepipelines: Add DynamicTablesPkg
> to CI matrix
> 
> Add DynamicTablesPkg to the Core CI matrix.
> 
> Signed-off-by: Sami Mujawar 
> Suggested-by: Sean Brogan 
> ---
> 
> Notes:
> v2:
>  - New patch in series to add DynamicTablesPkg to Core CI matrix  [Sami]
>  - Add DynamicTablesPkg to Core CI matrix [Sean]
> 
>  .azurepipelines/templates/pr-gate-build-job.yml | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/.azurepipelines/templates/pr-gate-build-job.yml
> b/.azurepipelines/templates/pr-gate-build-job.yml
> index
> a9f89aa68451b5f7de6a4163487b267f94a383ad..2683687a1c7b869519dae5183
> b7dd2cb8c349272 100644
> --- a/.azurepipelines/templates/pr-gate-build-job.yml
> +++ b/.azurepipelines/templates/pr-gate-build-job.yml
> @@ -4,6 +4,7 @@
>  # template file used to build supported packages.
>  #
>  # Copyright (c) Microsoft Corporation.
> +# Copyright (c) 2020, ARM Limited. All rights reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
> 
> @@ -36,7 +37,7 @@ jobs:
>  Build.Pkgs: 'PcAtChipsetPkg,ShellPkg'
>  Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
>TARGET_FMP_FAT_TEST:
> -Build.Pkgs: 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg'
> +Build.Pkgs:
> 'FmpDevicePkg,FatPkg,UnitTestFrameworkPkg,DynamicTablesPkg'
>  Build.Targets: 'DEBUG,RELEASE,NO-TARGET,NOOPT'
>TARGET_CRYPTO:
>  Build.Pkgs: 'CryptoPkg'
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61899): https://edk2.groups.io/g/devel/message/61899
Mute This Topic: https://groups.io/mt/75221030/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 3/3] .pytool: CI Settings to support DynamicTablesPkg

2020-06-30 Thread Zhang, Shenglei
Reviewed-by: Shenglei Zhang 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Sami
> Mujawar
> Sent: Wednesday, July 1, 2020 3:37 AM
> To: devel@edk2.groups.io
> Cc: Sami Mujawar ; alexei.fedo...@arm.com;
> sean.bro...@microsoft.com; Gao, Liming ; Kinney,
> Michael D ; bret.barke...@microsoft.com;
> ard.biesheu...@arm.com; matteo.carl...@arm.com;
> laura.more...@arm.com; n...@arm.com
> Subject: [edk2-devel] [PATCH v2 3/3] .pytool: CI Settings to support
> DynamicTablesPkg
> 
> Update pytools configuration to enable DynamicTablesPkg
> and update package status in documentation.
> 
> Signed-off-by: Sami Mujawar 
> ---
> 
> Notes:
> v2:
>  - No change, resend patch with v2 series  [Sami]
> 
> v1:
>  - Add CI settings to support DynamicTablesPkg [Sami]
> 
>  .pytool/CISettings.py | 2 ++
>  .pytool/Readme.md | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
> index
> bac60ecbaaf51ef4cf2f3ec7616e8ba2caa645ea..0c2dd0181aa2d3b3650e255da9
> 24d028d872513d 100644
> --- a/.pytool/CISettings.py
> +++ b/.pytool/CISettings.py
> @@ -2,6 +2,7 @@
>  #
>  # Copyright (c) Microsoft Corporation.
>  # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
> reserved.
> +# Copyright (c) 2020, ARM Limited. All rights reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
>  import os
> @@ -41,6 +42,7 @@ class Settings(CiBuildSettingsManager,
> UpdateSettingsManager, SetupSettingsManag
>  These should be edk2 workspace relative paths '''
> 
>  return ("ArmVirtPkg",
> +"DynamicTablesPkg",
>  "EmulatorPkg",
>  "MdePkg",
>  "MdeModulePkg",
> diff --git a/.pytool/Readme.md b/.pytool/Readme.md
> index
> c401dba18fbf39a1431c3dbbfa30353de3ecb4b4..2fc905b8674fc217044baa2ff7
> 21f3c6afa504c9 100644
> --- a/.pytool/Readme.md
> +++ b/.pytool/Readme.md
> @@ -8,7 +8,7 @@
>  | ArmPlatformPkg   |
>  | ArmVirtPkg   | SEE PACKAGE README | SEE PACKAGE README |
>  | CryptoPkg| :heavy_check_mark: | :heavy_check_mark: | Spell
> checking in audit mode
> -| DynamicTablesPkg |
> +| DynamicTablesPkg || :heavy_check_mark: |
>  | EmbeddedPkg  |
>  | EmulatorPkg  | SEE PACKAGE README | SEE PACKAGE README | Spell
> checking in audit mode
>  | FatPkg   | :heavy_check_mark: | :heavy_check_mark: |
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61898): https://edk2.groups.io/g/devel/message/61898
Mute This Topic: https://groups.io/mt/75221027/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 06/16] EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jordan Justen 
Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 EmulatorPkg/EmulatorPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.ci.yaml b/EmulatorPkg/EmulatorPkg.ci.yaml
index 81f81780ec76..a664f4462e5d 100644
--- a/EmulatorPkg/EmulatorPkg.ci.yaml
+++ b/EmulatorPkg/EmulatorPkg.ci.yaml
@@ -5,9 +5,20 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61885): https://edk2.groups.io/g/devel/message/61885
Mute This Topic: https://groups.io/mt/75227232/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 10/16] NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Maciej Rabeda 
---
 NetworkPkg/NetworkPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/NetworkPkg/NetworkPkg.ci.yaml b/NetworkPkg/NetworkPkg.ci.yaml
index 70f2e1014748..d45faf0ac967 100644
--- a/NetworkPkg/NetworkPkg.ci.yaml
+++ b/NetworkPkg/NetworkPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for NetworkPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "NetworkPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61889): https://edk2.groups.io/g/devel/message/61889
Mute This Topic: https://groups.io/mt/75227238/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 09/16] MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 MdePkg/MdePkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index 3268f1535499..b6d7c57de83c 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for MdePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61888): https://edk2.groups.io/g/devel/message/61888
Mute This Topic: https://groups.io/mt/75227236/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 03/16] MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Change-Id: I55c78eed392a8354a7201d17a591e4ff8dc3d6e9
Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/MdeModulePkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml 
b/MdeModulePkg/MdeModulePkg.ci.yaml
index 1cfc1328390e..0ed929855417 100644
--- a/MdeModulePkg/MdeModulePkg.ci.yaml
+++ b/MdeModulePkg/MdeModulePkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for MdeModulePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined ci/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "MdeModulePkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61882): https://edk2.groups.io/g/devel/message/61882
Mute This Topic: https://groups.io/mt/75227228/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 14/16] ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 ShellPkg/ShellPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/ShellPkg/ShellPkg.ci.yaml b/ShellPkg/ShellPkg.ci.yaml
index 67de34a2556e..eedc173738dc 100644
--- a/ShellPkg/ShellPkg.ci.yaml
+++ b/ShellPkg/ShellPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for ShellPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "ShellPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61893): https://edk2.groups.io/g/devel/message/61893
Mute This Topic: https://groups.io/mt/75227244/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 07/16] FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
---
 FatPkg/FatPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/FatPkg/FatPkg.ci.yaml b/FatPkg/FatPkg.ci.yaml
index 8b0fb1d4fcd5..e6a4c810976f 100644
--- a/FatPkg/FatPkg.ci.yaml
+++ b/FatPkg/FatPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for FatPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "FatPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61886): https://edk2.groups.io/g/devel/message/61886
Mute This Topic: https://groups.io/mt/75227233/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 08/16] FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Liming Gao 
Cc: Michael D Kinney 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
---
 FmpDevicePkg/FmpDevicePkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/FmpDevicePkg/FmpDevicePkg.ci.yaml 
b/FmpDevicePkg/FmpDevicePkg.ci.yaml
index 74a0aefe8e49..b84400f06ffd 100644
--- a/FmpDevicePkg/FmpDevicePkg.ci.yaml
+++ b/FmpDevicePkg/FmpDevicePkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for FmpDevicePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "FmpDevicePkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61887): https://edk2.groups.io/g/devel/message/61887
Mute This Topic: https://groups.io/mt/75227235/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 16/16] UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml 
b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
index 51e172537f8a..7e9fc5d005fb 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
@@ -5,6 +5,16 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "UnitTestFrameworkPkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61895): https://edk2.groups.io/g/devel/message/61895
Mute This Topic: https://groups.io/mt/75227247/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 13/16] SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Chao Zhang 
Signed-off-by: Shenglei Zhang 
---
 SecurityPkg/SecurityPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml
index 953219053318..a0e143140875 100644
--- a/SecurityPkg/SecurityPkg.ci.yaml
+++ b/SecurityPkg/SecurityPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for SecurityPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "SecurityPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61892): https://edk2.groups.io/g/devel/message/61892
Mute This Topic: https://groups.io/mt/75227243/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 04/16] ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Shenglei Zhang 
Acked-by: Laszlo Ersek 
---
 ArmVirtPkg/ArmVirtPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
index 4553725ee528..3b321c806a62 100644
--- a/ArmVirtPkg/ArmVirtPkg.ci.yaml
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -5,9 +5,20 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61883): https://edk2.groups.io/g/devel/message/61883
Mute This Topic: https://groups.io/mt/75227230/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 05/16] CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
---
 CryptoPkg/CryptoPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index f54ebfb22e70..c60d8bac6dee 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for CryptoPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "CryptoPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61884): https://edk2.groups.io/g/devel/message/61884
Mute This Topic: https://groups.io/mt/75227231/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 11/16] OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Signed-off-by: Shenglei Zhang 
Acked-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.ci.yaml b/OvmfPkg/OvmfPkg.ci.yaml
index 98992f0429ff..e151cebf7020 100644
--- a/OvmfPkg/OvmfPkg.ci.yaml
+++ b/OvmfPkg/OvmfPkg.ci.yaml
@@ -5,9 +5,20 @@
 # used for code analysis.
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "" # Don't support this test
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61890): https://edk2.groups.io/g/devel/message/61890
Mute This Topic: https://groups.io/mt/75227239/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 12/16] PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml 
b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
index be470807bd9e..c59287064d65 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for PcAtChipsetPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "PcAtChipsetPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61891): https://edk2.groups.io/g/devel/message/61891
Mute This Topic: https://groups.io/mt/75227240/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 01/16] pip-requirements.txt: Add Ecc required lib

2020-06-30 Thread Zhang, Shenglei
antlr4-python3-runtime is a lib to support Ecc run with Py3.x.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 pip-requirements.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pip-requirements.txt b/pip-requirements.txt
index 574dac43b1a6..0fecd37f2a83 100644
--- a/pip-requirements.txt
+++ b/pip-requirements.txt
@@ -14,3 +14,4 @@
 
 edk2-pytool-library==0.10.*
 edk2-pytool-extensions~=0.13.3
+antlr4-python3-runtime==4.7.1
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61880): https://edk2.groups.io/g/devel/message/61880
Mute This Topic: https://groups.io/mt/75227225/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 15/16] UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Shenglei Zhang 
Acked-by: Ray Ni 
---
 UefiCpuPkg/UefiCpuPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.ci.yaml b/UefiCpuPkg/UefiCpuPkg.ci.yaml
index 99e460a8b090..0e216344cd53 100644
--- a/UefiCpuPkg/UefiCpuPkg.ci.yaml
+++ b/UefiCpuPkg/UefiCpuPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for UefiCpuPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "UefiCpuPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61894): https://edk2.groups.io/g/devel/message/61894
Mute This Topic: https://groups.io/mt/75227246/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v6 02/16] .pytool/Plugin: Add a plugin EccCheck

2020-06-30 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
EccCheck is a plugin to report Ecc issues for code in pull request
, which will be run on open ci.
But note not each kind of issue could be reported out.
It can only handle the issues, whose line number in CSV report
accurately map with their code in source code files. And Ecc issues
about comments can also be handled.

Cc: Sean Brogan 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .pytool/Plugin/EccCheck/EccCheck.py   | 268 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 3 files changed, 294 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

diff --git a/.pytool/Plugin/EccCheck/EccCheck.py 
b/.pytool/Plugin/EccCheck/EccCheck.py
new file mode 100644
index ..ccdb66be616d
--- /dev/null
+++ b/.pytool/Plugin/EccCheck/EccCheck.py
@@ -0,0 +1,268 @@
+# @file EccCheck.py
+#
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+import os
+import re
+import csv
+import xml.dom.minidom
+from typing import List, Dict, Tuple
+import logging
+from io import StringIO
+from edk2toolext.environment import shell_environment
+from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
+from edk2toolext.environment.var_dict import VarDict
+from edk2toollib.utility_functions import RunCmd
+
+
+class EccCheck(ICiBuildPlugin):
+"""
+A CiBuildPlugin that finds the Ecc issues of newly added code in pull 
request.
+
+Configuration options:
+"EccCheck": {
+"ExceptionList": [],
+"IgnoreFiles": []
+},
+"""
+
+ReModifyFile = re.compile(r'[B-Q,S-Z]+[\d]*\t(.*)')
+FindModifyFile = re.compile(r'\+\+\+ b\/(.*)')
+LineScopePattern = (r'@@ -\d*\,*\d* \+\d*\,*\d* @@.*')
+LineNumRange = re.compile(r'@@ -\d*\,*\d* \+(\d*)\,*(\d*) @@.*')
+
+def GetTestName(self, packagename: str, environment: VarDict) -> tuple:
+""" Provide the testcase name and classname for use in reporting
+testclassname: a descriptive string for the testcase can include 
whitespace
+classname: should be patterned ..
+
+Args:
+  packagename: string containing name of package to build
+  environment: The VarDict for the test to run in
+Returns:
+a tuple containing the testcase name and the classname
+(testcasename, classname)
+"""
+return ("Check for efi coding style for " + packagename, packagename + 
".EccCheck")
+
+##
+# External function of plugin.  This function is used to perform the task 
of the ci_build_plugin Plugin
+#
+#   - package is the edk2 path to package.  This means 
workspace/packagepath relative.
+#   - edk2path object configured with workspace and packages path
+#   - PkgConfig Object (dict) for the pkg
+#   - EnvConfig Object
+#   - Plugin Manager Instance
+#   - Plugin Helper Obj Instance
+#   - Junit Logger
+#   - output_stream the StringIO output stream from this plugin via logging
+def RunBuildPlugin(self, packagename, Edk2pathObj, pkgconfig, environment, 
PLM, PLMHelper, tc, output_stream=None):
+edk2_path = Edk2pathObj.WorkspacePath
+python_path = os.path.join(edk2_path, "BaseTools", "Source", "Python")
+env = shell_environment.GetEnvironment()
+env.set_shell_var('PYTHONPATH', python_path)
+env.set_shell_var('WORKSPACE', edk2_path)
+self.ECC_PASS = True
+self.ApplyConfig(pkgconfig, edk2_path, packagename)
+modify_dir_list = self.GetModifyDir(packagename)
+patch = self.GetDiff(packagename)
+ecc_diff_range = self.GetDiffRange(patch, packagename, edk2_path)
+self.GenerateEccReport(modify_dir_list, ecc_diff_range, edk2_path)
+ecc_log = os.path.join(edk2_path, "ecc.log")
+if self.ECC_PASS:
+tc.SetSuccess()
+self.RemoveFile(ecc_log)
+return 0
+else:
+with open(ecc_log, encoding='utf8') as output:
+ecc_output = output.readlines()
+for line in ecc_output:
+logging.error(line)
+self.RemoveFile(ecc_log)
+tc.SetFailed("EccCheck failed for {0}".format(packagename), "Ecc 
detected issues")
+return 1
+
+def GetDiff(self, pkg: str) -> List[str]:
+return_buffer = StringIO()
+params = "diff --unified=0 origin/master HEAD"
+RunCmd("git", params, outstream=return_buffer)
+p = return_buffer.getvalue().strip()
+patch = p.split("\n")
+return_buffer.close()
+
+return patch
+
+def RemoveFile(self, file: str) -> 

[edk2-devel] [PATCH v6 00/16] Add a plugin to check Ecc issues for edk2 on open ci

2020-06-30 Thread Zhang, Shenglei
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2606
As planed we will enable Ecc check for edk2 on open ci. And they are
ready now. I appreciate receiving feedback and comments if someone
find errors or false positive issues.

I created a pipline of EccCheck for my forked edk2. Welcome everyone to
create pull request to test the quality of this plugin.
My forked tree: https://github.com/shenglei10/edk2

And I also created some test cases for ECC plugin. Below are test cases.
https://github.com/shenglei10/edk2/tree/ECC
Results can be view in below azure server.
https://dev.azure.com/shengleizhang/shengleizhang/_build?definitionId=12&_a=summary

Patches
1/16: It's a lib necessary for py3 to run Ecc on azure servers.

2/16: EccCheck.py is a plugin to report Ecc issues for commits. It can be run
 on azure servers for open ci, or a local virtual environment.

3/16~16/16: We consider some cases that will report out Ecc issues but they 
won't
 be fixed, like submodule and industry standard related things. So we
 add two configuration fields "Exception" and "IgnoreFiles" for people
 to use. These patches add configuration in yaml files for Ecc check.

Cc: Bob Feng 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 

v2: Update 1/17, fix the bug that the script can't hanlde multiple commits.

v3: Update 1/17, set the only workalbe workspace is edk2 root directory.
Update 2/17, designate the version of antlr4 is 4.7.1.
Add 4/17~17/17.

v4. Update 1/17, remove the function EdksetupRebuild(), instead add
function SetupEnvironment(). Update variables' format and type hints
to pass flake8 and mypy.

v5. Conver the former method to plugin solution, to align with
other check points on open ci.

v6. The 1/16 patch is missed in v5 series. Now add it in v6.

Shenglei Zhang (16):
  pip-requirements.txt: Add Ecc required lib
  .pytool/Plugin: Add a plugin EccCheck
  MdeModulePkg/MdeModulePkg.ci.yaml: Add configuration for Ecc check
  ArmVirtPkg/ArmVirtPkg.ci.yaml: Add configuration for Ecc check
  CryptoPkg/CryptoPkg.ci.yaml: Add configuration for Ecc check
  EmulatorPkg/EmulatorPkg.ci.yaml: Add configuration for Ecc check
  FatPkg/FatPkg.ci.yaml: Add configuration for Ecc check
  FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check
  MdePkg/MdePkg.ci.yaml: Add configuration for Ecc check
  NetworkPkg/NetworkPkg.ci.yaml: Add configuration for Ecc check
  OvmfPkg/OvmfPkg.ci.yaml: Add configuration for Ecc check
  PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check
  SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check
  ShellPkg/ShellPkg.ci.yaml: Add configuration for Ecc check
  UefiCpuPkg/UefiCpuPkg.ci.yaml: Add configuration for Ecc check
  UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

 .pytool/Plugin/EccCheck/EccCheck.py   | 268 ++
 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml |  11 +
 .pytool/Plugin/EccCheck/Readme.md |  15 +
 ArmVirtPkg/ArmVirtPkg.ci.yaml |  11 +
 CryptoPkg/CryptoPkg.ci.yaml   |  11 +
 EmulatorPkg/EmulatorPkg.ci.yaml   |  11 +
 FatPkg/FatPkg.ci.yaml |  11 +
 FmpDevicePkg/FmpDevicePkg.ci.yaml |  11 +
 MdeModulePkg/MdeModulePkg.ci.yaml |  11 +
 MdePkg/MdePkg.ci.yaml |  11 +
 NetworkPkg/NetworkPkg.ci.yaml |  11 +
 OvmfPkg/OvmfPkg.ci.yaml   |  11 +
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml |  11 +
 SecurityPkg/SecurityPkg.ci.yaml   |  11 +
 ShellPkg/ShellPkg.ci.yaml |  11 +
 UefiCpuPkg/UefiCpuPkg.ci.yaml |  11 +
 .../UnitTestFrameworkPkg.ci.yaml  |  10 +
 pip-requirements.txt  |   1 +
 18 files changed, 448 insertions(+)
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck.py
 create mode 100644 .pytool/Plugin/EccCheck/EccCheck_plug_in.yaml
 create mode 100644 .pytool/Plugin/EccCheck/Readme.md

-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61879): https://edk2.groups.io/g/devel/message/61879
Mute This Topic: https://groups.io/mt/75227224/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 15/15] UnitTestFrameworkPkg: Add configuration for Ecc check in yaml file

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Bret Barkelew 
Signed-off-by: Shenglei Zhang 
---
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml 
b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
index 51e172537f8a..7e9fc5d005fb 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
@@ -5,6 +5,16 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 ## options defined .pytool/Plugin/CompilerPlugin
 "CompilerPlugin": {
 "DscPath": "UnitTestFrameworkPkg.dsc"
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61853): https://edk2.groups.io/g/devel/message/61853
Mute This Topic: https://groups.io/mt/75212091/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 11/15] PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
---
 PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml 
b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
index be470807bd9e..c59287064d65 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for PcAtChipsetPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "PcAtChipsetPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61849): https://edk2.groups.io/g/devel/message/61849
Mute This Topic: https://groups.io/mt/75212087/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 07/15] FmpDevicePkg/FmpDevicePkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Liming Gao 
Cc: Michael D Kinney 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Guomin Jiang 
---
 FmpDevicePkg/FmpDevicePkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/FmpDevicePkg/FmpDevicePkg.ci.yaml 
b/FmpDevicePkg/FmpDevicePkg.ci.yaml
index 74a0aefe8e49..b84400f06ffd 100644
--- a/FmpDevicePkg/FmpDevicePkg.ci.yaml
+++ b/FmpDevicePkg/FmpDevicePkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for FmpDevicePkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "FmpDevicePkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61845): https://edk2.groups.io/g/devel/message/61845
Mute This Topic: https://groups.io/mt/75212083/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 12/15] SecurityPkg/SecurityPkg.ci.yaml: Add configuration for Ecc check

2020-06-30 Thread Zhang, Shenglei
Add configuration ExceptionList and IgnoreFiles for package config
files. So users can rely on this to ignore some Ecc issues.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Chao Zhang 
Signed-off-by: Shenglei Zhang 
---
 SecurityPkg/SecurityPkg.ci.yaml | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.ci.yaml b/SecurityPkg/SecurityPkg.ci.yaml
index 953219053318..a0e143140875 100644
--- a/SecurityPkg/SecurityPkg.ci.yaml
+++ b/SecurityPkg/SecurityPkg.ci.yaml
@@ -2,9 +2,20 @@
 # CI configuration for SecurityPkg
 #
 # Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
+"EccCheck": {
+## Exception sample looks like below:
+## "ExceptionList": [
+## "", ""
+## ]
+"ExceptionList": [
+],
+"IgnoreFiles": [
+]
+},
 "CompilerPlugin": {
 "DscPath": "SecurityPkg.dsc"
 },
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#61850): https://edk2.groups.io/g/devel/message/61850
Mute This Topic: https://groups.io/mt/75212088/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



  1   2   3   4   5   >