public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Kubacki" <mikuback@linux.microsoft.com>
To: devel@edk2.groups.io, ashish.kalra@amd.com
Subject: Re: [edk2-devel] EDK2 CI build error "Uncrustify Coding Standard"
Date: Tue, 5 Apr 2022 10:42:20 -0400	[thread overview]
Message-ID: <0b388484-6d36-e620-df6f-e1ee5cbb71d7@linux.microsoft.com> (raw)
In-Reply-To: <5d3f6c47-1de9-ba06-d1e1-0099288c54c1@linux.microsoft.com>

In my previous mail, I showed how to see the Uncrustify diff from your 
server build. This mail is about local execution.

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.
> 
> 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,
>>
>> 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
>> 

  reply	other threads:[~2022-04-05 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 19:52 EDK2 CI build error "Uncrustify Coding Standard" Brijesh Singh
2021-12-07 20:49 ` [edk2-devel] " Michael Kubacki
2021-12-07 21:02   ` Michael D Kinney
2021-12-08 14:39     ` Brijesh Singh
2021-12-08 16:10       ` Brijesh Singh
2021-12-08 16:15         ` Michael Kubacki
2022-04-05  5:57           ` Ashish Kalra
2022-04-05  6:09             ` Ashish Kalra
2022-04-05 14:40               ` Michael Kubacki
2022-04-05 14:42                 ` Michael Kubacki [this message]
2022-04-05 15:00               ` Rebecca Cran
2022-04-05 15:21                 ` Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b388484-6d36-e620-df6f-e1ee5cbb71d7@linux.microsoft.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox