(refs #557, #559) use tarfile to upload multiple files from the master
[buildbot.git] / buildbot / test / emitlogs.py
blob143023596d24e41ce859c35456502ae6fa256888
1 import sys, time, os.path, StringIO
3 mode = 0
4 if len(sys.argv) > 1:
5 mode = int(sys.argv[1])
7 if mode == 0:
8 log2 = open("log2.out", "wt")
9 log3 = open("log3.out", "wt")
10 elif mode == 1:
11 # delete the logfiles first, and wait a moment to exercise a failure path
12 if os.path.exists("log2.out"):
13 os.unlink("log2.out")
14 if os.path.exists("log3.out"):
15 os.unlink("log3.out")
16 time.sleep(2)
17 log2 = open("log2.out", "wt")
18 log3 = open("log3.out", "wt")
19 elif mode == 2:
20 # don't create the logfiles at all
21 log2 = StringIO.StringIO()
22 log3 = StringIO.StringIO()
24 def write(i):
25 log2.write("this is log2 %d\n" % i)
26 log2.flush()
27 log3.write("this is log3 %d\n" % i)
28 log3.flush()
29 sys.stdout.write("this is stdout %d\n" % i)
30 sys.stdout.flush()
32 write(0)
33 time.sleep(1)
34 write(1)
35 sys.stdin.read(1)
36 write(2)
38 log2.close()
39 log3.close()
41 sys.exit(0)