New issue
Advanced search Search tips

Issue 779131 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Protect against unexpected device wipe?

Project Member Reported by klausw@chromium.org, Oct 27 2017

Issue description

Would it be feasible to make device provisioning for tests opt-in via command line argument, or add a sanity check to verify that it's a previously-provisioned test device or a factory reset device?

Developers are encouraged to run unittests as part of development, and I was surprised to see that the tests repeatedly rebooted my phone. While looking at the code, I saw that there's also logic to wipe Chrome data and even wipe the entire device that seems to be enabled by default. That's kind of scary since the phone I'm running the tests on has stuff on it I want to keep.

(Even if the assumption is that people should only run tests on dedicated test devices, I think there's still a risk that someone may accidentally have left a non-test device connected to the dev PC's USB port.)

Currently, there's an opt-out option --skip-clear-data, but IMHO it would be a lot safer if the default would be to not clear by default and have automated tests add a --clear-data option explicitly that's added by a higher-level driver script. That's assuming that the tests on bots are usually automated where the command line doesn't need to be typed manually. (If people frequently run tests on bots with manually specified command lines this would of course be annoying.)

Alternatively, could there be a sanity check or heuristic to tell if a device is a bot test device, i.e. create a file in a known location when provisioning it for the first time, or checking if it's a freshly factory reset device, and not wiping if it's in an unknown state.

For the record, I didn't lose any data due to this, but if I'm understanding it right it does seem like an accident waiting to happen. 

 
What exactly were you running? Some of the things you've described are parts of separate scripts.

The test runner (//build/android/test_runner.py, which is the script behind the bin/run_* scripts) will clear the data of the app under test by default. It also installs this as part of execution. It shouldn't wipe data from other chrome installations on the device. It may attempt to restore a device to a usable state for testing by rebooting it. It will not attempt to wipe the entire device.

provision_devices (//build/android/provision_devices.py and //third_party/catapult/devil/devil/android/tools/provision_devices.py) is more aggressive, either wiping the device (below M) or wiping a bunch of chrome-related packages & changing a bunch of device settings. Our bots run it or similar swarming-side logic to try to ensure a consistent testing environment, but it isn't called as part of the test runner's execution (either by default or behind a flag).

Comment 2 by klausw@chromium.org, Oct 27 2017

Sorry, I may have been confused. The unexpected device reboots happened from bin/run_gpu_unittests. I was trying to track down where this is happening to see if there's a flag to stop it from doing so, and got the impression that this was the third_party/catapult/devil/ code doing so, and that the wiping it was referring to in log messages was also the aggressive devil/ code. If it's different code, please disregard this bug. I can't currently reproduce the reboots with an intentional test failure, so I don't know what the specific messages were that I was seeing.

Sign in to add a comment