| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Smoke tests for gclient.py. | 6 """Smoke tests for gclient.py. |
| 7 | 7 |
| 8 Shell out 'gclient' and run basic conformance tests. | 8 Shell out 'gclient' and run basic conformance tests. |
| 9 | 9 |
| 10 This test assumes GClientSmokeBase.URL_BASE is valid. | 10 This test assumes GClientSmokeBase.URL_BASE is valid. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 results = self.gclient(cmd) | 152 results = self.gclient(cmd) |
| 153 self.check(('', '', 0), results) | 153 self.check(('', '', 0), results) |
| 154 self.checkString(expected, open(p, 'rU').read()) | 154 self.checkString(expected, open(p, 'rU').read()) |
| 155 | 155 |
| 156 test(['config', self.svn_base + 'trunk/src/'], | 156 test(['config', self.svn_base + 'trunk/src/'], |
| 157 'solutions = [\n' | 157 'solutions = [\n' |
| 158 ' { "name" : "src",\n' | 158 ' { "name" : "src",\n' |
| 159 ' "url" : "svn://127.0.0.1/svn/trunk/src",\n' | 159 ' "url" : "svn://127.0.0.1/svn/trunk/src",\n' |
| 160 ' "custom_deps" : {\n' | 160 ' "custom_deps" : {\n' |
| 161 ' },\n' | 161 ' },\n' |
| 162 ' "safesync_url": ""\n' | 162 ' "safesync_url": "",\n' |
| 163 ' },\n]\n') | 163 ' },\n' |
| 164 ']\n') |
| 164 | 165 |
| 165 test(['config', self.git_base + 'repo_1', '--name', 'src'], | 166 test(['config', self.git_base + 'repo_1', '--name', 'src'], |
| 166 'solutions = [\n' | 167 'solutions = [\n' |
| 167 ' { "name" : "src",\n' | 168 ' { "name" : "src",\n' |
| 168 ' "url" : "git://127.0.0.1/git/repo_1",\n' | 169 ' "url" : "git://127.0.0.1/git/repo_1",\n' |
| 169 ' "custom_deps" : {\n' | 170 ' "custom_deps" : {\n' |
| 170 ' },\n' | 171 ' },\n' |
| 171 ' "safesync_url": ""\n' | 172 ' "safesync_url": "",\n' |
| 172 ' },\n]\n') | 173 ' },\n' |
| 174 ']\n') |
| 173 | 175 |
| 174 test(['config', 'foo', 'faa'], | 176 test(['config', 'foo', 'faa'], |
| 175 'solutions = [\n' | 177 'solutions = [\n' |
| 176 ' { "name" : "foo",\n' | 178 ' { "name" : "foo",\n' |
| 177 ' "url" : "foo",\n' | 179 ' "url" : "foo",\n' |
| 178 ' "custom_deps" : {\n' | 180 ' "custom_deps" : {\n' |
| 179 ' },\n' | 181 ' },\n' |
| 180 ' "safesync_url": "faa"\n' | 182 ' "safesync_url": "faa",\n' |
| 181 ' },\n]\n') | 183 ' },\n' |
| 184 ']\n') |
| 182 | 185 |
| 183 test(['config', '--spec', '["blah blah"]'], '["blah blah"]') | 186 test(['config', '--spec', '["blah blah"]'], '["blah blah"]') |
| 184 | 187 |
| 185 os.remove(p) | 188 os.remove(p) |
| 186 results = self.gclient(['config', 'foo', 'faa', 'fuu']) | 189 results = self.gclient(['config', 'foo', 'faa', 'fuu']) |
| 187 err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n' | 190 err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n' |
| 188 'gclient.py: error: Inconsistent arguments. Use either --spec or one' | 191 'gclient.py: error: Inconsistent arguments. Use either --spec or one' |
| 189 ' or 2 args\n') | 192 ' or 2 args\n') |
| 190 self.check(('', err, 2), results) | 193 self.check(('', err, 2), results) |
| 191 self.assertFalse(os.path.exists(join(self.root_dir, '.gclient'))) | 194 self.assertFalse(os.path.exists(join(self.root_dir, '.gclient'))) |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 if __name__ == '__main__': | 667 if __name__ == '__main__': |
| 665 if '-c' in sys.argv: | 668 if '-c' in sys.argv: |
| 666 COVERAGE = True | 669 COVERAGE = True |
| 667 sys.argv.remove('-c') | 670 sys.argv.remove('-c') |
| 668 if os.path.exists('.coverage'): | 671 if os.path.exists('.coverage'): |
| 669 os.remove('.coverage') | 672 os.remove('.coverage') |
| 670 os.environ['COVERAGE_FILE'] = os.path.join( | 673 os.environ['COVERAGE_FILE'] = os.path.join( |
| 671 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 674 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 672 '.coverage') | 675 '.coverage') |
| 673 unittest.main() | 676 unittest.main() |
| OLD | NEW |