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

Side by Side Diff: chrome/test/mini_installer/test_installer.py

Issue 23557009: Run commands in the mini_installer test framework from the framework's directory. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium 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 """This script tests the installer with test cases specified in the config file. 5 """This script tests the installer with test cases specified in the config file.
6 6
7 For each test case, it checks that the machine states after the execution of 7 For each test case, it checks that the machine states after the execution of
8 each command match the expected machine states. For more details, take a look at 8 each command match the expected machine states. For more details, take a look at
9 the design documentation at http://goo.gl/Q0rGM6 9 the design documentation at http://goo.gl/Q0rGM6
10 """ 10 """
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 Args: 98 Args:
99 state: A state name. 99 state: A state name.
100 """ 100 """
101 try: 101 try:
102 verifier.Verify(self._config.states[state], self._path_resolver) 102 verifier.Verify(self._config.states[state], self._path_resolver)
103 except AssertionError as e: 103 except AssertionError as e:
104 # If an AssertionError occurs, we intercept it and add the state name 104 # If an AssertionError occurs, we intercept it and add the state name
105 # to the error message so that we know where the test fails. 105 # to the error message so that we know where the test fails.
106 raise AssertionError("In state '%s', %s" % (state, e)) 106 raise AssertionError("In state '%s', %s" % (state, e))
107 107
108 def _RunCommand(self, command): 108 def _RunCommand(self, command):
robertshield 2013/09/04 22:16:29 please add a brief method comment that mentions th
sukolsak 2013/09/04 22:53:49 Done.
109 exit_status = subprocess.call(self._path_resolver.ResolvePath(command), 109 resolved_command = self._path_resolver.ResolvePath(command)
110 shell=True) 110 script_dir = os.path.dirname(__file__)
111 exit_status = subprocess.call(resolved_command, shell=True, cwd=script_dir)
111 if exit_status != 0: 112 if exit_status != 0:
112 self.fail('Command %s returned non-zero exit status %s' % (command, 113 self.fail('Command %s returned non-zero exit status %s' % (
113 exit_status)) 114 resolved_command, exit_status))
114 115
115 116
116 def MergePropertyDictionaries(current_property, new_property): 117 def MergePropertyDictionaries(current_property, new_property):
117 """Merges the new property dictionary into the current property dictionary. 118 """Merges the new property dictionary into the current property dictionary.
118 119
119 This is different from general dictionary merging in that, in case there are 120 This is different from general dictionary merging in that, in case there are
120 keys with the same name, we merge values together in the first level, and we 121 keys with the same name, we merge values together in the first level, and we
121 override earlier values in the second level. For more details, take a look at 122 override earlier values in the second level. For more details, take a look at
122 http://goo.gl/uE0RoR 123 http://goo.gl/uE0RoR
123 124
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 assert os.path.exists(mini_installer_path), ('Could not find file %s' % 216 assert os.path.exists(mini_installer_path), ('Could not find file %s' %
216 mini_installer_path) 217 mini_installer_path)
217 config = ParseConfigFile(config_filename) 218 config = ParseConfigFile(config_filename)
218 if not RunTests(mini_installer_path, config): 219 if not RunTests(mini_installer_path, config):
219 return 1 220 return 1
220 return 0 221 return 0
221 222
222 223
223 if __name__ == '__main__': 224 if __name__ == '__main__':
224 sys.exit(main()) 225 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698