public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Eric Jin" <eric.jin@intel.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	EDK II Development <devel@edk2.groups.io>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	Stephano Cetola <stephano.cetola@linux.intel.com>
Subject: Re: [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported
Date: Tue, 10 Sep 2019 01:15:57 +0000	[thread overview]
Message-ID: <DA72DC7456565B47808A57108259571F6381191D@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20190909093202.12695-1-xypron.glpk@gmx.de>

Reviewed-by: Eric Jin <eric.jin@intel.com>

-----Original Message-----
From: Heinrich Schuchardt <xypron.glpk@gmx.de> 
Sent: Monday, September 9, 2019 5:32 PM
To: EDK II Development <devel@edk2.groups.io>
Cc: Jin, Eric <eric.jin@intel.com>; Supreeth Venkatesh <supreeth.venkatesh@arm.com>; Stephano Cetola <stephano.cetola@linux.intel.com>; Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2160

If EFI_SIMPLE_NETWORK.Statistics() is not supported, it will return EFI_UNSUPPORTED. In this case do not expect input parameters to be checked for conformance.

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 <xypron.glpk@gmx.de>
---
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/BlackBoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index 9d5bec18..9bd21a76 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/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                            StatusBuf[3];  -  EFI_TEST_ASSERTION                    AssertionType[3];+  EFI_TEST_ASSERTION                    AssertionType;   EFI_SIMPLE_NETWORK_PROTOCOL           *SnpInterface;   EFI_SIMPLE_NETWORK_STATE              State1, State2;   EFI_NETWORK_STATISTICS                StatisticsTable;@@ -1012,31 +1011,68 @@ BBTestStatisticsConformanceTest (
   StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);   //   // Assertion Point 5.8.2.1-  // Call Statistics() function if network interface not start.+  // Call Statistics() function while network interface is not started.   //-  StatusBuf[0] = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);-  if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {-    AssertionType[0] = EFI_TEST_ASSERTION_PASSED;+  Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);+  if (Status == EFI_UNSUPPORTED) {+    StandardLib->RecordMessage(+                   StandardLib,+                   EFI_VERBOSE_LEVEL_QUIET,+                   L"Statistics isn't supported, Status - %r\n",+                   Status+                   );   } else {-    AssertionType[0] = EFI_TEST_ASSERTION_FAILED;+    if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {+      AssertionType = EFI_TEST_ASSERTION_PASSED;+    } else {+      AssertionType = EFI_TEST_ASSERTION_FAILED;+    }+    StandardLib->RecordAssertion (+                   StandardLib,+                   AssertionType,+                   gSimpleNetworkBBTestConformanceAssertionGuid014,+                   L"EFI_SIMPLE_NETWORK_PROTOCOL.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() function if network interface not initialized.+  // Call Statistics() function while network interface is not initialized.   //   Status = SnpInterface->Start (SnpInterface);   if (EFI_ERROR(Status)) {     return Status;   } -  StatusBuf[1] = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);-  if (StatusBuf[1] == EFI_DEVICE_ERROR) {-    AssertionType[1] = EFI_TEST_ASSERTION_PASSED;+  Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);+  if (Status == EFI_UNSUPPORTED) {+    StandardLib->RecordMessage(+                   StandardLib,+                   EFI_VERBOSE_LEVEL_QUIET,+                   L"Statistics isn't supported, Status - %r\n",+                   Status+                   );   } else {-    AssertionType[1] = EFI_TEST_ASSERTION_FAILED;+    if (Status == EFI_DEVICE_ERROR) {+      AssertionType = EFI_TEST_ASSERTION_PASSED;+    } else {+      AssertionType = EFI_TEST_ASSERTION_FAILED;+    }+    StandardLib->RecordAssertion (+                   StandardLib,+                   AssertionType,+                   gSimpleNetworkBBTestConformanceAssertionGuid015,+                   L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() while network interface is not initialized.",+                   L"%a:%d:Status - %r",+                   __FILE__,+                   (UINTN)__LINE__,+                   Status+                   );   }-     //   // Assertion Point 5.8.2.3@@ -1053,47 +1089,32 @@ BBTestStatisticsConformanceTest (
   //   StatisticsSize = 0; -  StatusBuf[2] = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);-  if (StatusBuf[2] == EFI_BUFFER_TOO_SMALL || Status == EFI_UNSUPPORTED) {-    AssertionType[2] = EFI_TEST_ASSERTION_PASSED;+  Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);+  if (Status == EFI_UNSUPPORTED) {+    StandardLib->RecordMessage(+                   StandardLib,+                   EFI_VERBOSE_LEVEL_QUIET,+                   L"Statistics isn't supported, Status - %r\n",+                   Status+                   );   } else {-    AssertionType[2] = EFI_TEST_ASSERTION_FAILED;+    if (Status == EFI_BUFFER_TOO_SMALL) {+      AssertionType = EFI_TEST_ASSERTION_PASSED;+    } else {+      AssertionType = EFI_TEST_ASSERTION_FAILED;+    }+    StandardLib->RecordAssertion (+                   StandardLib,+                   AssertionType,+                   gSimpleNetworkBBTestConformanceAssertionGuid017,+                   L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() with small buffer.",+                   L"%a:%d:Status - %r",+                   __FILE__,+                   (UINTN)__LINE__,+                   Status+                   );   } -  -  StandardLib->RecordAssertion (-                 StandardLib,-                 AssertionType[0],-                 gSimpleNetworkBBTestConformanceAssertionGuid014,-                 L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() when network interface not start.",-                 L"%a:%d:Status - %r",-                 __FILE__,-                 (UINTN)__LINE__,-                 StatusBuf[0]-                 );-  -  StandardLib->RecordAssertion (-                 StandardLib,-                 AssertionType[1],-                 gSimpleNetworkBBTestConformanceAssertionGuid015,-                 L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() when network interface not initialized.",-                 L"%a:%d:Status - %r",-                 __FILE__,-                 (UINTN)__LINE__,-                 StatusBuf[1]-                 );--  StandardLib->RecordAssertion (-                 StandardLib,-                 AssertionType[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   //-- 
2.20.1


  reply	other threads:[~2019-09-10  1:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09  9:32 [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported Heinrich Schuchardt
2019-09-10  1:15 ` Eric Jin [this message]
     [not found] ` <15C2EEC7CC20816E.1448@groups.io>
2019-09-11  0:43   ` [edk2-devel] " Eric Jin

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=DA72DC7456565B47808A57108259571F6381191D@SHSMSX103.ccr.corp.intel.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