Merge "Cleanup vp9_rd_pick_inter_mode_sub8x8()."
[aom.git] / tools / all_builds.py
blobd1f0c80c038af476cf03af5c0483a7434067b1af
1 #!/usr/bin/python
3 import getopt
4 import subprocess
5 import sys
7 LONG_OPTIONS = ["shard=", "shards="]
8 BASE_COMMAND = "./configure --enable-internal-stats --enable-experimental"
10 def RunCommand(command):
11 run = subprocess.Popen(command, shell=True)
12 output = run.communicate()
13 if run.returncode:
14 print "Non-zero return code: " + str(run.returncode) + " => exiting!"
15 sys.exit(1)
17 def list_of_experiments():
18 experiments = []
19 configure_file = open("configure")
20 list_start = False
21 for line in configure_file.read().split("\n"):
22 if line == 'EXPERIMENT_LIST="':
23 list_start = True
24 elif line == '"':
25 list_start = False
26 elif list_start:
27 currently_broken = ["csm"]
28 experiment = line[4:]
29 if experiment not in currently_broken:
30 experiments.append(experiment)
31 return experiments
33 def main(argv):
34 # Parse arguments
35 options = {"--shard": 0, "--shards": 1}
36 if "--" in argv:
37 opt_end_index = argv.index("--")
38 else:
39 opt_end_index = len(argv)
40 try:
41 o, _ = getopt.getopt(argv[1:opt_end_index], None, LONG_OPTIONS)
42 except getopt.GetoptError, err:
43 print str(err)
44 print "Usage: %s [--shard=<n> --shards=<n>] -- [configure flag ...]"%argv[0]
45 sys.exit(2)
47 options.update(o)
48 extra_args = argv[opt_end_index + 1:]
50 # Shard experiment list
51 shard = int(options["--shard"])
52 shards = int(options["--shards"])
53 experiments = list_of_experiments()
54 base_command = " ".join([BASE_COMMAND] + extra_args)
55 configs = [base_command]
56 configs += ["%s --enable-%s" % (base_command, e) for e in experiments]
57 my_configs = zip(configs, range(len(configs)))
58 my_configs = filter(lambda x: x[1] % shards == shard, my_configs)
59 my_configs = [e[0] for e in my_configs]
61 # Run configs for this shard
62 for config in my_configs:
63 test_build(config)
65 def test_build(configure_command):
66 print "\033[34m\033[47mTesting %s\033[0m" % (configure_command)
67 RunCommand(configure_command)
68 RunCommand("make clean")
69 RunCommand("make")
71 if __name__ == "__main__":
72 main(sys.argv)