public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] uefi-sct/SctPkg:Enhance the SimpleNetwork Test
@ 2018-10-14  2:06 Eric Jin
  2018-10-15  2:30 ` Supreeth Venkatesh
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Jin @ 2018-10-14  2:06 UTC (permalink / raw)
  To: edk2-devel; +Cc: Supreeth Venkatesh, Jiaxin Wu

Add the EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit in the Enable parameter
Add one checkpoint to MCastFilterCount is zero

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
 .../SimpleNetwork/BlackBoxTest/Guid.c         |  4 +-
 .../SimpleNetwork/BlackBoxTest/Guid.h         |  7 +-
 .../SimpleNetworkBBTestConformance.c          | 66 +++++++++++++------
 .../SimpleNetwork/BlackBoxTest/Guid.c         |  4 +-
 .../SimpleNetwork/BlackBoxTest/Guid.h         |  7 +-
 .../SimpleNetworkBBTestConformance.c          | 66 +++++++++++++------
 6 files changed, 110 insertions(+), 44 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
index 6ea6c4cb..72343236 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -112,6 +112,8 @@ EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid041 = EFI_TEST_SIMPLENETWOR
 
 EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid042 = EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_042_GUID;
 
+EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid043 = EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_043_GUID;
+
 EFI_GUID gSimpleNetworkBBTestFunctionAssertionGuid001 = EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_001_GUID;
 
 EFI_GUID gSimpleNetworkBBTestFunctionAssertionGuid002 = EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_002_GUID;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
index 281d893a..bf909d1c 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -235,6 +235,11 @@ extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid041;
 
 extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid042;
 
+#define EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_043_GUID \
+{ 0x8cec0b86, 0x7773, 0x4d3c, {0x84, 0x13, 0x26, 0x37, 0xfb, 0xd0, 0x8e, 0x1b }}
+
+extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid043;
+
 #define EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_001_GUID \
 { 0xf58651fe, 0x0538, 0x4407, {0x88, 0xe0, 0x88, 0xb8, 0xda, 0x18, 0x38, 0x3a }}
 
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 ccbbad08..b65d7d3b 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
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -581,11 +581,12 @@ BBTestReceiveFilterConformanceTest (
 {
   EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
   EFI_STATUS                            Status;
-  EFI_STATUS                            StatusBuf[5];
-  EFI_TEST_ASSERTION                    AssertionType[5];
+  EFI_STATUS                            StatusBuf[6];
+  EFI_TEST_ASSERTION                    AssertionType[6];
   EFI_SIMPLE_NETWORK_PROTOCOL           *SnpInterface;
   EFI_SIMPLE_NETWORK_STATE              State1, State2;
-
+  EFI_MAC_ADDRESS                       MAC;
+  
   //
   // Get the Standard Library Interface
   //
@@ -673,23 +674,37 @@ BBTestReceiveFilterConformanceTest (
   //
   //  Call ReceiveFilters with invalide MCastFilterCnt
   //
-  StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, NULL);
-  if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
-    AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
-  } else {
-    AssertionType[3] = EFI_TEST_ASSERTION_FAILED;
-  }
+  if ((SnpInterface->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {
+    SctSetMem (&MAC, sizeof (MAC), 0x00);
+    MAC.Addr[0] = 0x01;
+    MAC.Addr[1] = 0x00;
+    MAC.Addr[2] = 0x5e;
+    MAC.Addr[3] = 0x00;
+    MAC.Addr[4] = 0x00;
+    MAC.Addr[5] = 0x02;    
 
-  //
-  //  Call ReceiveFilters with MCastFilterCnt not match MCastFilter
-  //
-  StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 1, NULL);
-  if (StatusBuf[4] == EFI_INVALID_PARAMETER) {
-    AssertionType[4] = EFI_TEST_ASSERTION_PASSED;
-  } else {
-    AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
-  }
+    StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC);
+    if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+      AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[3] = EFI_TEST_ASSERTION_FAILED;
+    }
 
+    StatusBuf[5] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC);
+    if (StatusBuf[5] == EFI_INVALID_PARAMETER) {
+      AssertionType[5] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[5] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+    StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL);
+    if (StatusBuf[4] == EFI_INVALID_PARAMETER) {
+      AssertionType[4] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+  }
  
   StandardLib->RecordAssertion (
                  StandardLib,
@@ -728,7 +743,7 @@ BBTestReceiveFilterConformanceTest (
                  StandardLib,
                  AssertionType[3],
                  gSimpleNetworkBBTestConformanceAssertionGuid009,
-                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt.",
+                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is greater than Snp->Mode->MaxMCastFilterCount.",
                  L"%a:%d:Status - %r",
                  __FILE__,
                  (UINTN)__LINE__,
@@ -746,6 +761,17 @@ BBTestReceiveFilterConformanceTest (
                  StatusBuf[4]
                  );
 
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType[5],
+                 gSimpleNetworkBBTestConformanceAssertionGuid043,
+                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is 0.",
+                 L"%a:%d:Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 StatusBuf[5]
+                 );
+
   //
   // Restore SNP State
   //
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
index 6ea6c4cb..72343236 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -112,6 +112,8 @@ EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid041 = EFI_TEST_SIMPLENETWOR
 
 EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid042 = EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_042_GUID;
 
+EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid043 = EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_043_GUID;
+
 EFI_GUID gSimpleNetworkBBTestFunctionAssertionGuid001 = EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_001_GUID;
 
 EFI_GUID gSimpleNetworkBBTestFunctionAssertionGuid002 = EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_002_GUID;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
index 27728964..1a6b8880 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -235,6 +235,11 @@ extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid041;
 
 extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid042;
 
+#define EFI_TEST_SIMPLENETWORKBBTESTCONFORMANCE_ASSERTION_043_GUID \
+{ 0x8cec0b86, 0x7773, 0x4d3c, {0x84, 0x13, 0x26, 0x37, 0xfb, 0xd0, 0x8e, 0x1b }}
+
+extern EFI_GUID gSimpleNetworkBBTestConformanceAssertionGuid043;
+
 #define EFI_TEST_SIMPLENETWORKBBTESTFUNCTION_ASSERTION_001_GUID \
 { 0xf58651fe, 0x0538, 0x4407, 0x88, 0xe0, 0x88, 0xb8, 0xda, 0x18, 0x38, 0x3a }
 
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
index ccbbad08..b65d7d3b 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -581,11 +581,12 @@ BBTestReceiveFilterConformanceTest (
 {
   EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
   EFI_STATUS                            Status;
-  EFI_STATUS                            StatusBuf[5];
-  EFI_TEST_ASSERTION                    AssertionType[5];
+  EFI_STATUS                            StatusBuf[6];
+  EFI_TEST_ASSERTION                    AssertionType[6];
   EFI_SIMPLE_NETWORK_PROTOCOL           *SnpInterface;
   EFI_SIMPLE_NETWORK_STATE              State1, State2;
-
+  EFI_MAC_ADDRESS                       MAC;
+  
   //
   // Get the Standard Library Interface
   //
@@ -673,23 +674,37 @@ BBTestReceiveFilterConformanceTest (
   //
   //  Call ReceiveFilters with invalide MCastFilterCnt
   //
-  StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, NULL);
-  if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
-    AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
-  } else {
-    AssertionType[3] = EFI_TEST_ASSERTION_FAILED;
-  }
+  if ((SnpInterface->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {
+    SctSetMem (&MAC, sizeof (MAC), 0x00);
+    MAC.Addr[0] = 0x01;
+    MAC.Addr[1] = 0x00;
+    MAC.Addr[2] = 0x5e;
+    MAC.Addr[3] = 0x00;
+    MAC.Addr[4] = 0x00;
+    MAC.Addr[5] = 0x02;    
 
-  //
-  //  Call ReceiveFilters with MCastFilterCnt not match MCastFilter
-  //
-  StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 1, NULL);
-  if (StatusBuf[4] == EFI_INVALID_PARAMETER) {
-    AssertionType[4] = EFI_TEST_ASSERTION_PASSED;
-  } else {
-    AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
-  }
+    StatusBuf[3] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC);
+    if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+      AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[3] = EFI_TEST_ASSERTION_FAILED;
+    }
 
+    StatusBuf[5] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC);
+    if (StatusBuf[5] == EFI_INVALID_PARAMETER) {
+      AssertionType[5] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[5] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+    StatusBuf[4] = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL);
+    if (StatusBuf[4] == EFI_INVALID_PARAMETER) {
+      AssertionType[4] = EFI_TEST_ASSERTION_PASSED;
+    } else {
+      AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
+    }
+
+  }
  
   StandardLib->RecordAssertion (
                  StandardLib,
@@ -728,7 +743,7 @@ BBTestReceiveFilterConformanceTest (
                  StandardLib,
                  AssertionType[3],
                  gSimpleNetworkBBTestConformanceAssertionGuid009,
-                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt.",
+                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is greater than Snp->Mode->MaxMCastFilterCount.",
                  L"%a:%d:Status - %r",
                  __FILE__,
                  (UINTN)__LINE__,
@@ -746,6 +761,17 @@ BBTestReceiveFilterConformanceTest (
                  StatusBuf[4]
                  );
 
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType[5],
+                 gSimpleNetworkBBTestConformanceAssertionGuid043,
+                 L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is 0.",
+                 L"%a:%d:Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 StatusBuf[5]
+                 );
+
   //
   // Restore SNP State
   //
-- 
2.18.0.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-16  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-14  2:06 [PATCH] uefi-sct/SctPkg:Enhance the SimpleNetwork Test Eric Jin
2018-10-15  2:30 ` Supreeth Venkatesh
2018-10-15 13:09   ` Supreeth Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox