[llvm-commits] [zorg] r86505 - in /zorg/trunk: buildbot/smooshlab/master/master.cfg zorg/buildbot/builders/ClangBuilder.py zorg/buildbot/builders/ClangMSVC_cmakegen.bat zorg/buildbot/builders/ClangMSVC_vcbuild.bat zorg/buildbot/commands/BatchFileDownload.py zorg/buildbot/commands/__init__.py

Daniel Dunbar daniel at zuster.org
Sun Nov 8 19:09:23 PST 2009


Author: ddunbar
Date: Sun Nov  8 21:09:23 2009
New Revision: 86505

URL: http://llvm.org/viewvc/llvm-project?rev=86505&view=rev
Log:
Add a BatchFileDownload step, and use that instead of having needing static .bat files.

Also simplify/parameterize more of the ClangMSVC build factory, and switch to the ClangTestCommand instead of DejaGNU.

Added:
    zorg/trunk/zorg/buildbot/commands/BatchFileDownload.py
Removed:
    zorg/trunk/zorg/buildbot/builders/ClangMSVC_cmakegen.bat
    zorg/trunk/zorg/buildbot/builders/ClangMSVC_vcbuild.bat
Modified:
    zorg/trunk/buildbot/smooshlab/master/master.cfg
    zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
    zorg/trunk/zorg/buildbot/commands/__init__.py

Modified: zorg/trunk/buildbot/smooshlab/master/master.cfg
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/smooshlab/master/master.cfg?rev=86505&r1=86504&r2=86505&view=diff

==============================================================================
--- zorg/trunk/buildbot/smooshlab/master/master.cfg (original)
+++ zorg/trunk/buildbot/smooshlab/master/master.cfg Sun Nov  8 21:09:23 2009
@@ -78,9 +78,7 @@
 c['builders'].append({ 'slavenames' : ['giles'],
                        'name' : "clang-x86_64-darwin10",
                        'builddir' : "clang-x86_64-darwin10",
-                       'factory' : ClangBuilder.getClangBuildFactory('x86_64-apple-darwin10', 
-                                                                     CC='/usr/bin/gcc-4.2 -arch x86_64',
-                                                                     CXX='/usr/bin/g++-4.2 -arch x86_64')})
+                       'factory' : ClangBuilder.getClangBuildFactory('x86_64-apple-darwin10')})
 
 c['builders'].append({ 'slavenames' : ['giles'],
                        'name' : "llvmgcc",

Modified: zorg/trunk/zorg/buildbot/builders/ClangBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangBuilder.py?rev=86505&r1=86504&r2=86505&view=diff

==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangBuilder.py Sun Nov  8 21:09:23 2009
@@ -8,16 +8,20 @@
 from buildbot.steps.transfer import FileDownload
 from buildbot.process.properties import WithProperties
 
-from zorg.buildbot.commands.DejaGNUCommand import DejaGNUCommand
 from zorg.buildbot.commands.ClangTestCommand import ClangTestCommand
-from zorg.buildbot.commands.GTestCommand import GTestCommand
+from zorg.buildbot.commands.BatchFileDownload import BatchFileDownload
 
-def getClangBuildFactory(triple,
-                         CC='gcc', CXX='g++',
-                         CFLAGS='', CXXFLAGS='',
-                         useCMake=False,
-                         extraMakeArgs=''):
+def getClangBuildFactory(triple, clean=True, test=True):
     f = buildbot.process.factory.BuildFactory()
+
+    # Determine the build directory.
+    f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir",
+                                               command=["pwd"],
+                                               property="builddir",
+                                               description="set build dir",
+                                               workdir="."))
+
+    # Checkout sources.
     f.addStep(SVN(name='svn-llvm',
                   mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
                   defaultBranch='trunk',
@@ -26,70 +30,54 @@
                   mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/',
                   defaultBranch='trunk',
                   workdir='llvm/tools/clang'))
-    if useCMake:
-        builddir = 'llvm/build'
-        f.addStep(ShellCommand(command=['cmake',
-                                     '-DCMAKE_C_COMPILER=%s' % (CC,),
-                                     '-DCMAKE_CXX_COMPILER=%s' % (CXX,),
-                                     '-DCMAKE_C_FLAGS=%s' % (CFLAGS,),
-                                     '-DCMAKE_CXX_FLAGS=%s' % (CXXFLAGS,),
-                                     '../'],
-                            workdir=builddir,
-                            description=['cmake','Debug'],
-                            descriptionDone=['cmake','Debug']))
-    else:
-        builddir = 'llvm'
-        f.addStep(Configure(command=['./configure',
-                                     '--build', triple,
-                                     'CC=%s %s' % (CC, CFLAGS),
-                                     'CXX=%s %s' % (CXX, CXXFLAGS)],
-                            workdir=builddir,
-                            description=['configuring','Debug'],
-                            descriptionDone=['configure','Debug']))
-    f.addStep(WarningCountingShellCommand(name="clean-llvm",
-                                          command="make clean",
-                                          haltOnFailure=True,
-                                          description="cleaning llvm",
-                                          descriptionDone="clean llvm",
-                                          workdir=builddir))
+    f.addStep(Configure(command=['./configure',
+                                 '--build', triple,
+                                 '--host', triple,
+                                 '--target', triple],
+                        workdir='llvm',
+                        description=['configuring','Debug'],
+                        descriptionDone=['configure','Debug']))
+    if clean:
+        f.addStep(WarningCountingShellCommand(name="clean-llvm",
+                                              command="make clean",
+                                              haltOnFailure=True,
+                                              description="cleaning llvm",
+                                              descriptionDone="clean llvm",
+                                              workdir='llvm'))
     f.addStep(WarningCountingShellCommand(name="compile",
                                           command=WithProperties("nice -n 10 make -j%(jobs)d"),
                                           haltOnFailure=True,
                                           description="compiling llvm & clang",
                                           descriptionDone="compile llvm & clang",
-                                          workdir=builddir))
-    if not useCMake: # :(
-        f.addStep(DejaGNUCommand(name='test-llvm',
-                                 workdir=builddir))
-    if not useCMake: # :(
+                                          workdir='llvm'))
+    if test:
+        f.addStep(ClangTestCommand(name='test-llvm',
+                                   command=["make", "check-lit", "VERBOSE=1"],
+                                   description=["testing", "llvm"],
+                                   descriptionDone=["test", "llvm"],
+                                   workdir='llvm'))
         f.addStep(ClangTestCommand(name='test-clang',
-                                   command=WithProperties("nice -n 10 make -j%(jobs)d test VERBOSE=1"),
-                                   workdir="llvm/tools/clang"))
-    if not useCMake: # :(
-        f.addStep(GTestCommand(name="unittest-llvm",
-                               command=["make", "unittests"],
-                               description="unittests (llvm)",
-                               workdir="llvm"))
+                                   command=WithProperties("nice -n 10 make test VERBOSE=1"),
+                                   workdir='llvm/tools/clang'))
     return f
 
-
-def getClangMSVCBuildFactory():
+def getClangMSVCBuildFactory(update=True, clean=True, vcDrive='c', jobs=1):
     f = buildbot.process.factory.BuildFactory()
 
-    if True:
+    if update:
         f.addStep(SVN(name='svn-llvm',
                       mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
                       defaultBranch='trunk',
                       workdir='llvm'))
 
-    if True:
+    if update:
         f.addStep(SVN(name='svn-clang',
                       mode='update', baseURL='http://llvm.org/svn/llvm-project/cfe/',
                       defaultBranch='trunk',
                       workdir='llvm/tools/clang'))
 
     # Full & fast clean.
-    if True:
+    if clean:
         f.addStep(ShellCommand(name='clean-1',
                                command=['del','/s/q','build'],
                                warnOnFailure=True,
@@ -105,15 +93,15 @@
 
     # Create the project files.
 
-    # FIXME: Don't require local versions of these files. See buildbot ticket
-    # #595. We could always write the contents into a temp file, to avoid having
-    # them in SVN, and to allow parameterization.
-    #
-    # See also buildbot ticket #377.
-    f.addStep(FileDownload(mastersrc=os.path.join(os.path.dirname(__file__),
-                                                  'ClangMSVC_cmakegen.bat'),
-                           slavedest='cmakegen.bat',
-                           workdir='llvm\\build'))
+    # Use batch files instead of ShellCommand directly, Windows quoting is
+    # borked. FIXME: See buildbot ticket #595 and buildbot ticket #377.
+    f.addStep(BatchFileDownload(name='cmakegen',
+                                command=[r"c:\Program Files\CMake 2.6\bin\cmake",
+                                         "-DLLVM_TARGETS_TO_BUILD:=X86",
+                                         "-G",
+                                         "Visual Studio 9 2008",
+                                         ".."],
+                                workdir="llvm\\build"))
     f.addStep(ShellCommand(name='cmake',
                            command=['cmakegen.bat'],
                            haltOnFailure=True,
@@ -121,14 +109,27 @@
                            workdir='llvm\\build'))
 
     # Build it.
-    f.addStep(FileDownload(mastersrc=os.path.join(os.path.dirname(__file__),
-                                                  'ClangMSVC_vcbuild.bat'),
-                           slavedest='vcbuild.bat',
-                           workdir='llvm\\build'))
+    f.addStep(BatchFileDownload(name='vcbuild',
+                                command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""",
+                                         "/M%d" % jobs,
+                                         "LLVM.sln",
+                                         "Debug|Win32"],
+                                workdir="llvm\\build"))
     f.addStep(WarningCountingShellCommand(name='vcbuild',
                                           command=['vcbuild.bat'],
                                           haltOnFailure=True,
                                           description='vcbuild',
                                           workdir='llvm\\build',
                                           warningPattern=" warning C.*:"))
+
+    # Build clang-test project.
+    f.addStep(BatchFileDownload(name='vcbuild_test',
+                                command=[vcDrive + r""":\Program Files\Microsoft Visual Studio 9.0\VC\VCPackages\vcbuild.exe""",
+                                         "clang-test.vcproj",
+                                         "Debug|Win32"],
+                                workdir="llvm\\build\\tools\\clang\\test"))
+    f.addStep(ClangTestCommand(name='test-clang',
+                               command=["vcbuild_test.bat"],
+                               workdir="llvm\\build\\tools\\clang\\test"))
+
     return f

Removed: zorg/trunk/zorg/buildbot/builders/ClangMSVC_cmakegen.bat
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangMSVC_cmakegen.bat?rev=86504&view=auto

==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangMSVC_cmakegen.bat (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangMSVC_cmakegen.bat (removed)
@@ -1,2 +0,0 @@
- at echo on
-c:\"Program Files"\"CMake 2.6"\bin\cmake -DLLVM_TARGETS_TO_BUILD:=X86 -G "Visual Studio 9 2008" ..

Removed: zorg/trunk/zorg/buildbot/builders/ClangMSVC_vcbuild.bat
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangMSVC_vcbuild.bat?rev=86504&view=auto

==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangMSVC_vcbuild.bat (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangMSVC_vcbuild.bat (removed)
@@ -1,3 +0,0 @@
- at echo on
-g:\"Program Files"\"Microsoft Visual Studio 9.0"\VC\VCPackages\vcbuild.exe LLVM.sln "Debug|Win32"
-

Added: zorg/trunk/zorg/buildbot/commands/BatchFileDownload.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/BatchFileDownload.py?rev=86505&view=auto

==============================================================================
--- zorg/trunk/zorg/buildbot/commands/BatchFileDownload.py (added)
+++ zorg/trunk/zorg/buildbot/commands/BatchFileDownload.py Sun Nov  8 21:09:23 2009
@@ -0,0 +1,27 @@
+from buildbot.steps.transfer import FileDownload
+
+class BatchFileDownload(FileDownload):
+    # FIXME: It would be nice to form a BatchedShellCommand step out of this.
+    def __init__(self, **kwargs):
+        if 'command' in kwargs:
+            if 'mastersrc' in kwargs:
+                raise ValueError,"Unexpected 'mastersrc' argument."
+            if 'slavedest' in kwargs:
+                raise ValueError,"Unexpected 'slavedest' argument."
+
+            # This is the initial construction, create a temporary
+            # batch file to run the command.
+            import os
+            import tempfile
+
+            command = kwargs.pop('command')
+            tf = tempfile.NamedTemporaryFile(delete=False)
+            print >>tf, '@echo on'
+            print >>tf, ' '.join('"%s"' % a for a in command)
+            tf.close()
+
+            remotename = kwargs.get('name', 'batched-command')
+            kwargs['mastersrc'] = os.path.abspath(tf.name)
+            kwargs['slavedest'] = '%s.bat' % remotename
+
+        FileDownload.__init__(self, **kwargs)

Modified: zorg/trunk/zorg/buildbot/commands/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/commands/__init__.py?rev=86505&r1=86504&r2=86505&view=diff

==============================================================================
--- zorg/trunk/zorg/buildbot/commands/__init__.py (original)
+++ zorg/trunk/zorg/buildbot/commands/__init__.py Sun Nov  8 21:09:23 2009
@@ -1,4 +1,5 @@
 import AnalyzerCompareCommand
+import BatchFileDownload
 import ClangTestCommand
 import DejaGNUCommand
 import GTestCommand





More information about the llvm-commits mailing list