Commit a8f9842d authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review
Browse files

Merge "all_builds.py: support for sharding builds" into experimental

parents b43ed7a5 778393cf
#!/usr/bin/python #!/usr/bin/python
import getopt
import subprocess import subprocess
import sys import sys
LONG_OPTIONS = ["shard=", "shards="]
BASE_COMMAND = "./configure --enable-internal-stats --enable-experimental"
def RunCommand(command): def RunCommand(command):
run = subprocess.Popen(command, shell=True) run = subprocess.Popen(command, shell=True)
output = run.communicate() output = run.communicate()
...@@ -26,12 +30,25 @@ def list_of_experiments(): ...@@ -26,12 +30,25 @@ def list_of_experiments():
experiments.append(experiment) experiments.append(experiment)
return experiments return experiments
def main(): def main(argv):
base_command = "./configure --enable-internal-stats" # Parse arguments
test_build(base_command) options = {"--shard": 0, "--shards": 1}
for experiment_name in list_of_experiments(): o, _ = getopt.getopt(argv[1:], None, LONG_OPTIONS)
test_build("%s --enable-experimental --enable-%s" % (base_command, options.update(o)
experiment_name))
# Shard experiment list
shard = int(options["--shard"])
shards = int(options["--shards"])
experiments = list_of_experiments()
configs = [BASE_COMMAND]
configs += ["%s --enable-%s" % (BASE_COMMAND, e) for e in experiments]
my_configs = zip(configs, range(len(configs)))
my_configs = filter(lambda x: x[1] % shards == shard, my_configs)
my_configs = [e[0] for e in my_configs]
# Run configs for this shard
for config in my_configs:
test_build(config)
def test_build(configure_command): def test_build(configure_command):
print "\033[34m\033[47mTesting %s\033[0m" % (configure_command) print "\033[34m\033[47mTesting %s\033[0m" % (configure_command)
...@@ -40,4 +57,4 @@ def test_build(configure_command): ...@@ -40,4 +57,4 @@ def test_build(configure_command):
RunCommand("make") RunCommand("make")
if __name__ == "__main__": if __name__ == "__main__":
main() main(sys.argv)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment