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

Unified Diff: tools/isolate/data/isolate/with_flag.py

Issue 10068032: Rewrite isolate_smoke_test.py to increase the coverage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _execute() is now less ambiguous, still with test case name verification Created 8 years, 8 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 | « tools/isolate/data/isolate/with_flag.isolate ('k') | tools/isolate/isolate.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/data/isolate/with_flag.py
diff --git a/tools/isolate/data/isolate/with_flag.py b/tools/isolate/data/isolate/with_flag.py
new file mode 100755
index 0000000000000000000000000000000000000000..31749eb3567f7fa78e149effb86fecf4648c3519
--- /dev/null
+++ b/tools/isolate/data/isolate/with_flag.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+
+
+def main():
+ print 'with_flag: Verify the test data files were mapped properly'
+ assert len(sys.argv) == 2
+ mode = sys.argv[1]
+ assert mode in ('run', 'trace')
+ files = sorted(os.listdir('files1'))
+ tree = {
+ 'test_file1.txt': 'Foo\n',
+ 'test_file2.txt': 'Bar\n',
+ }
+
+ # Ignore .svn directory which happens to be there with --mode=trace
+ # from a svn checkout. The file shouldn't be there when --mode=run is used.
+ if mode == 'trace' and '.svn' in files:
+ files.remove('.svn')
+
+ if files != sorted(tree):
+ print '%s != %s' % (files, sorted(tree))
+ return 2
+ for k, v in tree.iteritems():
+ content = open(os.path.join('files1', k), 'rb').read()
+ if v != content:
+ print '%s: %r != %r' % (k, v, content)
+ return 3
+
+ root_dir = os.path.dirname(os.path.abspath(__file__))
+ parent_dir, base = os.path.split(root_dir)
+ if mode == 'trace':
+ # Verify the parent directory.
+ parent_dir, base2 = os.path.split(parent_dir)
+ if base != 'isolate' or base2 != 'data':
+ print 'mode trace: Invalid root dir %s' % root_dir
+ return 4
+ else:
+ # Verify that we are not inside a checkout.
+ if base == 'data':
+ print 'mode run: Invalid root dir %s' % root_dir
+ return 5
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « tools/isolate/data/isolate/with_flag.isolate ('k') | tools/isolate/isolate.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698