public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Heinrich Schuchardt" <xypron.glpk@gmx.de>
To: EDK II Development <devel@edk2.groups.io>
Cc: Eric Jin <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 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported
Date: Wed,  4 Sep 2019 11:25:54 +0200	[thread overview]
Message-ID: <20190904092554.10090-1-xypron.glpk@gmx.de> (raw)

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.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 .../SimpleNetworkBBTestConformance.c          | 112 +++++++++++-------
 1 file changed, 72 insertions(+), 40 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..ea4a806b 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -1015,10 +1015,19 @@ BBTestStatisticsConformanceTest (
   // Call Statistics() function if network interface not start.
   //
   StatusBuf[0] = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
-  if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
-    AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
+  if (StatusBuf[0] == EFI_UNSUPPORTED) {
+    StandardLib->RecordMessage(
+                   StandardLib,
+                   EFI_VERBOSE_LEVEL_QUIET,
+                   L"Statistics isn't supported, Status - %r\n",
+                   StatusBuf[0]
+                   );
   } else {
-    AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
+    if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+      AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
+    }
   }
 
   //
@@ -1031,10 +1040,19 @@ BBTestStatisticsConformanceTest (
   }
 
   StatusBuf[1] = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
-  if (StatusBuf[1] == EFI_DEVICE_ERROR) {
-    AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
+  if (StatusBuf[1] == EFI_UNSUPPORTED) {
+    StandardLib->RecordMessage(
+                   StandardLib,
+                   EFI_VERBOSE_LEVEL_QUIET,
+                   L"Statistics isn't supported, Status - %r\n",
+                   StatusBuf[1]
+                   );
   } else {
-    AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
+    if (StatusBuf[1] == EFI_DEVICE_ERROR) {
+      AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
+    }
   }
  
 
@@ -1054,45 +1072,59 @@ 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;
+  if (StatusBuf[2] == EFI_UNSUPPORTED) {
+    StandardLib->RecordMessage(
+                   StandardLib,
+                   EFI_VERBOSE_LEVEL_QUIET,
+                   L"Statistics isn't supported, Status - %r\n",
+                   StatusBuf[2]
+                   );
   } else {
-    AssertionType[2] = EFI_TEST_ASSERTION_FAILED;
+    if (StatusBuf[2] == EFI_BUFFER_TOO_SMALL || Status == EFI_UNSUPPORTED) {
+      AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[2] = EFI_TEST_ASSERTION_FAILED;
+    }
   }
 
+  if (StatusBuf[0] != EFI_UNSUPPORTED) {
+    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[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]
-                 );
+  if (StatusBuf[1] != EFI_UNSUPPORTED) {
+    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]
-                 );
+  if (StatusBuf[2] != EFI_UNSUPPORTED) {
+    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.23.0.rc1


             reply	other threads:[~2019-09-04  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  9:25 Heinrich Schuchardt [this message]
2019-09-06  7:06 ` [edk2-test] [PATCH 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported 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=20190904092554.10090-1-xypron.glpk@gmx.de \
    --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