From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=eric.jin@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AFE3621195BDA for ; Mon, 26 Nov 2018 21:57:36 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 21:57:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,285,1539673200"; d="scan'208";a="90162134" Received: from shwdeopenpsi175.ccr.corp.intel.com ([10.239.9.140]) by fmsmga007.fm.intel.com with ESMTP; 26 Nov 2018 21:57:35 -0800 From: Eric Jin To: edk2-devel@lists.01.org Date: Tue, 27 Nov 2018 13:57:31 +0800 Message-Id: <20181127055731.103656-1-eric.jin@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [edk2-test][Patch] uefi-sct/SctPkg:Correct Enable parameter in ReceiveFilters test X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2018 05:57:36 -0000 The patch is applied to the IHV part. Fix bug - set EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST bit in Enable parameter to make sure Multicast is enabled. Add one checkpoint when MCastFilterCount is zero Cc: Supreeth Venkatesh Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin --- .../IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.c | 4 +- .../IHV/Protocol/SimpleNetwork/BlackBoxTest/Guid.h | 5 + .../BlackBoxTest/SimpleNetworkBBTestConformance.c | 198 ++++++++++++--------- 3 files changed, 118 insertions(+), 89 deletions(-) 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 6ea6c4c..7234323 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.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
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 190787c..3efea81 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 @@ -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 ccbbad0..03a0d04 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.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -581,10 +581,9 @@ BBTestReceiveFilterConformanceTest ( { EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; EFI_STATUS Status; - EFI_STATUS StatusBuf[5]; - EFI_TEST_ASSERTION AssertionType[5]; + EFI_TEST_ASSERTION AssertionType; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_MAC_ADDRESS MAC; // // Get the Standard Library Interface @@ -608,16 +607,14 @@ BBTestReceiveFilterConformanceTest ( // Check whether the state of network interface is EfiSimpleNetworkStopped. // If not, change the state to EfiSimpleNetworkStopped. // - State1 = SnpInterface->Mode->State; - if (State1 == EfiSimpleNetworkInitialized) { + if (SnpInterface->Mode->State == EfiSimpleNetworkInitialized) { Status = SnpInterface->Shutdown (SnpInterface); if (EFI_ERROR(Status)) { return Status; } } - State2 = SnpInterface->Mode->State; - if (State2 == EfiSimpleNetworkStarted) { + if (SnpInterface->Mode->State == EfiSimpleNetworkStarted) { Status = SnpInterface->Stop (SnpInterface); if (EFI_ERROR(Status)) { return Status; @@ -628,13 +625,24 @@ BBTestReceiveFilterConformanceTest ( // Assertion Point 5.6.2.1 // Call ReceiveFilters() function if network interface not start. // - StatusBuf[0] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL); - if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) { - AssertionType[0] = EFI_TEST_ASSERTION_PASSED; + Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL); + if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) { + AssertionType = EFI_TEST_ASSERTION_PASSED; } else { - AssertionType[0] = EFI_TEST_ASSERTION_FAILED; + AssertionType = EFI_TEST_ASSERTION_FAILED; } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid006, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() when network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // // Assertion Point 5.6.2.2 // Call ReceiveFilters() function if network interface not initialized. @@ -644,13 +652,24 @@ BBTestReceiveFilterConformanceTest ( return Status; } - StatusBuf[1] = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL); - if (StatusBuf[1] == EFI_DEVICE_ERROR) { - AssertionType[1] = EFI_TEST_ASSERTION_PASSED; + Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL); + if (Status == EFI_DEVICE_ERROR) { + AssertionType = EFI_TEST_ASSERTION_PASSED; } else { - AssertionType[1] = EFI_TEST_ASSERTION_FAILED; + AssertionType = EFI_TEST_ASSERTION_FAILED; } - + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid007, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() when network interface not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // // Assertion Point 5.6.2.3 // Call ReceiveFilters() function with invalid parameters. @@ -663,93 +682,96 @@ BBTestReceiveFilterConformanceTest ( // // Call ReceiveFilters with invalide Enable // - StatusBuf[2] = SnpInterface->ReceiveFilters (SnpInterface, ~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL); - if (StatusBuf[2] == EFI_INVALID_PARAMETER) { - AssertionType[2] = EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType[2] = EFI_TEST_ASSERTION_FAILED; - } - - // - // 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; - } - - // - // 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; + Status = SnpInterface->ReceiveFilters (SnpInterface, ~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL); + if (Status == EFI_INVALID_PARAMETER) { + AssertionType = EFI_TEST_ASSERTION_PASSED; } else { - AssertionType[4] = EFI_TEST_ASSERTION_FAILED; + AssertionType = EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[0], - gSimpleNetworkBBTestConformanceAssertionGuid006, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[1], - gSimpleNetworkBBTestConformanceAssertionGuid007, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() when network interface not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); - StandardLib->RecordAssertion ( StandardLib, - AssertionType[2], + AssertionType, gSimpleNetworkBBTestConformanceAssertionGuid008, L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid Enable.", L"%a:%d:Status - %r", __FILE__, (UINTN)__LINE__, - StatusBuf[2] + Status ); - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[3], - gSimpleNetworkBBTestConformanceAssertionGuid009, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[3] - ); + // + // Call ReceiveFilters with invalide MCastFilterCnt + // + 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; + + Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC); + if (Status == EFI_INVALID_PARAMETER) { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[4], - gSimpleNetworkBBTestConformanceAssertionGuid010, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with MCastFilterCnt not match MCastFilter.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[4] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid009, + 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__, + Status + ); + + Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC); + if (Status == EFI_INVALID_PARAMETER) { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid043, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid MCastFilterCnt is 0.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL); + if (Status == EFI_INVALID_PARAMETER) { + AssertionType = EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType = EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid010, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with MCastFilterCnt not match MCastFilter.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + } // // Restore SNP State // - if (State1 == EfiSimpleNetworkStopped) { + if (SnpInterface->Mode->State == EfiSimpleNetworkStopped) { Status = SnpInterface->Shutdown (SnpInterface); if (EFI_ERROR(Status)) { return Status; @@ -760,7 +782,7 @@ BBTestReceiveFilterConformanceTest ( return Status; } } - + return EFI_SUCCESS; } -- 2.9.0.windows.1