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 LUCI 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 by the Apache v2.0 license that can be |
4 # can be found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This script is meant to be run on a Swarming slave.""" | 6 """This script is meant to be run on a Swarming slave.""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
11 | 11 |
12 def main(): | 12 def main(): |
13 print('Hello world: ' + sys.argv[1]) | 13 print('Hello world: ' + sys.argv[1]) |
14 if len(sys.argv) == 3: | 14 if len(sys.argv) == 3: |
15 # Write a file in ${ISOLATED_OUTDIR}. | 15 # Write a file in ${ISOLATED_OUTDIR}. |
16 with open(os.path.join(sys.argv[2], 'happiness.txt'), 'wb') as f: | 16 with open(os.path.join(sys.argv[2], 'happiness.txt'), 'wb') as f: |
17 f.write( | 17 f.write( |
18 'is where you look %d/%d' % ( | 18 'is where you look %d/%d' % ( |
19 int(os.environ['GTEST_SHARD_INDEX']), | 19 int(os.environ['GTEST_SHARD_INDEX']), |
20 int(os.environ['GTEST_TOTAL_SHARDS']))) | 20 int(os.environ['GTEST_TOTAL_SHARDS']))) |
21 return 0 | 21 return 0 |
22 | 22 |
23 | 23 |
24 if __name__ == '__main__': | 24 if __name__ == '__main__': |
25 sys.exit(main()) | 25 sys.exit(main()) |
OLD | NEW |