From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web10.2754.1601020441278502399 for ; Fri, 25 Sep 2020 00:54:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i2yTfMfw; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601020440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0f6e4li7AaJ9U7bxBkZg0LAvm5GRgijuLqFm1L5hONQ=; b=i2yTfMfwkfmp2+eW21Bus9fY/aSiphar2ujB7+/umSPpbd1efz4nsW3wiDp6uZEIcOE5k4 /nBnxFfDYqjRSM0iR0u/48q8TLj8kkS3FdKZuC77Yjsx7/HtDlmewC7mfdZlzZDkz9qiAf W0wAagYqpox05zt5yfdDsLWt49vQp4Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-q7ia6TyKNSifNaBvA8PXGA-1; Fri, 25 Sep 2020 03:53:56 -0400 X-MC-Unique: q7ia6TyKNSifNaBvA8PXGA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CD8E186DD37; Fri, 25 Sep 2020 07:53:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-178.ams2.redhat.com [10.36.112.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D23073694; Fri, 25 Sep 2020 07:53:54 +0000 (UTC) Subject: Re: [edk2-devel] ECC: main function entry point in host-based unit tests To: devel@edk2.groups.io, bret.barkelew@microsoft.com References: From: "Laszlo Ersek" Message-ID: Date: Fri, 25 Sep 2020 09:53:53 +0200 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit On 09/25/20 04:38, Bret Barkelew via groups.io wrote: > ERROR - EFI coding style error > ERROR - *Error code: 7001 > ERROR - *There should be no use of int, unsigned, char, void, long in any .c, .h or .asl files > ERROR - *file: //home/corthon/_uefi/edk2_qemu_ci/edk2/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c > ERROR - *Line number: 763 > ERROR - *[main] Return type int > ERROR - > ERROR - EFI coding style error > ERROR - *Error code: 8006 > ERROR - *Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters > ERROR - *file: //home/corthon/_uefi/edk2_qemu_ci/edk2/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.c > ERROR - *Line number: 2253 > ERROR - *The function name [main] does not follow the rules > > Currently, the host-based unit tests are using a standard C entry point: > int > main () "int main()" is not the standard C entry point. Two prototypes for main() are standard: int main(void); int main(int argc, char *argv[]); where - "int" may be replaced with a typedef name that's defined as "int", - and *argv[] may be spelled as **argv too. ... Of course, this doesn't address your main point. ECC#7001 can be suppressed perhaps if you use INT32 rather than "int". ECC#8006 can be suppressed perhaps with a macro that expands to "main". Another -- likely better -- idea: (1) replace the current main() function prototype with INT32 UnitTestMain ( IN INT32 ArgC, IN UINT8 **ArgV ); (2) Introduce MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/UnitTestMain.h such that it only declare the above prototype. (3) Introduce MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/UnitTestEntry.c with the following contents: #include "UnitTestMain.h" int main(int argc, char **argv) { return UnitTestMain(argc, (UINT8 **)argv); } (4) List both new source files in MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/VariablePolicyUnitTest.inf in the [Sources] section. (5) Add MdeModulePkg/Library/VariablePolicyLib/VariablePolicyUnitTest/UnitTestEntry.c to "EccCheck.IgnoreFiles" in "MdeModulePkg/MdeModulePkg.ci.yaml". Thanks Laszlo > > That’s going to break both of these. > > Another thing to override/figure out for host-based tests > > - Bret > > > > > > >