14
def run_scenarios(scenarios, group):
17
for scenario in scenarios:
19
argv.append("ccdash.py")
20
argv.append("scenario")
22
argv.append("--group")
24
thisrc = ccdash.main(argv)
31
print """Periodically monitor working directory for Continuous and Nightly builds
34
run_continuous.py [options] scenario1.xml [scenario2.xml ...]
37
These are options which will be processed by run_continuous.py:
39
--delay MIN Delay both Continuous and Nightly builds by MIN minutes.
40
This is useful to coordinate the build with other build
41
machines. By default, Continuous build will be done right
42
after changes are detected, and Nightly build will be done
43
at 00:00 GMT. MIN is a float number.
45
--once Just run one loop to see if anything needs to be done and
46
if so just do it once. Quit after that.
48
--suffix SFX Set group suffix to SFX. For example, if SFX is "-2.x", then
49
tests will be submitted to "Nightly-2.x", "Continuous-2.x",
50
and "Experimental-2.x"
52
--force Force running the test even when nothing has changed.
56
if __name__ == "__main__":
57
if len(sys.argv)<=1 or sys.argv[1]=="-h" or sys.argv[1]=="--h" or sys.argv[1]=="--help" or sys.argv[1]=="/h":
63
while i < len(sys.argv):
64
if sys.argv[i]=="--delay":
66
if i >= len(sys.argv):
67
print "Error: missing argument"
69
DELAY = float(sys.argv[i]) * 60
70
print "Delay is set to %f minute(s)" % (DELAY / 60)
71
elif sys.argv[i]=="--suffix":
73
if i >= len(sys.argv):
74
print "Error: missing argument"
77
print "Suffix is set to %s" % (SUFFIX)
78
elif sys.argv[i]=="--once":
80
elif sys.argv[i]=="--force":
83
# Check if scenario exists
84
scenario = sys.argv[i]
85
if not os.path.exists(scenario):
86
print "Error: file " + scenario + " does not exist"
88
scenarios.append(scenario)
89
print "Scenario %s added" % (scenario)
92
if len(scenarios) < 1:
93
print "Error: scenario is required"
97
utc = time.gmtime(None)
104
# Anything changed recently?
105
argv.append("ccdash.py")
106
argv.append("status")
109
rc = ccdash.main(argv)
111
utc = time.gmtime(None)
113
if utc.tm_mday != day or rc != 0 or FORCE:
115
if utc.tm_mday != day:
117
group = "Nightly" + SUFFIX
119
group = "Continuous" + SUFFIX
121
group = "Experimental" + SUFFIX
123
print "Will run %s after %f s.." % (group, DELAY)
125
rc = run_scenarios(scenarios, group)
126
msg = str(datetime.datetime.now()) + \
127
": done running " + group + \
128
"tests, will check again in " + str(INTERVAL) + "s.."
133
msg = str(datetime.datetime.now()) + \
134
": No update, will check again in " + str(INTERVAL) + "s.."