OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
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 | |
4 # found in the LICENSE file. | |
5 | |
6 import os | |
7 import sys | |
8 | |
9 | |
10 def main(): | |
11 print 'child: verify the test data files were mapped properly' | |
12 files = sorted(os.listdir('files1')) | |
13 tree = { | |
14 'test_file1.txt': 'Foo\n', | |
15 'test_file2.txt': 'Bar\n', | |
16 } | |
17 | |
18 # For now, ignore .svn directory, which happens to be there with --mode=trace | |
19 # from a svn checkout. The file shouldn't be there when --mode=run is used. | |
20 # TODO(maruel): Differentiate between the two modes and detect .svn | |
21 # directories in --mode=run. | |
22 if '.svn' in files: | |
23 files.remove('.svn') | |
24 | |
25 if files != sorted(tree): | |
26 print '%s != %s' % (files, sorted(tree)) | |
27 return 2 | |
28 for k, v in tree.iteritems(): | |
29 content = open(os.path.join('files1', k), 'rb').read() | |
30 if v != content: | |
31 print '%s: %r != %r' % (k, v, content) | |
32 return 3 | |
33 | |
34 if sys.argv[1] == '--ok': | |
35 return 0 | |
36 elif sys.argv[1] == '--fail': | |
37 return 1 | |
38 return 4 | |
39 | |
40 | |
41 if __name__ == '__main__': | |
42 sys.exit(main()) | |
OLD | NEW |