Merge "Unify log level for tests"

This commit is contained in:
Fred Gylys-Colwell
2019-07-11 02:19:25 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 8 deletions

View File

@@ -38,7 +38,7 @@ void show_menu(char* prog_name) {
std::cout << " e.g. adb shell '" << prog_name << " --server=\"url\"'"
<< std::endl;
std::cout << " --verbose" << std::endl;
std::cout << " --verbose or -v" << std::endl;
std::cout << " increase logging verbosity (may be repeated)" << std::endl
<< std::endl;
@@ -354,7 +354,7 @@ bool WvCdmTestBase::Initialize(int argc, char **argv) {
// Skip the first element, which is the program name.
const std::vector<std::string> args(argv + 1, argv + argc);
for (const std::string& arg : args) {
if (arg == "--verbose") {
if (arg == "--verbose" || arg == "-v") {
++verbosity;
} else if (arg == "--no_filter") {
filter_tests = false;

View File

@@ -130,7 +130,6 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil {
void SetUp() override {
::testing::Test::SetUp();
wvcdm::g_cutoff = wvcdm::LOG_INFO;
const ::testing::TestInfo* const test_info =
::testing::UnitTest::GetInstance()->current_test_info();
LOGD("Running test %s.%s", test_info->test_case_name(), test_info->name());

View File

@@ -17,22 +17,27 @@ static void acknowledge_cast() {
// Also, the test filter is updated based on the feature list.
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
wvcdm::g_cutoff = wvcdm::LOG_INFO;
bool is_cast_receiver = false;
bool force_load_test_keybox = false;
bool filter_tests = true;
for (int i = 0; i < argc; i++) {
if (!strcmp(argv[i], "--cast")) {
int verbosity = 0;
// Skip the first element, which is the program name.
const std::vector<std::string> args(argv + 1, argv + argc);
for (const std::string& arg : args) {
if (arg == "--verbose" || arg == "-v") {
++verbosity;
} else if (arg == "--cast") {
acknowledge_cast();
is_cast_receiver = true;
}
if (!strcmp(argv[i], "--force_load_test_keybox")) {
if (arg == "--force_load_test_keybox") {
force_load_test_keybox = true;
}
if (!strcmp(argv[i], "--no_filter")) {
if (arg == "--no_filter") {
filter_tests = false;
}
}
wvcdm::g_cutoff = static_cast<wvcdm::LogPriority>(verbosity);
wvoec::global_features.Initialize(is_cast_receiver, force_load_test_keybox);
// If the user requests --no_filter, we don't change the filter, otherwise, we
// filter out features that are not supported.