Date
1 - 12 of 12
EDK2 CI build error "Uncrustify Coding Standard"
Brijesh Singh
Hi All,
I am rebasing the SNP series and encountering the error like below from the CI. I am not sure what I am missing. For testing purpose, I just tried one commit and CI Windows build complains about this. This is the same patch which passed all the CI. Any idea what I maybe missing ? WARNING - A file header template is not specified in the config file. WARNING - A function header template is not specified in the config file. ERROR - /home/vsts/work/1/s/OvmfPkg/Sec/AmdSev.c ERROR - /home/vsts/work/1/s/OvmfPkg/Sec/AmdSev.h ERROR - --->Test Failed: Uncrustify Coding Standard Test NO-TARGET returned 2 My patch does add the two files and they are listed in .inf. -Brijesh
|
|
Michael Kubacki
Hi Brijesh,
toggle quoted messageShow quoted text
A Tianocore wiki article is being prepared but the background and instructions for what to do were sent in this mail regarding the hard freeze being lifted - https://edk2.groups.io/g/devel/message/84458. Do you have questions after reading through that? Thanks, Michael
On 12/7/2021 2:52 PM, Brijesh Singh via groups.io wrote:
Hi All,
|
|
Michael D Kinney
Hi Brijesh,
toggle quoted messageShow quoted text
Yes. Your branch can be rebased on top of edk2/master after uncrustify changes. You have added new c/h files, so those files need to be run through uncrustify locally and your patch updated with those formatting changes. The following command updates every c/h file except BaseTools locally. git ls-files *.c *.h :!BaseTools/* | .pytool\Plugin\UncrustifyCheck\mu-uncrustify-release_extdep\Windows-x86\uncrustify.exe -c .pytool\Plugin\UncrustifyCheck\uncrustify.cfg -F - --replace --no-backup --if-changed If you know the package you are working on, the following one will work faster. git ls-files <PackageName>*.c <PackageName>*.h :!BaseTools/* | .pytool\Plugin\UncrustifyCheck\mu-uncrustify-release_extdep\Windows-x86\uncrustify.exe -c .pytool\Plugin\UncrustifyCheck\uncrustify.cfg -F - --replace --no-backup --if-changed OvmfPkg Example: git ls-files OvmfPkg/*.c OvmfPkg/*.h :!BaseTools/* | .pytool\Plugin\UncrustifyCheck\mu-uncrustify-release_extdep\Windows-x86\uncrustify.exe -c .pytool\Plugin\UncrustifyCheck\uncrustify.cfg -F - --replace --no-backup --if-changed You do have to use the .pytool stuart commands to setup your environment so uncrustify tool is installed automatically. This also allows you to run all the EDK II CI tests locally if you want to check and fix issues before submitting a PR. https://github.com/tianocore/edk2/blob/master/.pytool/Readme.md#running-ci-locally You can also use git filter-branch to uncrustify a more complex patch series. That is in the email thread and will be included in the Wiki. Best regards, Mike
-----Original Message-----
|
|
Brijesh Singh
Hi Mike,
On 12/7/21 3:02 PM, Kinney, Michael D wrote: Hi Brijesh,Thanks for the detail, I just did a pull and now I see the uncrustify cfg files. I followed your above command on my Ubuntu desktop and getting the below unknown symbol, is this a known issue ? brijesh@sbrijesh-desktop:~/workdir/snp-edk2$ git ls-files OvmfPkg/Sec/AmdSev.c | uncrustify -c .pytool/Plugin/UncrustifyCheck/uncrustify.cfg -F - --replace --no-backup --if-changed .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:73: unknown symbol 'nl_func_call_args_multi_line_ignore_closures' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:79: unknown symbol 'indent_func_call_edk2_style' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:120: unknown symbol 'sp_do_brace_open' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:134: unknown symbol 'sp_before_vardef_square' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:178: unknown symbol 'sp_brace_close_while' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:184: unknown symbol 'sp_before_square_asm_block' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:205: unknown symbol 'sp_while_paren_open' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:229: unknown symbol 'indent_func_def_param_paren_pos_threshold' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:270: unknown symbol 'align_edk2_style' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:323: unknown symbol 'cmt_align_doxygen_javadoc_tags' .pytool/Plugin/UncrustifyCheck/uncrustify.cfg:406: unknown symbol 'nl_before_whole_file_ifdef' Parsing: OvmfPkg/Sec/AmdSev.c as language C brijesh@sbrijesh-desktop:~/workdir/snp-edk2$ brijesh@sbrijesh-desktop:~/workdir/snp-edk2$ uncrustify --version Uncrustify-0.69.0_f I did submitted PR after above uncurstify run but the CI still didn't like it. Do we need to have specific version of uncrustify ? -Brijesh You do have to use the .pytool stuart commands to setup your environment so uncrustify tool is installed automatically.
|
|
Brijesh Singh
On 12/8/21 8:39 AM, Brijesh Singh wrote:
... Reading through the "Add Uncrustify formatting overview" email it seems we need to use a edk2 forked version of uncrustify [1]. With this now I dont get any error.OvmfPkg Example:Thanks for the detail, I just did a pull and now I see the uncrustify cfg files. I followed your above command on my Ubuntu desktop and getting the below unknown symbol, is this a known issue ? [1] https://dev.azure.com/projectmu/Uncrustify/_packaging?_a=package&feed=mu_uncrustify&package=mu-uncrustify-release&version=73.0.3&protocolType=NuGet thanks
|
|
Michael Kubacki
That's correct. I recommend using the "stuart_update -c .pytool/CISettings.py" command so the proper version will automatically get brought down into your local workspace.
toggle quoted messageShow quoted text
Thanks, Michael
On 12/8/2021 11:10 AM, Brijesh Singh wrote:
On 12/8/21 8:39 AM, Brijesh Singh wrote:
|
|
Ashish Kalra
Hi Mike,
I am following up on Brijesh's email thread amd@ashkalraubuntuserver:~/edk2-upstream$ ../.local/bin/stuart_ci_build -c .pytool/CISettings.py TOOL_CHAIN_TAG=GCC5 -p OvmfPkg SECTION - Init SDE WARNING - Using Pip Tools based BaseTools SECTION - Loading Plugins SECTION - Start Invocable Tool SECTION - Getting Environment SECTION - Loading plugins SECTION - Building OvmfPkg Package PROGRESS - --Running OvmfPkg: Uncrustify Coding Standard Test NO-TARGET -- WARNING - A file header template is not specified in the config file. WARNING - A function header template is not specified in the config file. ERROR - /home/amd/edk2-upstream/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c ERROR - /home/amd/edk2-upstream/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLibInternal.c ERROR - --->Test Failed: Uncrustify Coding Standard Test NO-TARGET returned 2 PROGRESS - --Running OvmfPkg: Guid Check Test NO-TARGET -- PROGRESS - --->Test Success: Guid Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Char Encoding Check Test NO-TARGET -- PROGRESS - --->Test Success: Char Encoding Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Spell Check Test NO-TARGET -- WARNING - NodeJs not installed. Test can't run WARNING - --->Test Skipped: in plugin! Spell Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Dsc Complete Check Test NO-TARGET -- PROGRESS - --->Test Success: Dsc Complete Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Host Unit Test Dsc Complete Check Test NO-TARGET -- PROGRESS - --->Test Success: Host Unit Test Dsc Complete Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Host Unit Test Compiler Plugin NOOPT -- WARNING - --->Test Skipped: in plugin! Host Unit Test Compiler Plugin NOOPT PROGRESS - --Running OvmfPkg: Library Class Check Test NO-TARGET -- PROGRESS - --->Test Success: Library Class Check Test NO-TARGET PROGRESS - --Running OvmfPkg: EccCheck Test NO-TARGET -- PROGRESS - --->Test Skipped by package! EccCheck Test PROGRESS - --Running OvmfPkg: Compiler Plugin DEBUG -- WARNING - --->Test Skipped: in plugin! Compiler Plugin DEBUG PROGRESS - --Running OvmfPkg: Compiler Plugin RELEASE -- WARNING - --->Test Skipped: in plugin! Compiler Plugin RELEASE PROGRESS - --Running OvmfPkg: Dependency Check Test NO-TARGET -- PROGRESS - --->Test Success: Dependency Check Test NO-TARGET PROGRESS - --Running OvmfPkg: License Check Test NO-TARGET -- PROGRESS - --->Test Success: License Check Test NO-TARGET ERROR - Overall Build Status: Error PROGRESS - There were 1 failures out of 13 attempts SECTION - Summary ERROR - Error
|
|
Ashish Kalra
Hi Mike,
I am following up on Brijesh's email, i am running the CI tests related to my SEV live migration patches, which i am in process of posting. I am running the CI tests locally and getting errors while building OvmfPkg, my patches include two new header files, error log is copied below. Do you have updated instructions on how to run through uncrustify locally and get my patch updated with those formatting changes, especially for Linux ? (your above instructions seem specific to Windows). Thanks, Ashish Error log: ../.local/bin/stuart_ci_build -c .pytool/CISettings.py TOOL_CHAIN_TAG=GCC5 -p OvmfPkg SECTION - Init SDE WARNING - Using Pip Tools based BaseTools SECTION - Loading Plugins SECTION - Start Invocable Tool SECTION - Getting Environment SECTION - Loading plugins SECTION - Building OvmfPkg Package PROGRESS - --Running OvmfPkg: Uncrustify Coding Standard Test NO-TARGET -- WARNING - A file header template is not specified in the config file. WARNING - A function header template is not specified in the config file. ERROR - /home/amd/edk2-upstream/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c ERROR - /home/amd/edk2-upstream/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLibInternal.c ERROR - --->Test Failed: Uncrustify Coding Standard Test NO-TARGET returned 2 PROGRESS - --Running OvmfPkg: Guid Check Test NO-TARGET -- PROGRESS - --->Test Success: Guid Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Char Encoding Check Test NO-TARGET -- PROGRESS - --->Test Success: Char Encoding Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Spell Check Test NO-TARGET -- WARNING - NodeJs not installed. Test can't run WARNING - --->Test Skipped: in plugin! Spell Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Dsc Complete Check Test NO-TARGET -- PROGRESS - --->Test Success: Dsc Complete Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Host Unit Test Dsc Complete Check Test NO-TARGET -- PROGRESS - --->Test Success: Host Unit Test Dsc Complete Check Test NO-TARGET PROGRESS - --Running OvmfPkg: Host Unit Test Compiler Plugin NOOPT -- WARNING - --->Test Skipped: in plugin! Host Unit Test Compiler Plugin NOOPT PROGRESS - --Running OvmfPkg: Library Class Check Test NO-TARGET -- PROGRESS - --->Test Success: Library Class Check Test NO-TARGET PROGRESS - --Running OvmfPkg: EccCheck Test NO-TARGET -- PROGRESS - --->Test Skipped by package! EccCheck Test PROGRESS - --Running OvmfPkg: Compiler Plugin DEBUG -- WARNING - --->Test Skipped: in plugin! Compiler Plugin DEBUG PROGRESS - --Running OvmfPkg: Compiler Plugin RELEASE -- WARNING - --->Test Skipped: in plugin! Compiler Plugin RELEASE PROGRESS - --Running OvmfPkg: Dependency Check Test NO-TARGET -- PROGRESS - --->Test Success: Dependency Check Test NO-TARGET PROGRESS - --Running OvmfPkg: License Check Test NO-TARGET -- PROGRESS - --->Test Success: License Check Test NO-TARGET ERROR - Overall Build Status: Error PROGRESS - There were 1 failures out of 13 attempts SECTION - Summary ERROR - Error
|
|
Michael Kubacki
Before discussing how to see the issues locally, here's how to see them in the pipelines. I will send a separate reply with local details.
toggle quoted messageShow quoted text
1. Go to the build that is failing Uncrustify. I am using this PR for your case: https://github.com/tianocore/edk2/pull/2742 2. Click "Details" I am using "Ubuntu GCC5 PR" for your case At this point the issue is described: "Check file coding standard compliance in Edk2CiBuild.Edk2.OvmfPkg UncrustifyCheck failed due to 3 incorrectly formatted files." 3. Click "View more details on Azure Pipelines" https://github.com/tianocore/edk2/pull/2742/checks?check_run_id=5826935687 4. Find the failing job and click it. In your case it is "Build_GCC5_TARGET_PLATFORMS". https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=47536&view=results 5. It will now have a link showing "XX%" tests passed (65% in this instance). Click that link to see the tests that failed. https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=47536&view=logs&j=ec42d809-3c3b-54a9-276c-e54a8b9aaee9 6. Now, in the tests summary it will show the same message you saw in step (2): "Check file coding standard compliance in Edk2CiBuild.Edk2.OvmfPkg UncrustifyCheck failed due to 3 incorrectly formatted files." https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=47536&view=ms.vss-test-web.build-test-results-tab Click that text to open more details. https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=47536&view=ms.vss-test-web.build-test-results-tab&runId=345782&resultId=100009&paneView=debug 7. Now, you will see the following error message in the "Debug" tab by default: "UncrustifyCheck failed due to 3 incorrectly formatted files." Click the "Attachments" tab to get more details. https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=47536&view=ms.vss-test-web.build-test-results-tab&runId=345782&resultId=100009&paneView=attachments 8. Now, you will see details about the Uncrustify run in the "Standard_Console_Output.log" attachment: """ Uncrustify version: Uncrustify-c82ee034 Found Uncrustify at /home/vsts/work/1/s/.pytool/Plugin/UncrustifyCheck/mu-uncrustify-release_extdep/Linux-x86/uncrustify Uncrustify version: Uncrustify-c82ee034 Uncrustify executed against 513 files in OvmfPkg in 2.31 seconds. """ Click on the "Standard_Error_Output.log" attachment to get more details about the error. Those details for your job are as follows. This is a diff of the changes needed. """ Files with formatting errors: Formatting errors in Library/BaseMemEncryptSevLib/PeiDxeMemEncryptSevLibInternal.c --- /home/vsts/work/1/s/OvmfPkg/Library/BaseMemEncryptSevLib/PeiDxeMemEncryptSevLibInternal.c +++ /home/vsts/work/1/s/OvmfPkg/Library/BaseMemEncryptSevLib/PeiDxeMemEncryptSevLibInternal.c.uncrustify_plugin @@ -36,8 +36,8 @@ RETURN_STATUS EFIAPI MemEncryptSevLocateInitialSmramSaveStateMapPages ( - OUT UINTN *BaseAddress, - OUT UINTN *NumberOfPages + OUT UINTN *BaseAddress, + OUT UINTN *NumberOfPages ) { UINTN MapStart; @@ -50,8 +50,8 @@ return RETURN_UNSUPPORTED; } - MapStart = SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET; - MapEnd = MapStart + sizeof (QEMU_SMRAM_SAVE_STATE_MAP); + MapStart = SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET; + MapEnd = MapStart + sizeof (QEMU_SMRAM_SAVE_STATE_MAP); MapPagesStart = MapStart & ~(UINTN)EFI_PAGE_MASK; MapPagesEnd = ALIGN_VALUE (MapEnd, EFI_PAGE_SIZE); MapPagesSize = MapPagesEnd - MapPagesStart; @@ -87,34 +87,34 @@ Signature[12] = '\0'; for (mKvmLeaf = 0x40000000; mKvmLeaf < 0x40010000; mKvmLeaf += 0x100) { AsmCpuid ( - mKvmLeaf, - NULL, - (UINT32 *)&Signature[0], - (UINT32 *)&Signature[4], - (UINT32 *)&Signature[8] - ); + mKvmLeaf, + NULL, + (UINT32 *)&Signature[0], + (UINT32 *)&Signature[4], + (UINT32 *)&Signature[8] + ); if (AsciiStrCmp (Signature, "KVMKVMKVM") == 0) { DEBUG ( - ( - DEBUG_INFO, - "%a: KVM Detected, signature = %a\n", - __FUNCTION__, - Signature - ) - ); + ( + DEBUG_INFO, + "%a: KVM Detected, signature = %a\n", + __FUNCTION__, + Signature + ) + ); RegEax = mKvmLeaf + 1; RegEcx = 0; AsmCpuid (mKvmLeaf + 1, &RegEax, &RegEbx, &RegEcx, &RegEdx); if ((RegEax & KVM_FEATURE_MIGRATION_CONTROL) != 0) { DEBUG ( - ( - DEBUG_INFO, - "%a: SEV Live Migration feature supported\n", - __FUNCTION__ - ) - ); + ( + DEBUG_INFO, + "%a: SEV Live Migration feature supported\n", + __FUNCTION__ + ) + ); return TRUE; } Formatting errors in Library/BaseMemEncryptSevLib/DxeMemEncryptSevLibInternal.c --- /home/vsts/work/1/s/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLibInternal.c +++ /home/vsts/work/1/s/OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLibInternal.c.uncrustify_plugin @@ -20,11 +20,11 @@ #include "PeiDxeMemEncryptSevLibInternal.h" -STATIC UINT64 mCurrentAttr = 0; -STATIC BOOLEAN mCurrentAttrRead = FALSE; -STATIC UINT64 mSevEncryptionMask = 0; -STATIC BOOLEAN mSevEncryptionMaskSaved = FALSE; -STATIC BOOLEAN mSevLiveMigrationStatus = FALSE; +STATIC UINT64 mCurrentAttr = 0; +STATIC BOOLEAN mCurrentAttrRead = FALSE; +STATIC UINT64 mSevEncryptionMask = 0; +STATIC BOOLEAN mSevEncryptionMaskSaved = FALSE; +STATIC BOOLEAN mSevLiveMigrationStatus = FALSE; STATIC BOOLEAN mSevLiveMigrationStatusChecked = FALSE; /** @@ -127,7 +127,7 @@ ) { if (KvmDetectSevLiveMigrationFeature ()) { - mSevLiveMigrationStatus = TRUE; + mSevLiveMigrationStatus = TRUE; } mSevLiveMigrationStatusChecked = TRUE; Formatting errors in Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c --- /home/vsts/work/1/s/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c +++ /home/vsts/work/1/s/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c.uncrustify_plugin @@ -19,8 +19,8 @@ #include "PeiDxeMemEncryptSevLibInternal.h" -STATIC BOOLEAN mSevLiveMigrationStatus = FALSE; -STATIC BOOLEAN mSevLiveMigrationStatusChecked = FALSE; +STATIC BOOLEAN mSevLiveMigrationStatus = FALSE; +STATIC BOOLEAN mSevLiveMigrationStatusChecked = FALSE; /** Read the workarea to determine whether SEV is enabled. If enabled, """ Thanks, Michael
On 4/5/2022 2:09 AM, Ashish Kalra via groups.io wrote:
Hi Mike,
|
|
Michael Kubacki
In my previous mail, I showed how to see the Uncrustify diff from your server build. This mail is about local execution.
toggle quoted messageShow quoted text
I'll start by saying that the easiest way I've found to run Uncrustify locally is as a VS Code plugin. It works on both Linux and Windows and it allows you to easily format code as you work with your choice of keyboard shortcut. Instructions for this approach are here: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting#recommended-usage-visual-studio-vs-code-plugin If there's something missing there for Linux support, let me know and I will update it. If you use a different IDE, you will need to port those instructions if you want similar functionality. The instructions for manual usage in a terminal are here: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Code-Formatting#manual-usage-run-in-a-terminal The Linux command to generate the file list is given and I believe only the executable and path details will differ in the example given to call the executable with the generated file list. Again, please give more specific details about where you're stuck on Linux if you're having issues here. Thanks, Michael
On 4/5/2022 10:40 AM, Michael Kubacki wrote:
Before discussing how to see the issues locally, here's how to see them in the pipelines. I will send a separate reply with local details.
|
|
Rebecca Cran
I have the following script for running Uncrustify locally on Linux:
toggle quoted messageShow quoted text
../edk2/.pytool/Plugin/UncrustifyCheck/mu-uncrustify-release_extdep/Linux-x86/uncrustify -c ../edk2/.pytool/Plugin/UncrustifyCheck/uncrustify.cfg -F files --replace --no-backup --if-changed Then I just echo the paths of files I want to check/fix: echo Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > files echo Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c >> files -- Rebecca Cran
On 4/5/22 00:09, Ashish Kalra via groups.io wrote:
Hi Mike,
|
|
Michael D Kinney
Hi Rebecca,
toggle quoted messageShow quoted text
I agree this is a good way to run from command line. With the addition of the ignore files feature in the YAML files, you have to make sure the filenames added to files are not in the ignored set and not in BaseTools and not from submodules. If you are working on a specific lib/module/pkg, then adding all the C/H files from that scope is also a good technique. Mike
-----Original Message-----
|
|