[pypy-svn] r59777 - in pypy/build/bot2/pypybuildbot: . test

fijal at codespeak.net fijal at codespeak.net
Sat Nov 8 12:34:01 CET 2008


Author: fijal
Date: Sat Nov  8 12:34:00 2008
New Revision: 59777

Modified:
   pypy/build/bot2/pypybuildbot/builds.py
   pypy/build/bot2/pypybuildbot/test/test_builds.py
Log:
scratchbox should now checkout in a directory which is accessible from inside
the scratchbox


Modified: pypy/build/bot2/pypybuildbot/builds.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/builds.py	(original)
+++ pypy/build/bot2/pypybuildbot/builds.py	Sat Nov  8 12:34:00 2008
@@ -1,7 +1,7 @@
 from buildbot.process import factory
 from buildbot.steps import source, shell
 from buildbot.status.builder import SUCCESS
-
+import os, py
 
 class ShellCmd(shell.ShellCommand):
     # our own version that can distinguish abort cases (rc == -1)
@@ -16,7 +16,7 @@
 
     def __init__(self, **kwds):
         shell.SetProperty.__init__(self, description="first-time",
-                                   property="first-time")
+                                   property="first-time", **kwds)
 
 
 class PosixFirstTime(FirstTime):
@@ -65,13 +65,13 @@
 
 def not_first_time(props):
     first_time = props.getProperty("first-time")
-    return not first_time 
+    return not first_time
 
-def setup_steps(platform, factory):
+def setup_steps(platform, factory, workdir='.'):
     if platform == "win32":
-        first_time_check = WindowsFirstTime()
+        first_time_check = WindowsFirstTime(workdir=workdir)
     else:
-        first_time_check = PosixFirstTime()
+        first_time_check = PosixFirstTime(workdir=workdir)
 
     factory.addStep(first_time_check)
     factory.addStep(CondShellCommand(
@@ -79,9 +79,10 @@
         cond=not_first_time,
         command = ["python", "py/bin/py.svnwcrevert", 
                    "-p.buildbot-sourcedata", "."],
+        workdir=workdir,
         ))
     factory.addStep(source.SVN(baseURL="http://codespeak.net/svn/pypy/",
-                            defaultBranch="trunk"))
+                            defaultBranch="trunk", workdir=workdir))
 
 
 class PyPyOwnTestFactory(factory.BuildFactory):
@@ -120,6 +121,10 @@
                      "--resultlog=cpython.log", "lib-python"],           
             logfiles={'pytestLog': 'cpython.log'}))
 
+USERNAME = py.path.local(os.environ['HOME']).basename
+SCRATCHBOX_WORKDIR = py.path.local("/scratchbox/users/%s/home/%s/build" %
+                                   (USERNAME, USERNAME))
+
 class PyPyTranslatedAppLevelTestFactory(factory.BuildFactory):
 
     def __init__(self, *a, **kw):
@@ -144,7 +149,6 @@
     def __init__(self, *a, **kw):
         platform = kw.pop('platform', 'linux')
         factory.BuildFactory.__init__(self, *a, **kw)
-
-        setup_steps(platform, self)
-
-        self.addStep(Translate(["--platform", "maemo", "-Omem"], []))
+        setup_steps(platform, self, workdir=str(SCRATCHBOX_WORKDIR))
+        self.addStep(Translate(["--platform", "maemo", "-Omem"], [],
+           workdir=str(SCRATCHBOX_WORKDIR.join('pypy', 'translator', 'goal'))))

Modified: pypy/build/bot2/pypybuildbot/test/test_builds.py
==============================================================================
--- pypy/build/bot2/pypybuildbot/test/test_builds.py	(original)
+++ pypy/build/bot2/pypybuildbot/test/test_builds.py	Sat Nov  8 12:34:00 2008
@@ -1,5 +1,5 @@
 from pypybuildbot import builds
-
+import os, py
 
 def test_Translate():
     expected = ['translate.py', '--batch', '-O0',
@@ -13,3 +13,11 @@
     rebuiltTranslate = translateFactory(**kw)
                 
     assert rebuiltTranslate.command[-len(expected):] == expected
+
+def test_scratchbox():
+    factory = builds.PyPyTranslatedScratchboxTestFactory()
+    user = py.path.local(os.environ['HOME']).basename
+    for step in factory.steps:
+        assert step[1]['workdir'].startswith('/scratchbox/users/%s/home/%s' %
+                                             (user, user))
+



More information about the Pypy-commit mailing list