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

Side by Side Diff: native_client_sdk/src/tools/tests/getos_test.py

Issue 506863005: [NaCl SDK] getos.py now checks against the Cr-Commit-Position. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sbc-nacl-sdk-fix-getos-tests
Patch Set: Created 6 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 | « native_client_sdk/src/tools/getos.py ('k') | 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 import os 6 import os
7 import shutil 7 import shutil
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 import unittest 10 import unittest
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 self.patch = mock.patch.dict('os.environ', 110 self.patch = mock.patch.dict('os.environ',
111 {'NACL_SDK_ROOT': self.tempdir}) 111 {'NACL_SDK_ROOT': self.tempdir})
112 self.patch.start() 112 self.patch.start()
113 113
114 def tearDown(self): 114 def tearDown(self):
115 shutil.rmtree(self.tempdir) 115 shutil.rmtree(self.tempdir)
116 self.patch.stop() 116 self.patch.stop()
117 117
118 def testGetSDKVersion(self): 118 def testGetSDKVersion(self):
119 """correctly parses README to find SDK version.""" 119 """correctly parses README to find SDK version."""
120 expected_version = (16, '196') 120 expected_version = (16, '0a1b2c3d')
121 with open(os.path.join(self.tempdir, 'README'), 'w') as out: 121 with open(os.path.join(self.tempdir, 'README'), 'w') as out:
122 out.write('Version: %s\n' % expected_version[0]) 122 out.write('Version: %s\n' % expected_version[0])
123 out.write('Chrome Revision: %s\n' % expected_version[1]) 123 out.write('Chrome Revision: %s\n' % expected_version[1])
124 124
125 version = getos.GetSDKVersion() 125 version = getos.GetSDKVersion()
126 self.assertEqual(version, expected_version) 126 self.assertEqual(version, expected_version)
127 127
128 def testCheckVersion(self):
129 """correctly rejects SDK versions earlier than the required one."""
130 actual_version = (16, '0a1b2c3d')
binji 2014/08/27 01:05:02 See https://codereview.chromium.org/507883003/ I
Matt Giuca 2014/08/27 01:17:50 Oh OK, cool. I was expecting we would end up with
131 with open(os.path.join(self.tempdir, 'README'), 'w') as out:
132 out.write('Version: %s\n' % actual_version[0])
133 out.write('Chrome Revision: %s\n' % actual_version[1])
134
135 required_version = (15, 196)
136 getos.CheckVersion(required_version)
137
138 # Note: The revision part is currently ignored due to Git; see
139 # http://crbug.com/406993.
140 required_version = (16, 196)
141 getos.CheckVersion(required_version)
142
143 required_version = (17, 196)
144 self.assertRaisesRegexp(
145 getos.Error,
146 r'SDK version too old \(current: 16, required: 17\)',
147 getos.CheckVersion,
148 required_version)
149
128 150
129 if __name__ == '__main__': 151 if __name__ == '__main__':
130 unittest.main() 152 unittest.main()
OLDNEW
« no previous file with comments | « native_client_sdk/src/tools/getos.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698