source: 2013/30/build_and_write_report.py @ 4687

Revision 4687, 1.1 KB checked in by tojukarp, 6 years ago (diff)

Script and library updates

Line 
1# -*- coding: latin-1 -*-
2"""
3Calls the build_games- and write_report-scripts continuously,
4until ctrl-c is pressed.
5"""
6
7import sys
8from subprocess import *
9import time
10
11
12programs = []
13processes = []
14
15
16def add_program(command_line):
17    global programs
18    global processes
19    programs.append(command_line)
20    processes.append(Popen(command_line, shell=True))
21
22
23def restart_finished_programs():
24    for i in range(len(programs)):
25        return_code = processes[i].poll()
26        if return_code is not None:
27            # the process has finished, restart it
28            processes[i] = Popen(programs[i], shell=True)
29
30
31def main():
32    try:
33        add_program("build_games.py --write-results --no-pong")
34        # write report expects to find a build result directory, which
35        # is created by the build script. So, lets give the build a head start.
36        time.sleep(5)
37
38        add_program("write_report.py --hide-pong")
39       
40    except KeyboardInterrupt:
41        pass
42    except Exception, e:
43        print
44        print "NOT SUCCESSFUL:", e
45        return 1
46
47
48if __name__ == '__main__':
49    sys.exit(main())
50
Note: See TracBrowser for help on using the repository browser.