From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=sakar.arora@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id C046721180F5E for ; Tue, 6 Nov 2018 02:58:49 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B2034A78; Tue, 6 Nov 2018 02:58:48 -0800 (PST) Received: from u201365.usa.Arm.com (a75592.asiapac.arm.com [10.162.22.94]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60E3D3F5CF; Tue, 6 Nov 2018 02:58:47 -0800 (PST) From: Sakar Arora To: edk2-devel@lists.01.org Cc: prasanth.pulla@arm.com, John Powell Date: Tue, 6 Nov 2018 16:28:29 +0530 Message-Id: <1541501909-16915-1-git-send-email-sakar.arora@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [edk2-test][PATCH] uefi-sct/SctPkg: Fix issues with EfiCompliant 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, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 X-List-Received-Date: Tue, 06 Nov 2018 10:58:49 -0000 From: John Powell Fixed errors occurring when an unsupported protocol is under test, in several places a call to LocateProtocol was assumed to be successful and the results were used as such, which caused synchronous exceptions when the calls failed and the code tried to use NULL pointers. Change-Id: Iede062bc3da675dae72fa24ba167692914e7ded6 Signed-off-by: John Powell --- .../BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c | 273 ++++++++------------- 1 file changed, 107 insertions(+), 166 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c index 17df564..fb8128e 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/EfiCompliant/BlackBoxTest/EfiCompliantBBTestPlatform_uefi.c @@ -1497,62 +1497,24 @@ CheckUefiNetworkApplication ( NULL, (VOID **)&TempInterface ); - switch (Index) { - case 0: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 1: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 2: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 3: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 4: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - default: - TempInterface->CreateChild(TempInterface, &ChildHandle); - } - - Status = gtBS->LocateProtocol ( - &Guid[Index+7], - NULL, - (VOID **)&Interface - ); if (!EFI_ERROR (Status)) { - Value[Index+7] = TRUE; + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &Guid[Index+7], + NULL, + (VOID **)&Interface + ); + if (!EFI_ERROR (Status)) { + Value[Index+7] = TRUE; + } else { + Value[Index+7] = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); } else { Value[Index+7] = FALSE; } - - switch (Index) { - case 0: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 1: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 2: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 3: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 4: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - default: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - } } AssertionType = NeedOrWarning (13, Value); @@ -1695,55 +1657,24 @@ CheckUefiV6NetworkApplication ( NULL, (VOID **) &TempInterface ); - switch (Index) { - case 0: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 1: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 2: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - case 3: - TempInterface->CreateChild(TempInterface, &ChildHandle); - break; - default: - TempInterface->CreateChild(TempInterface, &ChildHandle); - } - - Status = gtBS->LocateProtocol ( - &Guid[Index+5], - NULL, - (VOID **) &Interface - ); if (!EFI_ERROR (Status)) { - Value[Index+5] = TRUE; + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &Guid[Index+5], + NULL, + (VOID **) &Interface + ); + if (!EFI_ERROR (Status)) { + Value[Index+5] = TRUE; + } else { + Value[Index+5] = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); } else { Value[Index+5] = FALSE; } - - switch (Index) { - case 0: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 1: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 2: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - case 3: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - break; - default: - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - } } AssertionType = NeedOrWarning (9, Value); @@ -2969,24 +2900,26 @@ CheckDNS4Protocols ( NULL, (VOID **) &TempInterface ); - - TempInterface->CreateChild(TempInterface, &ChildHandle); - - - Status = gtBS->LocateProtocol ( - &gEfiDns4ProtocolGuid, - NULL, - (VOID **) &Interface - ); - if (!EFI_ERROR (Status)) { - ValueB = TRUE; + if (!EFI_ERROR (Status)) { + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &gEfiDns4ProtocolGuid, + NULL, + (VOID **) &Interface + ); + if (!EFI_ERROR (Status)) { + ValueB = TRUE; + } else { + ValueB = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); + ChildHandle = NULL; } else { ValueB = FALSE; } - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - AssertionType = NeedOneOrWarning (ValueB); if (AssertionType == EFI_TEST_ASSERTION_FAILED) { @@ -3097,24 +3030,26 @@ CheckDNS6Protocols ( NULL, (VOID **) &TempInterface ); - - TempInterface->CreateChild(TempInterface, &ChildHandle); - - - Status = gtBS->LocateProtocol ( - &gEfiDns6ProtocolGuid, - NULL, - (VOID **) &Interface - ); - if (!EFI_ERROR (Status)) { - ValueB = TRUE; + if (!EFI_ERROR (Status)) { + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &gEfiDns6ProtocolGuid, + NULL, + (VOID **) &Interface + ); + if (!EFI_ERROR (Status)) { + ValueB = TRUE; + } else { + ValueB = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); + ChildHandle = NULL; } else { ValueB = FALSE; } - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - AssertionType = NeedOneOrWarning (ValueB); if (AssertionType == EFI_TEST_ASSERTION_FAILED) { @@ -3238,24 +3173,26 @@ CheckTLSProtocols ( NULL, (VOID **) &TempInterface ); - - TempInterface->CreateChild(TempInterface, &ChildHandle); - - - Status = gtBS->LocateProtocol ( - &gEfiTlsProtocolGuid, - NULL, - (VOID **) &Interface - ); - if (!EFI_ERROR (Status)) { - ValueC = TRUE; + if (!EFI_ERROR (Status)) { + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &gEfiTlsProtocolGuid, + NULL, + (VOID **) &Interface + ); + if (!EFI_ERROR (Status)) { + ValueC = TRUE; + } else { + ValueC = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); + ChildHandle = NULL; } else { ValueC = FALSE; } - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - AssertionType = NeedOneOrWarning (ValueC); if (AssertionType == EFI_TEST_ASSERTION_FAILED) { @@ -3381,24 +3318,26 @@ CheckHTTPProtocols ( NULL, (VOID **) &TempInterface ); - - TempInterface->CreateChild(TempInterface, &ChildHandle); - - - Status = gtBS->LocateProtocol ( - &gEfiHttpProtocolGuid, - NULL, - (VOID **) &Interface - ); - if (!EFI_ERROR (Status)) { - ValueC = TRUE; + if (!EFI_ERROR (Status)){ + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &gEfiHttpProtocolGuid, + NULL, + (VOID **) &Interface + ); + if (!EFI_ERROR (Status)) { + ValueC = TRUE; + } else { + ValueC = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); + ChildHandle = NULL; } else { ValueC = FALSE; } - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; - AssertionType = NeedOneOrWarning (ValueC); if (AssertionType == EFI_TEST_ASSERTION_FAILED) { @@ -3632,23 +3571,25 @@ CheckBlueToothProtocols ( NULL, (VOID **) &TempInterface ); - - TempInterface->CreateChild(TempInterface, &ChildHandle); - - - Status = gtBS->LocateProtocol ( - &gEfiBlueToothIoProtocolGuid, - NULL, - (VOID **) &Interface - ); if (!EFI_ERROR (Status)) { - ValueD = TRUE; + TempInterface->CreateChild (TempInterface, &ChildHandle); + + Status = gtBS->LocateProtocol ( + &gEfiBlueToothIoProtocolGuid, + NULL, + (VOID **) &Interface + ); + if (!EFI_ERROR (Status)) { + ValueD = TRUE; + } else { + ValueD = FALSE; + } + + TempInterface->DestroyChild (TempInterface, ChildHandle); + ChildHandle = NULL; } else { ValueD = FALSE; } - - TempInterface->DestroyChild(TempInterface, ChildHandle); - ChildHandle = NULL; AssertionType = NeedOneOrWarning (ValueD); -- 2.7.4