Dump BCC on failed provisioning request

[ Merge of http://go/wvgerrit/168357  and http://go/wvgerrit/168177 ]

When we get an error from the provisioning server while
running a test, we should log extra provisioning
information.

Bug: 273990016
Test: GtsMediaTestCases
Change-Id: I44095261e07ae079c632873f254d8e6879bab8c3
This commit is contained in:
Rahul Frias
2023-03-23 16:00:59 -07:00
parent e51bb19296
commit b3a57e7375

View File

@@ -186,11 +186,15 @@ bool ExtractSignedMessage(const std::string& response,
// TODO(b/242744857): This extra debugging may not be needed in all cases. When
// provisioning fails, this dumps the cert and other information.
std::string DumpProvAttempt(const std::string& url, const std::string& request,
const std::string& http_message) {
const std::string& http_message,
CdmEngine* cdm_engine) {
std::stringstream info;
info << "Provisioning url: " << url << "\n";
info << "Request: " << wvutil::unlimited_b2a_hex(request) << "\n";
info << "http_message: " << wvutil::unlimited_b2a_hex(http_message) << "\n";
std::string system_id;
cdm_engine->QueryStatus(kLevelDefault, QUERY_KEY_SYSTEM_ID, &system_id);
info << "system id: " << system_id << "\n";
if (wvoec::global_features.derive_key_method ==
wvoec::DeviceFeatures::TEST_PROVISION_30) {
std::vector<uint8_t> cert;
@@ -468,7 +472,10 @@ void WvCdmTestBase::Provision() {
// Receive and parse response.
std::string http_message;
ASSERT_NO_FATAL_FAILURE(url_request.AssertOkResponse(&http_message));
ASSERT_NO_FATAL_FAILURE(url_request.AssertOkResponse(&http_message))
<< "Failed to fetch provisioning response. "
<< DumpProvAttempt(provisioning_server_url, prov_request, http_message,
&cdm_engine);
if (binary_provisioning_) {
// extract provisioning response from received message
@@ -501,13 +508,13 @@ void WvCdmTestBase::Provision() {
&wrapped_key))
<< "Binary provisioning failed. "
<< DumpProvAttempt(provisioning_server_url, prov_request,
http_message);
http_message, &cdm_engine);
} else {
ASSERT_EQ(NO_ERROR, cdm_engine.HandleProvisioningResponse(
http_message, kLevelDefault, &cert, &wrapped_key))
<< "Non-binary provisioning failed. "
<< DumpProvAttempt(provisioning_server_url, prov_request,
http_message);
http_message, &cdm_engine);
}
}
}