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

Unified 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: Indentation. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/tools/getos.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/tools/tests/getos_test.py
diff --git a/native_client_sdk/src/tools/tests/getos_test.py b/native_client_sdk/src/tools/tests/getos_test.py
index c847fe12f76a2b0339be766daf58dcdff43389c4..f47fffb11ab6d0e9cad46bd3b06c58942c4fe6d6 100755
--- a/native_client_sdk/src/tools/tests/getos_test.py
+++ b/native_client_sdk/src/tools/tests/getos_test.py
@@ -117,15 +117,51 @@ class TestGetosWithTempdir(TestCaseExtended):
def testGetSDKVersion(self):
"""correctly parses README to find SDK version."""
- expected_version = (16, '196', 'f00baacabba6e-refs/heads/master@{#100}')
+ expected_version = (16, 100, 'f00baacabba6e-refs/heads/master@{#100}')
with open(os.path.join(self.tempdir, 'README'), 'w') as out:
- out.write('Version: %s\n' % expected_version[0])
- out.write('Chrome Revision: %s\n' % expected_version[1])
+ out.write('Version: %d\n' % expected_version[0])
+ out.write('Chrome Revision: %d\n' % expected_version[1])
out.write('Chrome Commit Position: %s\n' % expected_version[2])
version = getos.GetSDKVersion()
self.assertEqual(version, expected_version)
+ def testParseVersion(self):
+ """correctly parses a version given to --check-version."""
+ check_version_string = '15.100'
+ self.assertEquals((15, 100), getos.ParseVersion(check_version_string))
+
+ def testCheckVersion(self):
+ """correctly rejects SDK versions earlier than the required one."""
+ actual_version = (16, 100, 'f00baacabba6e-refs/heads/master@{#100}')
+ with open(os.path.join(self.tempdir, 'README'), 'w') as out:
+ out.write('Version: %d\n' % actual_version[0])
+ out.write('Chrome Revision: %d\n' % actual_version[1])
+ out.write('Chrome Commit Position: %s\n' % actual_version[2])
+
+ required_version = (15, 150)
+ getos.CheckVersion(required_version)
+
+ required_version = (16, 99)
+ getos.CheckVersion(required_version)
+
+ required_version = (16, 100)
+ getos.CheckVersion(required_version)
+
+ required_version = (16, 101)
+ self.assertRaisesRegexp(
+ getos.Error,
+ r'SDK version too old \(current: 16.100, required: 16.101\)',
+ getos.CheckVersion,
+ required_version)
+
+ required_version = (17, 50)
+ self.assertRaisesRegexp(
+ getos.Error,
+ r'SDK version too old \(current: 16.100, required: 17.50\)',
+ getos.CheckVersion,
+ required_version)
+
if __name__ == '__main__':
unittest.main()
« 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