summaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-04 09:30:03 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-04 09:30:03 -0400
commitd9060af36a6cd6cfa972a3f2c7387e2f99d724a8 (patch)
tree7cc59446aec4bfbf98de71dcd5f48ed3308c3535 /devtools
parentd8fe0b4c9f17bac5a1888051eb108fdad898c1fd (diff)
downloadgpsd-d9060af36a6cd6cfa972a3f2c7387e2f99d724a8.tar.gz
flock framework checkpoint.
Diffstat (limited to 'devtools')
-rw-r--r--devtools/flock-instructions2
-rwxr-xr-xdevtools/flocktest36
-rw-r--r--devtools/flocktest.ini (renamed from devtools/flock-sites.ini)22
3 files changed, 40 insertions, 20 deletions
diff --git a/devtools/flock-instructions b/devtools/flock-instructions
index cf660672..8f0f5eed 100644
--- a/devtools/flock-instructions
+++ b/devtools/flock-instructions
@@ -22,7 +22,7 @@ To add a machine to the flock, do these steps:
ssh-dss AAAAB3NzaC1kc3MAAACBAPcpYG3nTzwrnZ1Nuz4FlODvnDaoHVaDoVg3jiSax/OJLuLmP+B1RMIMzQyQvbpeVHfMvBk1G+lqpysdUGOjM1ohYIXD479oOUg+Iga4SxrAwMwIiOFF5XhLc3hV2Ibd0N6V9ho8Sz8Kgq4CKj7323bLL+YpfldMhIlLXYDwTVo7AAAAFQCpZm4A5EiQar4+WavFBS1Xy3mJ6wAAAIEA2H33z6KpgRPIV/m5tRX4RmPmtunpC8UpBxj/uEadkaKnbDHLSuyUcflXe2A5xTuYIdFglEkt7ebZ1Gil4f7NuiKbukfQ13jMDWyuS9kDw0gr245kInu22dpfU1ZlCoDmNZSSeRJFkmhfvAim6yXoNpcS/PCaICNPJ1Ww9COYkqoAAACAY4g8mk80LXEpumbEonuDbsFobkz3HiooKgZd+xAGlYEDKpdVlh+bAXHW2R8tHnfYzP5Lq9nGan9i8GSAnw4ETwQ/IfIo7uT1OikyuImYqX2WKoUz5/3i9KOEUy4LWbqSHjIxBw3Y9ZlFYzq3gG/EhnmIuKGlN6Ig1P7B7v0GuXg= esr@snark
-5. Append an entry to the flock-sites file and push to origin with the commit
+5. Append an entry to the flocktest.ini file and push to origin with the commit
message "Added new flock site" or something similar. If you do not
have git commit access, mail the entry to the development mailing
list.
diff --git a/devtools/flocktest b/devtools/flocktest
index 4b08b412..c92bd5ad 100755
--- a/devtools/flocktest
+++ b/devtools/flocktest
@@ -3,10 +3,12 @@
"""\
flocktest - shepherd script for the GPSD test flock
-usage: flocktest [-d subdir] [-k key] -v [-x exclude] [-?]
+usage: flocktest [-c] [-d subdir] [-k key] -v [-x exclude] [-?]
The -? makes flocktest prints this help and exits.
+The -c option dumps flocktest's configuration and exits
+
The -k mode installs a specified ssh public key an all machines
Otherwise, the remote flockdriver script is executed on each machine.
@@ -23,7 +25,7 @@ are redundant with your local ones.
If you do not specify a subdirectory name, the value of $LOGNAME will be used.
"""
-import os, sys, ConfigParser, getopt, socket, threading, commands
+import os, sys, ConfigParser, getopt, socket, threading, commands, time
flockdriver = '''
#!/bin/sh
@@ -174,18 +176,21 @@ class TestSite:
self.do_remote("echo \"%s\" >>%s" % (string.strip(), filename))
def do_flockdriver(self):
"Copy flockdriver to the remote site and run it."
+ self.starttime = time.time()
+ status = 1
ofp = os.popen("ssh -p %s %s 'cat >flockdriver.%s'" \
% (self.config.get("port", "22"), self.me, subdir),
"w")
ofp.write(flockdriver % self.config)
if ofp.close():
- # FIXME: Error handling is unsatisfactory if this failes
print >>sys.stderr, "flocktest: flockdriver copy failed"
else:
command = "sh flockdriver.%s -d %s" % (subdir, subdir,)
if self.verbose > 1:
command = "sh -x " + command
- return self.do_remote(command)
+ status = self.do_remote(command)
+ self.elapsed = time.time() - self.starttime
+ return status
class TestFlock:
"Methods for performing parallel tests on a flock of remote sites."
@@ -201,17 +206,21 @@ class TestFlock:
"Execute a command on all machines in the flock."
slaves = []
print "== testing at: %s ==" % flock.listdump()
+ starttime = time.time()
for site in self.sitelist:
slaves.append(site.do_flockdriver())
for slave in slaves:
slave.join()
+ failed = 0
for slave in slaves:
if slave.status:
- print "== %s test FAILED, status %d ==" % (site.fqdn, slave.status)
+ print "== %s test FAILED in %.2f seconds, status %d ==" % (site.fqdn, site.elapsed, slave.status)
+ failed += 1
print slave.output
else:
- print "== %s test succeeded ==" % site.fqdn
- print "== tests completed =="
+ print "== %s test succeeded in %.2f seconds ==" % (site.fqdn, site.elapsed)
+ elapsed = time.time() - starttime
+ print "== %d tests completed in %.2f seconds: %d failed ==" % (len(slaves), site.elapsed, failed)
def exclude(self, exclusions):
"Delete matching sites."
self.sitelist = filter(lambda x: x.fqdn not in exclusions and x.config["arch"] not in exclusions, self.sitelist)
@@ -226,7 +235,7 @@ class TestFlock:
if __name__ == '__main__':
try:
- (options, arguments) = getopt.getopt(sys.argv[1:], "dk:vx:?")
+ (options, arguments) = getopt.getopt(sys.argv[1:], "cdk:vx:?")
except getopt.GetoptError, msg:
print "flocktest: " + str(msg)
raise SystemExit, 1
@@ -235,8 +244,11 @@ if __name__ == '__main__':
subdir = None
key = None
verbose = False
+ dumpconf = False
for (switch, val) in options:
- if switch == 'd':
+ if switch == '-c':
+ dumpconf = True
+ elif switch == '-d':
subdir = val
elif switch == '-k':
key = val
@@ -251,7 +263,7 @@ if __name__ == '__main__':
sys.exit(0)
config = ConfigParser.RawConfigParser()
- config.read(["flock-sites.ini"])
+ config.read(["flocktest.ini", ".flocktest.ini"])
sites = []
for site in config.sections():
newsite = TestSite(site, dict(config.items(site)))
@@ -262,7 +274,9 @@ if __name__ == '__main__':
if exclusions:
flock.exclude(exclusions)
- if key:
+ if dumpconf:
+ config.write(sys.stdout)
+ elif key:
flock.add_key(val)
else:
if not subdir:
diff --git a/devtools/flock-sites.ini b/devtools/flocktest.ini
index 9e210923..72ab17d8 100644
--- a/devtools/flock-sites.ini
+++ b/devtools/flocktest.ini
@@ -5,16 +5,22 @@
# For instructions on joining and using this network, see the file
# 'flock-instructions'.
#
-# In each site section, the section name is the FQDN of the host machine.
-# The attributes are:
+# In the default section of the file, the attributes are:
+# project - project name at CIA.vc
+# origin = URL for repo pulls
+# regression = test sequence to run
+# sshkeys = path to file of user keys
#
[DEFAULT]
project = GPSD
origin = git://git.berlios.de/gpsd
regression = ./autogen.sh && make && make check
-
+#
+# In each site section, the section name is the FQDN of the host machine.
+# The attributes are:
+#
# arch: Architecture tag - i686, x96_64, sparc64, etc. = `uname -m`
-# os: Operating sytem = `uname -s`
+# os: Operating system = `uname -s`
# admin: Email address of machine administrator
# login: Login name of test account
# devices: Comma-separated list of attached GPS/AIS receivers, or '-' for none.
@@ -36,20 +42,20 @@ login = gpsd
devices = -
status = running version of vserver with no localhost, port binds fail
-[nog.malcom-blue.no-ip.com]
+[nog.yazug.com]
os = Linux
arch = i686
admin = jon.schlueter@gmail.com
login = gpsd
devices = Garmin GPS18 USB
-status = inaccessible
+status = up
-[quark.malcom-blue.no-ip.com]
+[quark.yazug.com]
os = Linux
arch = i686
admin = jon.schlueter@gmail.com
login = gpsd
devices = -
port = 4670
-status = inaccessible
+status = up