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 subprocess |
| 8 import sys |
| 9 |
| 10 |
| 11 def child(): |
| 12 """When the gyp argument is not specified, the command is started from |
| 13 --root-dir directory. |
| 14 """ |
| 15 print 'child from %s' % os.getcwd() |
| 16 # Force file opening with a non-normalized path. |
| 17 open(os.path.join('tests', '..', 'trace_inputs.py'), 'rb').close() |
| 18 open(os.path.join( |
| 19 'tests', '..', 'tests', 'trace_inputs_smoke_test.py'), 'rb').close() |
| 20 # Do not wait for the child to exit. |
| 21 # Use relative directory. |
| 22 subprocess.Popen( |
| 23 ['python', 'child2.py'], cwd=os.path.join('tests', 'trace_inputs')) |
| 24 return 0 |
| 25 |
| 26 |
| 27 def child_gyp(): |
| 28 """When the gyp argument is specified, the command is started from --cwd |
| 29 directory. |
| 30 """ |
| 31 print 'child_gyp from %s' % os.getcwd() |
| 32 # Force file opening. |
| 33 open(os.path.join('..', 'trace_inputs.py'), 'rb').close() |
| 34 open(os.path.join('..', 'tests', 'trace_inputs_smoke_test.py'), 'rb').close() |
| 35 # Do not wait for the child to exit. |
| 36 # Use relative directory. |
| 37 subprocess.Popen(['python', 'child2.py'], cwd='trace_inputs') |
| 38 return 0 |
| 39 |
| 40 |
| 41 def main(): |
| 42 if sys.argv[1] == '--child': |
| 43 return child() |
| 44 if sys.argv[1] == '--child-gyp': |
| 45 return child_gyp() |
| 46 return 1 |
| 47 |
| 48 |
| 49 if __name__ == '__main__': |
| 50 sys.exit(main()) |
OLD | NEW |