Reboot test: Initialize fake clock
[ Merge of http://go/wvgerrit/143630 ] When we run a test with the fake clock, the clock had been initialized to the current time, or to 0. This causes a problem for reboot tests because the clock might go backwards over the reboot. With this change, we monitor the clock at the end of one reboot pass and initialize the clock for the next pass based on the previous value. Bug: 26163469 Test: GtsMediaTestCases on sunfish Change-Id: Ibd0024f963634382af70553fced38da6e1d857d2
This commit is contained in:
@@ -122,6 +122,12 @@ void show_menu(const char* prog_name, const std::string& extra_help_text) {
|
||||
<< " be used with a real OEMCrypto." << std::endl
|
||||
<< std::endl;
|
||||
|
||||
std::cout << " --initial_time=<time>" << std::endl;
|
||||
std::cout
|
||||
<< " Set the initial time on the fake clock. This is ignored"
|
||||
<< " if fake_sleep was not set." << std::endl
|
||||
<< std::endl;
|
||||
|
||||
std::cout << " --pass=<N>" << std::endl;
|
||||
std::cout << " Run test pass N. This is used for reboot tests that "
|
||||
<< "require several passes." << std::endl
|
||||
@@ -521,6 +527,14 @@ bool WvCdmTestBase::Initialize(int argc, const char* const argv[],
|
||||
default_config_.set_test_pass(std::stoi(arg_value));
|
||||
std::cout << "Running test pass " << default_config_.test_pass()
|
||||
<< std::endl;
|
||||
} else if (arg_prefix == "--initial_time") {
|
||||
if (wvutil::TestSleep::real_sleep()) {
|
||||
LOGD("Ignoring initial time %s because using a real clock",
|
||||
arg_value.c_str());
|
||||
} else {
|
||||
LOGE("Setting initial fake clock time to %s", arg_value.c_str());
|
||||
wvutil::TestSleep::SetFakeClock(stol(arg_value));
|
||||
}
|
||||
} else if (arg_prefix == "--test_data_path") {
|
||||
default_config_.set_test_data_path(arg_value);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user