OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2012 The Swarming Authors. All rights reserved. | 2 # Copyright 2012 The Swarming Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 that | 3 # Use of this source code is governed under the Apache License, Version 2.0 that |
4 # can be found in the LICENSE file. | 4 # can be found in the LICENSE file. |
5 | 5 |
6 """This script is meant to be run on a Swarm slave.""" | 6 """This script is meant to be run on a Swarming slave.""" |
7 | 7 |
| 8 import os |
8 import sys | 9 import sys |
9 | 10 |
10 | 11 |
11 def main(): | 12 def main(): |
12 print('Hello world: ' + sys.argv[1]) | 13 print('Hello world: ' + sys.argv[1]) |
| 14 if len(sys.argv) == 3: |
| 15 # Write a file in ${ISOLATED_OUTDIR}. |
| 16 with open(os.path.join(sys.argv[2], 'happiness.txt'), 'wb') as f: |
| 17 f.write( |
| 18 'is where you look %d/%d' % ( |
| 19 int(os.environ['GTEST_SHARD_INDEX']), |
| 20 int(os.environ['GTEST_TOTAL_SHARDS']))) |
13 return 0 | 21 return 0 |
14 | 22 |
15 | 23 |
16 if __name__ == '__main__': | 24 if __name__ == '__main__': |
17 sys.exit(main()) | 25 sys.exit(main()) |
OLD | NEW |