From: Paul Durrant Date: Fri, 14 Mar 2014 16:45:55 +0000 (+0100) Subject: Add SDV to the standard build X-Git-Tag: 8.1.0-rc1~39^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e68feb0408aa6c71ffb5f2f1b51c26e15c46dc79;p=pvdrivers%2Fwin%2Fxennet.git Add SDV to the standard build Signed-off-by: Paul Durrant --- diff --git a/build.py b/build.py index 365a16a..b58ae86 100644 --- 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 index 0000000..22f1f6d --- /dev/null +++ b/msbuild.bat @@ -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 index 143feb1..0000000 --- a/proj/msbuild.bat +++ /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 diff --git a/proj/xennet/xennet.vcxproj b/proj/xennet/xennet.vcxproj index 9aa2bda..fcaa822 100644 --- a/proj/xennet/xennet.vcxproj +++ b/proj/xennet/xennet.vcxproj @@ -32,7 +32,7 @@ - __MODULE__="XENNET";NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions) + NDIS_MINIPORT_DRIVER;NDIS60_MINIPORT=1;POOL_NX_OPTIN=1;%(PreprocessorDefinitions) EnableAllWarnings 4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings) true diff --git a/sdv.py b/sdv.py deleted file mode 100644 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', '') diff --git a/src/xennet/assert.h b/src/xennet/assert.h index cd0d2ff..85f9dee 100644 --- a/src/xennet/assert.h +++ b/src/xennet/assert.h @@ -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 diff --git a/src/xennet/dbg_print.h b/src/xennet/dbg_print.h index 9ec6d09..efdfd0d 100644 --- a/src/xennet/dbg_print.h +++ b/src/xennet/dbg_print.h @@ -35,6 +35,8 @@ #include #include +#define __MODULE__ "XENNET" + #pragma warning(disable:4127) // conditional expression is constant static __inline VOID