[llvm-commits] [zorg] r82959 - /zorg/trunk/zorg/buildbot/builders/TestBuilders.py

Daniel Dunbar daniel at zuster.org
Sun Sep 27 20:48:22 CDT 2009


Author: ddunbar
Date: Sun Sep 27 20:48:22 2009
New Revision: 82959

URL: http://llvm.org/viewvc/llvm-project?rev=82959&view=rev
Log:
Add a factory which randomly fails, good for testing status clients.

Added:
    zorg/trunk/zorg/buildbot/builders/TestBuilders.py

Added: zorg/trunk/zorg/buildbot/builders/TestBuilders.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/TestBuilders.py?rev=82959&view=auto

==============================================================================
--- zorg/trunk/zorg/buildbot/builders/TestBuilders.py (added)
+++ zorg/trunk/zorg/buildbot/builders/TestBuilders.py Sun Sep 27 20:48:22 2009
@@ -0,0 +1,15 @@
+from buildbot import process, steps
+from buildbot.steps.shell import Configure, ShellCommand
+
+def getRandomFailFactory(probability=.5):
+    p = float(probability)
+    command = ["python", "-c",
+               """import sys, random; """ +
+               """sys.exit(random.random() < %.2f)""" % p]
+
+    f = process.factory.BuildFactory()
+    f.addStep(steps.shell.ShellCommand(name="fail.random", command=command,
+                                       haltOnFailure=True,
+                                       description="fail.random",
+                                       workdir="."))
+    return f





More information about the llvm-commits mailing list