]> xenbits.xensource.com Git - people/pauldu/xennet.git/commitdiff
Add SDV to the standard build
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 14 Mar 2014 16:45:55 +0000 (17:45 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 18 Mar 2014 09:38:21 +0000 (10:38 +0100)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
build.py
msbuild.bat [new file with mode: 0644]
proj/msbuild.bat [deleted file]
proj/xennet/xennet.vcxproj
sdv.py [deleted file]
src/xennet/assert.h
src/xennet/dbg_print.h

index 365a16a8dcc7b0f410d20e1cbf021002cb1aff86..b58ae8633c51ed60ac542a3a6276d2fef3226633 100644 (file)
--- a/build.py
+++ b/build.py
@@ -6,6 +6,7 @@ import re
 import glob
 import tarfile
 import subprocess
+import shutil
 
 def next_build_number():
     try:
@@ -111,8 +112,8 @@ def get_expired_symbols(name, age = 30):
     return expired
 
 
-def get_configuration(debug):
-    configuration = 'Windows Vista'
+def get_configuration(release, debug):
+    configuration = release
 
     if debug:
         configuration += ' Debug'
@@ -121,20 +122,10 @@ def get_configuration(debug):
 
     return configuration
 
-def get_configuration_name(debug):
-    configuration = 'WindowsVista'
-
-    if debug:
-        configuration += 'Debug'
-    else:
-        configuration += 'Release'
-
-    return configuration
-
-def get_target_path(arch, debug):
-    configuration = get_configuration_name(debug)
-
-    target = { 'x86': os.sep.join([configuration, 'Win32']), 'x64': os.sep.join([configuration, 'x64']) }
+def get_target_path(release, arch, debug):
+    configuration = get_configuration(release, debug)
+    name = ''.join(configuration.split(' '))
+    target = { 'x86': os.sep.join([name, 'Win32']), 'x64': os.sep.join([name, 'x64']) }
     target_path = os.sep.join(['proj', target[arch]])
 
     return target_path
@@ -158,27 +149,75 @@ class msbuild_failure(Exception):
     def __str__(self):
         return repr(self.value)
 
-def msbuild(name, arch, debug):
-    cwd = os.getcwd()
-    configuration = get_configuration(debug)
+def msbuild(platform, configuration, target, file, args, dir):
+    os.environ['PLATFORM'] = platform
+    os.environ['CONFIGURATION'] = configuration
+    os.environ['TARGET'] = target
+    os.environ['FILE'] = file
+    os.environ['EXTRA'] = args
 
-    if arch == 'x86':
-        os.environ['PLATFORM'] = 'Win32'
-    elif arch == 'x64':
-        os.environ['PLATFORM'] = 'x64'
+    cwd = os.getcwd()
+    bin = os.path.join(cwd, 'msbuild.bat')
 
-    os.environ['CONFIGURATION'] = configuration
-    os.environ['TARGET'] = 'Build'
-    os.environ['BUILD_ARGS'] = ''
-    os.environ['BUILD_FILE'] = name + '.sln'
+    print(bin)
+    print(dir)
 
-    os.chdir('proj')
-    status = shell('msbuild.bat')
+    os.chdir(dir)
+    status = shell(bin)
     os.chdir(cwd)
 
     if (status != None):
         raise msbuild_failure(configuration)
 
+def build_sln(name, release, arch, debug):
+    configuration = get_configuration(release, debug)
+
+    if arch == 'x86':
+        platform = 'Win32'
+    elif arch == 'x64':
+        platform = 'x64'
+
+    cwd = os.getcwd()
+
+    msbuild(platform, configuration, 'Build', name + '.sln', '', 'proj')
+
+def remove_timestamps(path):
+    try:
+        os.unlink(path + '.orig')
+    except OSError:
+        pass
+
+    os.rename(path, path + '.orig')
+
+    src = open(path + '.orig', 'r')
+    dst = open(path, 'w')
+
+    for line in src:
+        if line.find('TimeStamp') == -1:
+            dst.write(line)
+
+    dst.close()
+    src.close()
+
+def run_sdv(name, dir):
+    configuration = get_configuration('Windows 8', False)
+    platform = 'x64'
+
+    msbuild(platform, configuration, 'Build', name + '.vcxproj',
+            '', os.path.join('proj', name))
+    msbuild(platform, configuration, 'sdv', name + '.vcxproj',
+            '/p:Inputs="/clean"', os.path.join('proj', name))
+    msbuild(platform, configuration, 'sdv', name + '.vcxproj',
+            '/p:Inputs="/check:default.sdv"', os.path.join('proj', name))
+
+    path = ['proj', name, 'sdv', 'SDV.DVL.xml']
+    remove_timestamps(os.path.join(*path))
+
+    msbuild(platform, configuration, 'dvl', name + '.vcxproj',
+            '', os.path.join('proj', name))
+
+    path = ['proj', name, name + '.DVL.XML']
+    shutil.copy(os.path.join(*path), dir)
 
 def symstore_del(name, age):
     symstore_path = [os.environ['KIT'], 'Debuggers']
@@ -200,10 +239,9 @@ def symstore_del(name, age):
 
         shell(' '.join(command))
 
-def symstore_add(name, arch, debug):
+def symstore_add(name, release, arch, debug):
     cwd = os.getcwd()
-    configuration = get_configuration_name(debug)
-    target_path = get_target_path(arch, debug)
+    target_path = get_target_path(release, arch, debug)
 
     symstore_path = [os.environ['KIT'], 'Debuggers']
     if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
@@ -287,11 +325,16 @@ if __name__ == '__main__':
 
     symstore_del(driver, 30)
 
-    msbuild(driver, 'x86', debug[sys.argv[1]])
-    msbuild(driver, 'x64', debug[sys.argv[1]])
+    release = 'Windows Vista'
+
+    build_sln(driver, release, 'x86', debug[sys.argv[1]])
+    build_sln(driver, release, 'x64', debug[sys.argv[1]])
+
+    symstore_add(driver, release, 'x86', debug[sys.argv[1]])
+    symstore_add(driver, release, 'x64', debug[sys.argv[1]])
 
-    symstore_add(driver, 'x86', debug[sys.argv[1]])
-    symstore_add(driver, 'x64', debug[sys.argv[1]])
+    if len(sys.argv) <= 2 or sys.argv[2] != 'nosdv':
+        run_sdv(driver, driver)
 
     listfile = callfnout(['git','ls-tree', '-r', '--name-only', 'HEAD'])   
     archive(driver + '\\source.tgz', listfile.splitlines(), tgz=True)
diff --git a/msbuild.bat b/msbuild.bat
new file mode 100644 (file)
index 0000000..22f1f6d
--- /dev/null
@@ -0,0 +1,8 @@
+call "%VS%\VC\vcvarsall.bat" x86
+@echo on
+msbuild.exe /m:4 /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %EXTRA% %FILE%
+if errorlevel 1 goto error
+exit 0
+
+:error
+exit 1
diff --git a/proj/msbuild.bat b/proj/msbuild.bat
deleted file mode 100644 (file)
index 143feb1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-call "%VS%\VC\vcvarsall.bat" x86
-msbuild.exe /m:4 /p:Configuration="%CONFIGURATION%" /p:Platform="%PLATFORM%" /t:"%TARGET%" %BUILD_ARGS% %BUILD_FILE%
-if errorlevel 1 goto error
-exit 0
-
-:error
-exit 1
index 9aa2bda4def1357298a66507483e2f38ac41e098..fcaa8227dc76c66e5688f440598c4b55363be118 100644 (file)
@@ -32,7 +32,7 @@
        
        <ItemDefinitionGroup>
                <ClCompile>
-                       <PreprocessorDefinitions>__MODULE__="XENNET";NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+                       <PreprocessorDefinitions>NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
                        <WarningLevel>EnableAllWarnings</WarningLevel>
                        <DisableSpecificWarnings>4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
                        <MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/sdv.py b/sdv.py
deleted file mode 100644 (file)
index 069b126..0000000
--- a/sdv.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!python -u
-
-import os, sys
-import datetime
-import re
-import glob
-import tarfile
-import subprocess
-
-def shell(command):
-    print(command)
-    sys.stdout.flush()
-
-    pipe = os.popen(command, 'r', 1)
-
-    for line in pipe:
-        print(line.rstrip())
-
-    return pipe.close()
-
-class msbuild_failure(Exception):
-    def __init__(self, value):
-        self.value = value
-    def __str__(self):
-        return repr(self.value)
-
-def msbuild(name, target, sdv_arg):
-    cwd = os.getcwd()
-
-    os.environ['CONFIGURATION'] = 'Windows 8 Release'
-    os.environ['PLATFORM'] = 'x64'
-    os.environ['TARGET'] = target
-    os.environ['BUILD_FILE'] = name + '.vcxproj'
-    os.environ['BUILD_ARGS'] = sdv_arg
-
-    os.chdir('proj')
-    os.chdir(name)
-    status = shell('..\\msbuild.bat')
-    os.chdir(cwd)
-
-#    if (status != None):
-#        raise msbuild_failure(sdv_arg)
-
-def archive(filename, files, tgz=False):
-    access='w'
-    if tgz:
-        access='w:gz'
-    tar = tarfile.open(filename, access)
-    for name in files :
-        try:
-            print('adding '+name)
-            tar.add(name)
-        except:
-            pass
-    tar.close()
-
-if __name__ == '__main__':
-    msbuild('xennet', 'sdv', '/p:Inputs="/clean"')
-    msbuild('xennet', 'sdv', '/p:Inputs="/check:default.sdv"')
-    msbuild('xennet', 'dvl', '')
index cd0d2fffa23de98ae840080e92ac43bfc5ae11ca..85f9deeff12602ef1d3e5b984e6b583c4d42481a 100644 (file)
@@ -72,6 +72,8 @@ __Bug(
 #define BUG_ON(_EXP)                \
         if (_EXP) BUG(#_EXP)
 
+#undef  ASSERT
+
 #if DBG
 
 #define __NT_ASSERT(_EXP)                                       \
@@ -83,14 +85,6 @@ __Bug(
 
 #define __ASSERT(_EXP)  __NT_ASSERT(_EXP)
 
-#else   // DBG
-
-#define __ASSERT(_EXP)  BUG_ON(!(_EXP))
-
-#endif  // DBG
-
-#undef  ASSERT
-
 #define ASSERT(_EXP)                    \
         do {                            \
             __ASSERT(_EXP);             \
@@ -130,6 +124,15 @@ __Bug(
             }                                       \
         } while (FALSE)
 
+#else   // DBG
+
+#define ASSERT(_EXP)
+#define ASSERT3U(_X, _OP, _Y)
+#define ASSERT3S(_X, _OP, _Y)
+#define ASSERT3P(_X, _OP, _Y)
+
+#endif  // DBG
+
 #ifndef TEST_MEMORY
 #define TEST_MEMORY DBG
 #endif
index 9ec6d0984699c671bb9bf6efa55f2fc31e696c85..efdfd0db284cd62703beaceae4ecc1795e1f7f1e 100644 (file)
@@ -35,6 +35,8 @@
 #include <ntddk.h>
 #include <stdarg.h>
 
+#define __MODULE__  "XENNET"
+
 #pragma warning(disable:4127)   // conditional expression is constant
 
 static __inline VOID