Re: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: SNP Statistics may be unsupported
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 Sent: Monday, September 9, 2019 5:32 PM To: EDK II Development Cc: Jin, Eric ; Supreeth Venkatesh ; Stephano Cetola ; Heinrich Schuchardt 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 --- 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_STATUSStatusBuf[3]; - EFI_TEST_ASSERTIONAssertionType[3];+ EFI_TEST_ASSERTION AssertionType; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; EFI_SIMPLE_NETWORK_STATE State1, State2; EFI_NETWORK_STATISTICSStatisticsTable;@@ -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, , );- if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {-AssertionType[0] = EFI_TEST_ASSERTION_PASSED;+ Status = SnpInterface->Statistics (SnpInterface, FALSE, , );+ 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, , );- if (StatusBuf[1] == EFI_DEVICE_ERROR) {- AssertionType[1] = EFI_TEST_ASSERTION_PASSED;+ Status = SnpInterface->Statistics (SnpInterface, FALSE, , );+ 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_
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 Sent: Monday, September 9, 2019 5:32 PM To: EDK II Development Cc: Jin, Eric ; Supreeth Venkatesh ; Stephano Cetola ; Heinrich Schuchardt 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 --- 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_STATUSStatusBuf[3]; - EFI_TEST_ASSERTIONAssertionType[3];+ EFI_TEST_ASSERTION AssertionType; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; EFI_SIMPLE_NETWORK_STATE State1, State2; EFI_NETWORK_STATISTICSStatisticsTable;@@ -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, , );- if ((StatusBuf[0] == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {-AssertionType[0] = EFI_TEST_ASSERTION_PASSED;+ Status = SnpInterface->Statistics (SnpInterface, FALSE, , );+ 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, , );- if (StatusBuf[1] == EFI_DEVICE_ERROR) {- AssertionType[1] = EFI_TEST_ASSERTION_PASSED;+ Status = SnpInterface->Statistics (SnpInterface, FALSE, , );+ 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+