From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: eric.jin@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Tue, 10 Sep 2019 17:43:32 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2019 17:43:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,491,1559545200"; d="scan'208";a="178858311" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 10 Sep 2019 17:43:32 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 10 Sep 2019 17:43:31 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 10 Sep 2019 17:43:30 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.140]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.53]) with mapi id 14.03.0439.000; Wed, 11 Sep 2019 08:43:28 +0800 From: "Eric Jin" To: "devel@edk2.groups.io" , Heinrich Schuchardt CC: Supreeth Venkatesh , Stephano Cetola Subject: Re: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported Thread-Topic: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported Thread-Index: AQHVZvGNnTP7RrRKWUiVsG3czym0FqckHKQwgAGJLHA= Date: Wed, 11 Sep 2019 00:43:28 +0000 Message-ID: References: <20190909093202.12695-1-xypron.glpk@gmx.de> <15C2EEC7CC20816E.1448@groups.io> In-Reply-To: <15C2EEC7CC20816E.1448@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.jin@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed at 269f8a35e44f2093625b3671f372f68e2983c49d -----Original Message----- From: devel@edk2.groups.io On Behalf Of Eric Jin Sent: Tuesday, September 10, 2019 9:16 AM To: Heinrich Schuchardt ; EDK II Development Cc: Supreeth Venkatesh ; Stephano Cetola Subject: Re: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP = Statistics may be unsupported Reviewed-by: Eric Jin -----Original Message----- From: Heinrich Schuchardt =20 Sent: Monday, September 9, 2019 5:32 PM To: EDK II Development Cc: Jin, Eric ; Supreeth Venkatesh ; Stephano Cetola ; Heinrich Schu= chardt Subject: [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be= unsupported REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2160 If EFI_SIMPLE_NETWORK.Statistics() is not supported, it will return EFI_UN= SUPPORTED. In this case do not expect input parameters to be checked for co= nformance. If an error in SnpInterface->Start() occurs we error out. Therefore create= assertion messages always directly after each individual check. Fix some typos in comments and messages. Signed-off-by: Heinrich Schuchardt --- v2: Create assertion messages always directly after each individual check. Fix typos in comments and messages. --- .../SimpleNetworkBBTestConformance.c | 123 ++++++++++-------- 1 file changed, 72 insertions(+), 51 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/Blac= kBoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/E= FI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c index 9d5bec18..9bd21a76 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTes= t/SimpleNetworkBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxT +++ est/SimpleNetworkBBTestConformance.c @@ -964,8 +964,7 @@ BBTestStatisticsConformanceTest ( { EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; EFI_STATUS = Status;- EFI_STATUS Stat= usBuf[3]; - EFI_TEST_ASSERTION AssertionType[3];+ EFI= _TEST_ASSERTION AssertionType; EFI_SIMPLE_NETWORK_PROT= OCOL *SnpInterface; EFI_SIMPLE_NETWORK_STATE State= 1, State2; EFI_NETWORK_STATISTICS StatisticsTable;@@ -1012= ,31 +1011,68 @@ BBTestStatisticsConformanceTest ( StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); // // Assertion= Point 5.8.2.1- // Call Statistics() function if network interface not sta= rt.+ // Call Statistics() function while network interface is not started.= //- StatusBuf[0] =3D SnpInterface->Statistics (SnpInterface, FALSE, &St= atisticsSize, &StatisticsTable);- if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED= ) && (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkStopped)) {- Asse= rtionType[0] =3D EFI_TEST_ASSERTION_PASSED;+ Status =3D SnpInterface->Stat= istics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);+ if (Stat= us =3D=3D EFI_UNSUPPORTED) {+ StandardLib->RecordMessage(+ = StandardLib,+ EFI_VERBOSE_LEVEL_QUIET,+ = L"Statistics isn't supported, Status - %r\n",+ Stat= us+ ); } else {- AssertionType[0] =3D EFI_TEST_ASSER= TION_FAILED;+ if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode= ->State =3D=3D EfiSimpleNetworkStopped)) {+ AssertionType =3D EFI_TEST= _ASSERTION_PASSED;+ } else {+ AssertionType =3D EFI_TEST_ASSERTION_= FAILED;+ }+ StandardLib->RecordAssertion (+ Standar= dLib,+ AssertionType,+ gSimpleNetworkBB= TestConformanceAssertionGuid014,+ L"EFI_SIMPLE_NETWORK_PR= OTOCOL.Statistics - Invoke Statistics() while network interface not started= .",+ L"%a:%d:Status - %r",+ __FILE__,+ = (UINTN)__LINE__,+ Status+ = ); } // // Assertion Point 5.8.2.2- // Call Statistics() funct= ion if network interface not initialized.+ // Call Statistics() function w= hile network interface is not initialized. // Status =3D SnpInterface->= Start (SnpInterface); if (EFI_ERROR(Status)) { return Status; } - = StatusBuf[1] =3D SnpInterface->Statistics (SnpInterface, FALSE, &Statistics= Size, &StatisticsTable);- if (StatusBuf[1] =3D=3D EFI_DEVICE_ERROR) {- = AssertionType[1] =3D EFI_TEST_ASSERTION_PASSED;+ Status =3D SnpInterface->= Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);+ if (= Status =3D=3D EFI_UNSUPPORTED) {+ StandardLib->RecordMessage(+ = StandardLib,+ EFI_VERBOSE_LEVEL_QUIET,+ = L"Statistics isn't supported, Status - %r\n",+ = Status+ ); } else {- AssertionType[1] =3D EFI_TEST_A= SSERTION_FAILED;+ if (Status =3D=3D EFI_DEVICE_ERROR) {+ AssertionT= ype =3D EFI_TEST_ASSERTION_PASSED;+ } else {+ AssertionType =3D EFI= _TEST_ASSERTION_FAILED;+ }+ StandardLib->RecordAssertion (+ = StandardLib,+ AssertionType,+ = gSimpleNetworkBBTestConformanceAssertionGuid015,+ L"EFI_S= IMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() while network inter= face is not initialized.",+ L"%a:%d:Status - %r",+ = __FILE__,+ (UINTN)__LINE__,+ = Status+ ); }- // // Assertion Point 5.8.2.3@@ -= 1053,47 +1089,32 @@ BBTestStatisticsConformanceTest ( // StatisticsSize =3D 0; - StatusBuf[2] =3D SnpInterface->Statistics= (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);- if (StatusBuf[= 2] =3D=3D EFI_BUFFER_TOO_SMALL || Status =3D=3D EFI_UNSUPPORTED) {- Asse= rtionType[2] =3D EFI_TEST_ASSERTION_PASSED;+ Status =3D SnpInterface->Stat= istics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);+ if (Stat= us =3D=3D EFI_UNSUPPORTED) {+ StandardLib->RecordMessage(+ = StandardLib,+ EFI_VERBOSE_LEVEL_QUIET,+ = L"Statistics isn't supported, Status - %r\n",+ Stat= us+ ); } else {- AssertionType[2] =3D EFI_TEST_ASSER= TION_FAILED;+ if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {+ AssertionT= ype =3D EFI_TEST_ASSERTION_PASSED;+ } else {+ AssertionType =3D EFI= _TEST_ASSERTION_FAILED;+ }+ StandardLib->RecordAssertion (+ = StandardLib,+ AssertionType,+ = gSimpleNetworkBBTestConformanceAssertionGuid017,+ L"EFI_S= IMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() with small buffer."= ,+ L"%a:%d:Status - %r",+ __FILE__,+ = (UINTN)__LINE__,+ Status+ = ); } - - StandardLib->RecordAssertion (- StandardLib= ,- AssertionType[0],- gSimpleNetworkBBTestC= onformanceAssertionGuid014,- L"EFI_SIMPLE_NETWORK_PROTOCOL.= Statistics - Invoke Statistics() when network interface not start.",- = L"%a:%d:Status - %r",- __FILE__,- = (UINTN)__LINE__,- StatusBuf[0]- );- - S= tandardLib->RecordAssertion (- StandardLib,- = AssertionType[1],- gSimpleNetworkBBTestConformanceAsserti= onGuid015,- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invo= ke Statistics() when network interface not initialized.",- = L"%a:%d:Status - %r",- __FILE__,- (UINTN)__= LINE__,- StatusBuf[1]- );-- StandardLib->R= ecordAssertion (- StandardLib,- AssertionTy= pe[2],- gSimpleNetworkBBTestConformanceAssertionGuid017,- = L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics= () with small buffer.",- L"%a:%d:Status - %r",- = __FILE__,- (UINTN)__LINE__,- StatusBuf= [2]- );- // // Restore SNP State //--=20 2.20.1