From 87114af8199348e8b441885427d58542419c1322 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Mon, 13 Oct 2003 22:11:16 +0000 Subject: [PATCH] Add simple script to allow cycling between multiple tinderbox trees and configurations. b=218879 r=bryner --- tools/tinderbox/multi-tinderbox.pl | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 tools/tinderbox/multi-tinderbox.pl diff --git a/tools/tinderbox/multi-tinderbox.pl b/tools/tinderbox/multi-tinderbox.pl new file mode 100755 index 00000000000..9a118c9ec60 --- /dev/null +++ b/tools/tinderbox/multi-tinderbox.pl @@ -0,0 +1,75 @@ +#!/usr/bin/perl +# vim:sw=4:et:ts=4:ai: + +use strict; + +sub PrintUsage() { + die < "SeaMonkey", args => "--depend --mozconfig mozconfig" }, { tree => "SeaMonkey-Branch", args => "--depend --mozconfig mozconfig" } ]; +END_EXAMPLE + ; + exit; +} + +sub HandleArgs() { + return if ($#ARGV == -1); + PrintUsage() if ($#ARGV != 0 || $ARGV[0] ne "--example-config"); + PrintExample(); +} + +sub LoadConfig() { + if (-r 'multi-config.pl') { + no strict 'vars'; + + open CONFIG, 'multi-config.pl' or + print "can't open multi-config.pl, $?\n"; + + while () { + package Settings; + eval; + } + + close CONFIG; + } else { + warn "Error: Need tinderbox config file, multi-config.pl\n"; + exit; + } +} + + +sub Run() { + my $start_time = 0; + while (1) { + # $BuildSleep is the minimum amount of time a build is allowed to take. + # It prevents sending too many messages to the tinderbox server when + # something is broken. + my $sleep_time = ($Settings::BuildSleep * 60) - (time() - $start_time); + if ($sleep_time > 0) { + print "\n\nSleeping $sleep_time seconds ...\n"; + sleep $sleep_time; + } + $start_time = time(); + + foreach my $treeentry (@{$Settings::Tinderboxes}) { + chdir($treeentry->{tree}) or + die "Tree $treeentry->{tree} does not exist"; + system("./build-seamonkey.pl --once $treeentry->{args}"); + chdir(".."); + } + } +} + +HandleArgs(); +LoadConfig(); +Run();