Files
android/libwvdrmengine/cdm/test/cdm_coverage_main.cpp
Alex Dale 4c6e10f7d6 Created a unified Android test for coverage.
[ Merge of http://go/wvgerrit/143889 ]

New test binary for generating code coverage information.  Run several
reliable, short runnning unit tests.  Actual test failures do not
affect the result of this test.

Bug: 138941105
Bug: 191681397
Test: Android cdm_coverage_test
Change-Id: I6b74d361a8a0e2896e0489acaa64d264158ecaa4
2022-01-20 13:57:40 -08:00

50 lines
1.6 KiB
C++

// Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#include <stdlib.h>
#include <string>
#include "gtest/gtest.h"
#include "log.h"
namespace wvcdm {
namespace {
void UpdateGtestFilter() {
const std::string initial_filter = ::testing::GTEST_FLAG(filter);
if (!initial_filter.empty()) {
LOGW("Ignoring provided GTEST filter: %s", initial_filter.c_str());
}
std::string final_filter("-");
// Sleepy tests.
final_filter.append("*VerifyUsageTimes*:*Refresh*:*TimingTest*");
final_filter.append(":*KeyDuration*:*CdmUseCase*");
final_filter.append(":*ExtendedDurationTest*");
// Slow tests.
final_filter.append(":*OEMCryptoMemory*:*Huge*:*NonceFlood*");
final_filter.append(
":*TwoHundredEntries*:*ManyUsageEntries*:*UsageTableDefrag*");
final_filter.append(
":*DecryptMax*:*MaxTotalKeys*:*OEMCryptoSessionTestsDecryptTests*");
final_filter.append(":*SharedMutex*:*Parallel*");
// Flacky tests.
final_filter.append(":*Repeated/ParallelCdmTest*");
// L1 only tests.
final_filter.append(":*Level1Required");
::testing::GTEST_FLAG(filter) = final_filter;
}
} // namespace
} // namespace wvcdm
int main(int argc, char** argv) {
LOGI("Running Android CDM tests");
testing::InitGoogleTest(&argc, argv);
wvcdm::UpdateGtestFilter();
const int status = RUN_ALL_TESTS();
LOGD("CDM coverage test complete with status %d", status);
// Test is for coverage information only, actual test failure
// should not change the final result of the test executable.
return EXIT_SUCCESS;
}