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

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: Address robertshield's comment. 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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):
109 exit_status = subprocess.call(self._path_resolver.ResolvePath(command), 109 """Runs the given command from the current file's directory.
110 shell=True) 110
111 Args:
112 command: A command to run. It is expanded using ResolvePath.
113 """
114 resolved_command = self._path_resolver.ResolvePath(command)
115 script_dir = os.path.dirname(os.path.abspath(__file__))
116 exit_status = subprocess.call(resolved_command, shell=True, cwd=script_dir)
111 if exit_status != 0: 117 if exit_status != 0:
112 self.fail('Command %s returned non-zero exit status %s' % (command, 118 self.fail('Command %s returned non-zero exit status %s' % (
113 exit_status)) 119 resolved_command, exit_status))
114 120
115 121
116 def MergePropertyDictionaries(current_property, new_property): 122 def MergePropertyDictionaries(current_property, new_property):
117 """Merges the new property dictionary into the current property dictionary. 123 """Merges the new property dictionary into the current property dictionary.
118 124
119 This is different from general dictionary merging in that, in case there are 125 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 126 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 127 override earlier values in the second level. For more details, take a look at
122 http://goo.gl/uE0RoR 128 http://goo.gl/uE0RoR
123 129
(...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' % 221 assert os.path.exists(mini_installer_path), ('Could not find file %s' %
216 mini_installer_path) 222 mini_installer_path)
217 config = ParseConfigFile(config_filename) 223 config = ParseConfigFile(config_filename)
218 if not RunTests(mini_installer_path, config): 224 if not RunTests(mini_installer_path, config):
219 return 1 225 return 1
220 return 0 226 return 0
221 227
222 228
223 if __name__ == '__main__': 229 if __name__ == '__main__':
224 sys.exit(main()) 230 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