Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: client/site_tests/factory_Wipe/factory_Wipe.py

Issue 3362018: Kill factory partition dead. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: . Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from autotest_lib.client.bin import factory 7 from autotest_lib.client.bin import factory
8 from autotest_lib.client.bin import test, utils 8 from autotest_lib.client.bin import test, utils
9 from autotest_lib.client.common_lib import error 9 from autotest_lib.client.common_lib import error
10 10
11 11
12 class factory_Wipe(test.test): 12 class factory_Wipe(test.test):
13 version = 3 13 version = 3
14 14
15 def wipe_stateful_partition(self, secure_wipe): 15 def wipe_stateful_partition(self, secure_wipe):
16 # Stub test to switch to boot from the release image, 16 # Stub test to switch to boot from the release image,
17 # and tag stateful partition to indicate wipe on reboot. 17 # and tag stateful partition to indicate wipe on reboot.
18 os.chdir(self.srcdir) 18 os.chdir(self.srcdir)
19 19
20 factory.log('switch to boot from release image and prepare wipe') 20 factory.log('switch to boot from release image and prepare wipe')
21 21
22 # Switch to the release image.
23 utils.run('./switch_partitions.sh')
24
22 # Tag the current image to be wiped according to preference 25 # Tag the current image to be wiped according to preference
23 # (secure or fast). 26 # (secure or fast). Don't tag until partition switch passes.
24 tag_filename = '/mnt/stateful_partition/factory_install_reset' 27 tag_filename = '/mnt/stateful_partition/factory_install_reset'
25 if secure_wipe: 28 if secure_wipe:
26 utils.run('touch %s' % tag_filename) 29 utils.run('touch %s' % tag_filename)
27 else: 30 else:
28 utils.run('echo "fast" > %s' % tag_filename) 31 utils.run('echo "fast" > %s' % tag_filename)
29 32
30 # Copy the wipe splash image to state partition. 33 # Copy the wipe splash image to state partition.
31 utils.run('cp -f wipe_splash.png /mnt/stateful_partition/') 34 utils.run('cp -f wipe_splash.png /mnt/stateful_partition/')
32 # Switch to the release image.
33 utils.run('./switch_partitions.sh')
34 # Time for reboot. 35 # Time for reboot.
35 utils.run('shutdown -r now') 36 utils.run('shutdown -r now')
36 37
37 def run_once(self, 38 def run_once(self,
38 secure_wipe, 39 secure_wipe,
39 status_file_path=None, 40 status_file_path=None,
40 test_list=None, 41 test_list=None,
41 only_run_from_factory_finalize_unless_testing=True): 42 only_run_from_factory_finalize_unless_testing=True):
42 43
43 test_name = factory.FINAL_VERIFICATION_TEST_UNIQUE_NAME 44 test_name = factory.FINAL_VERIFICATION_TEST_UNIQUE_NAME
44 if only_run_from_factory_finalize_unless_testing: 45 if only_run_from_factory_finalize_unless_testing:
45 if factory.lookup_status_by_unique_name( 46 if factory.lookup_status_by_unique_name(
46 test_name, test_list, status_file_path) != factory.PASSED: 47 test_name, test_list, status_file_path) != factory.PASSED:
47 raise error.TestFail('You need to pass %s first.' % test_name) 48 raise error.TestFail('You need to pass %s first.' % test_name)
48 else: 49 else:
49 factory.log('WARNING: Final Verification is bypassed.\n' + 50 factory.log('WARNING: Final Verification is bypassed.\n' +
50 'THIS DEVICE CANNOT BE QUALIFIED.') 51 'THIS DEVICE CANNOT BE QUALIFIED.')
51 52
52 self.wipe_stateful_partition(secure_wipe) 53 self.wipe_stateful_partition(secure_wipe)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698