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
This commit is contained in:
Fred Gylys-Colwell
2020-03-09 21:26:28 -07:00
parent e77874f376
commit 88934aa322

View File

@@ -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();