#include #include #include "OEMCryptoCENC.h" #include "log.h" #include "oec_device_features.h" #include "oemcrypto_corpus_generator_helper.h" #include "test_sleep.h" static void acknowledge_cast() { std::cout << "==================================================================\n" << "= This device is expected to load x509 certs as a cast receiver. =\n" << "==================================================================\n"; } // This special main procedure is used instead of the standard GTest main, // because we need to initialize the list of features supported by the device. // Also, the test filter is updated based on the feature list. int main(int argc, char** argv) { bool is_cast_receiver = false; bool filter_tests = true; int verbosity = 0; // Skip the first element, which is the program name. const std::vector args(argv + 1, argv + argc); for (const std::string& arg : args) { if (arg == "--generate_corpus") { wvoec::SetGenerateCorpus(true); } if (arg == "--verbose" || arg == "-v") { ++verbosity; } else if (arg == "--cast") { acknowledge_cast(); is_cast_receiver = true; } if (arg == "--force_load_test_keybox") { std::cerr << "The argument --force_load_test_keybox is obsolete.\n"; return 1; } if (arg == "--no_filter") { filter_tests = false; } if (arg == "--fake_sleep") { wvcdm::TestSleep::set_real_sleep(false); } } wvcdm::g_cutoff = static_cast(verbosity); wvoec::global_features.Initialize(); wvoec::global_features.set_cast_receiver(is_cast_receiver); // Init GTest after device properties has been initialized. ::testing::InitGoogleTest(&argc, argv); // If the user requests --no_filter, we don't change the filter, otherwise, we // filter out features that are not supported. if (filter_tests) { ::testing::GTEST_FLAG(filter) = wvoec::global_features.RestrictFilter(::testing::GTEST_FLAG(filter)); } return RUN_ALL_TESTS(); }