WebStatus: yes create public_html/ at startup, otherwise we get internal server error...
[buildbot.git] / buildbot / test / emitlogs.py
blobfcd380f042b835c066ffa2c6d9dd23569f00eaaa
1 #! /usr/bin/python
3 import sys, time, os.path, StringIO
5 mode = 0
6 if len(sys.argv) > 1:
7 mode = int(sys.argv[1])
9 if mode == 0:
10 log2 = open("log2.out", "wt")
11 log3 = open("log3.out", "wt")
12 elif mode == 1:
13 # delete the logfiles first, and wait a moment to exercise a failure path
14 if os.path.exists("log2.out"):
15 os.unlink("log2.out")
16 if os.path.exists("log3.out"):
17 os.unlink("log3.out")
18 time.sleep(2)
19 log2 = open("log2.out", "wt")
20 log3 = open("log3.out", "wt")
21 elif mode == 2:
22 # don't create the logfiles at all
23 log2 = StringIO.StringIO()
24 log3 = StringIO.StringIO()
26 def write(i):
27 log2.write("this is log2 %d\n" % i)
28 log2.flush()
29 log3.write("this is log3 %d\n" % i)
30 log3.flush()
31 sys.stdout.write("this is stdout %d\n" % i)
32 sys.stdout.flush()
34 write(0)
35 time.sleep(1)
36 write(1)
37 sys.stdin.read(1)
38 write(2)
40 log2.close()
41 log3.close()
43 sys.exit(0)