]> xenbits.xensource.com Git - people/pauldu/xennet.git/commitdiff
Build/SDV refinements
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 15 Apr 2014 13:44:50 +0000 (14:44 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 15 Apr 2014 13:44:50 +0000 (14:44 +0100)
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
build.py
proj/xennet/xennet.vcxproj
src/xennet/assert.h
src/xennet/dbg_print.h

index b58ae8633c51ed60ac542a3a6276d2fef3226633..2d5b1b1b4174142ea6ef99bb1b1c65e55371fbaf 100644 (file)
--- a/build.py
+++ b/build.py
@@ -7,6 +7,7 @@ import glob
 import tarfile
 import subprocess
 import shutil
+import time
 
 def next_build_number():
     try:
@@ -122,6 +123,7 @@ def get_configuration(release, debug):
 
     return configuration
 
+
 def get_target_path(release, arch, debug):
     configuration = get_configuration(release, debug)
     name = ''.join(configuration.split(' '))
@@ -131,16 +133,22 @@ def get_target_path(release, arch, debug):
     return target_path
 
 
-def shell(command):
+def shell(command, dir):
+    print(dir)
     print(command)
     sys.stdout.flush()
+    
+    sub = subprocess.Popen(' '.join(command), cwd=dir,
+                           stdout=subprocess.PIPE,
+                           stderr=subprocess.STDOUT, 
+                           universal_newlines=True)
 
-    pipe = os.popen(command, 'r', 1)
-
-    for line in pipe:
+    for line in sub.stdout:
         print(line.rstrip())
 
-    return pipe.close()
+    sub.wait()
+
+    return sub.returncode
 
 
 class msbuild_failure(Exception):
@@ -156,19 +164,14 @@ def msbuild(platform, configuration, target, file, args, dir):
     os.environ['FILE'] = file
     os.environ['EXTRA'] = args
 
-    cwd = os.getcwd()
-    bin = os.path.join(cwd, 'msbuild.bat')
-
-    print(bin)
-    print(dir)
+    bin = os.path.join(os.getcwd(), 'msbuild.bat')
 
-    os.chdir(dir)
-    status = shell(bin)
-    os.chdir(cwd)
+    status = shell([bin], dir)
 
-    if (status != None):
+    if (status != 0):
         raise msbuild_failure(configuration)
 
+
 def build_sln(name, release, arch, debug):
     configuration = get_configuration(release, debug)
 
@@ -181,6 +184,7 @@ def build_sln(name, release, arch, debug):
 
     msbuild(platform, configuration, 'Build', name + '.sln', '', 'proj')
 
+
 def remove_timestamps(path):
     try:
         os.unlink(path + '.orig')
@@ -199,14 +203,35 @@ def remove_timestamps(path):
     dst.close()
     src.close()
 
+def sdv_clean(name):
+    path = ['proj', name, 'sdv']
+    print(path)
+
+    shutil.rmtree(os.path.join(*path), True)
+
+    path = ['proj', name, 'sdv.temp']
+    print(path)
+
+    shutil.rmtree(os.path.join(*path), True)
+
+    path = ['proj', name, 'staticdv.job']
+    print(path)
+
+    try:
+        os.unlink(os.path.join(*path))
+    except OSError:
+        pass
+
+
 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))
+
+    sdv_clean(name)
+
     msbuild(platform, configuration, 'sdv', name + '.vcxproj',
             '/p:Inputs="/check:default.sdv"', os.path.join('proj', name))
 
@@ -219,6 +244,7 @@ def run_sdv(name, dir):
     path = ['proj', name, name + '.DVL.XML']
     shutil.copy(os.path.join(*path), dir)
 
+
 def symstore_del(name, age):
     symstore_path = [os.environ['KIT'], 'Debuggers']
     if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
@@ -237,10 +263,10 @@ def symstore_del(name, age):
         command.append('/s')
         command.append(os.environ['SYMBOL_SERVER'])
 
-        shell(' '.join(command))
+        shell(command, None)
+
 
 def symstore_add(name, release, arch, debug):
-    cwd = os.getcwd()
     target_path = get_target_path(release, arch, debug)
 
     symstore_path = [os.environ['KIT'], 'Debuggers']
@@ -257,7 +283,6 @@ def symstore_add(name, release, arch, debug):
                         os.environ['MICRO_VERSION'],
                         os.environ['BUILD_NUMBER']])
 
-    os.chdir(target_path)
     command=['"' + symstore + '"']
     command.append('add')
     command.append('/s')
@@ -270,13 +295,11 @@ def symstore_add(name, release, arch, debug):
     command.append('/v')
     command.append(version)
 
-    shell(' '.join(command))
-
-    os.chdir(cwd)
+    shell(command, target_path)
 
 
-def callfnout(cmd):
-    print(cmd)
+def manifest():
+    cmd = ['git', 'ls-tree', '-r', '--name-only', 'HEAD']
 
     sub = subprocess.Popen(cmd, stdout=subprocess.PIPE)
     output = sub.communicate()[0]
@@ -303,6 +326,7 @@ def archive(filename, files, tgz=False):
 
 if __name__ == '__main__':
     debug = { 'checked': True, 'free': False }
+    sdv = { 'nosdv': False, None: True }
     driver = 'xennet'
 
     os.environ['MAJOR_VERSION'] = '7'
@@ -333,10 +357,9 @@ if __name__ == '__main__':
     symstore_add(driver, release, 'x86', debug[sys.argv[1]])
     symstore_add(driver, release, 'x64', debug[sys.argv[1]])
 
-    if len(sys.argv) <= 2 or sys.argv[2] != 'nosdv':
-        run_sdv(driver, driver)
+    if len(sys.argv) <= 2 or sdv[sys.argv[2]]:
+        run_sdv('xennet', driver)
 
-    listfile = callfnout(['git','ls-tree', '-r', '--name-only', 'HEAD'])   
-    archive(driver + '\\source.tgz', listfile.splitlines(), tgz=True)
+    archive(driver + '\\source.tgz', manifest().splitlines(), tgz=True)
     archive(driver + '.tar', [driver,'revision'])
 
index fcaa8227dc76c66e5688f440598c4b55363be118..9aa2bda4def1357298a66507483e2f38ac41e098 100644 (file)
@@ -32,7 +32,7 @@
        
        <ItemDefinitionGroup>
                <ClCompile>
-                       <PreprocessorDefinitions>NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+                       <PreprocessorDefinitions>__MODULE__="XENNET";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>
index 85f9deeff12602ef1d3e5b984e6b583c4d42481a..66d3734e54eaa425689e07e6fbf31e8720131748 100644 (file)
@@ -29,8 +29,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef _XENVIF_ASSERT_H
-#define _XENVIF_ASSERT_H
+#ifndef _XENNET_ASSERT_H
+#define _XENNET_ASSERT_H
 
 #include <ntddk.h>
 
@@ -126,10 +126,21 @@ __Bug(
 
 #else   // DBG
 
-#define ASSERT(_EXP)
-#define ASSERT3U(_X, _OP, _Y)
-#define ASSERT3S(_X, _OP, _Y)
-#define ASSERT3P(_X, _OP, _Y)
+#pragma warning(disable:4100)
+
+#define ASSERT(_EXP)                    \
+        do {                            \
+            __analysis_assume(_EXP);    \
+        } while (FALSE)
+
+#define ASSERT3U(_X, _OP, _Y)           \
+        ASSERT(_X _OP _Y)
+
+#define ASSERT3S(_X, _OP, _Y)           \
+        ASSERT(_X _OP _Y)
+
+#define ASSERT3P(_X, _OP, _Y)           \
+        ASSERT(_X _OP _Y)
 
 #endif  // DBG
 
@@ -173,4 +184,4 @@ _IsZeroMemory(
 #define IMPLY(_X, _Y)   (!(_X) || (_Y))
 #define EQUIV(_X, _Y)   (IMPLY((_X), (_Y)) && IMPLY((_Y), (_X)))
 
-#endif  // _XENVIF_ASSERT_H
+#endif  // _XENNET_ASSERT_H
index efdfd0db284cd62703beaceae4ecc1795e1f7f1e..17f7217311d58b5eb2c05c7cc85161824944ca13 100644 (file)
@@ -35,7 +35,9 @@
 #include <ntddk.h>
 #include <stdarg.h>
 
-#define __MODULE__  "XENNET"
+#ifdef  _SDV_
+#define __MODULE__ ""
+#endif
 
 #pragma warning(disable:4127)   // conditional expression is constant