From 88934aa32210f6b32b1756958c3995b7617c1bca Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Mon, 9 Mar 2020 21:26:28 -0700 Subject: [PATCH] Log oemcrypto unit test version number Merge from Widevine repo of http://go/wvgerrit/95483 This adds a log message to the oemcrypto unit tests so that if somebody sends us a log, we can tell which version they are running. With this CL, the version string is OEMCrypto unit tests for API 16.2. Tests last updated 2020-03-18 This can be found in the logs and in stdout when running the unit test OEMCryptoClientTest.VersionNumber. One can verify the executable on android using strings $OUT/data/nativetest/oemcrypto_test | grep -i "oemcrypto unit tests" Test: ran oemcrypto_test and verified version string Bug: 144713981 Change-Id: Ie10b2f270b783ed10a3ff9855b7ca32a5327ea1c --- libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp index 3bcbd592..48ecee21 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_test.cpp @@ -190,6 +190,15 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil { // This test is first, becuase it might give an idea why other // tests are failing when the device has the wrong keybox installed. TEST_F(OEMCryptoClientTest, VersionNumber) { + const std::string log_message = + "OEMCrypto unit tests for API 16.2. Tests last updated 2020-03-18"; + cout << " " << log_message << "\n"; + LOGI("%s", log_message.c_str()); + // If any of the following fail, then it is time to update the log message + // above. + EXPECT_EQ(ODK_MAJOR_VERSION, 16); + EXPECT_EQ(ODK_MINOR_VERSION, 2); + EXPECT_EQ(kCurrentAPI, 16u); const char* level = OEMCrypto_SecurityLevel(); ASSERT_NE(nullptr, level); ASSERT_EQ('L', level[0]); @@ -197,9 +206,9 @@ TEST_F(OEMCryptoClientTest, VersionNumber) { uint32_t version = OEMCrypto_APIVersion(); cout << " OEMCrypto API version is " << version << endl; if (OEMCrypto_SupportsUsageTable()) { - cout << " OEMCrypto supports usage tables." << endl; + cout << " OEMCrypto supports usage tables" << endl; } else { - cout << " OEMCrypto does not support usage tables." << endl; + cout << " OEMCrypto does not support usage tables" << endl; } if (version >= 15) { const uint32_t tier = OEMCrypto_ResourceRatingTier();