summaryrefslogtreecommitdiffstats
path: root/tools/isolate/data/trace_inputs/symlink.py
blob: f7c7af4ea706ec9dc22cfe60fb526ad48489359f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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 'symlink: touches files2/'
  assert len(sys.argv) == 1

  expected = {
    'bar': 'Foo\n',
    'foo': 'Bar\n',
  }

  if not os.path.basename(os.getcwd()) == 'data':
    print 'Start this script from inside "data"'
    return 1

  root = os.path.join('trace_inputs', 'files2')
  actual = dict(
      (filename, open(os.path.join(root, filename), 'rb').read())
      for filename in (os.listdir(root)))

  if actual != expected:
    print 'Failure'
    print actual
    print expected
    return 2
  return 0


if __name__ == '__main__':
  sys.exit(main())