diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2017-02-10 16:22:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-10 16:22:13 -0800 |
commit | 639d6a4bb303a7c5edfc31dc89c11159218692fe (patch) | |
tree | ffd878a5abeb510b766d52ae95c5b68939f70054 /tools/run_tests | |
parent | f7f25fc01ec75670e9d11c8852b296527837dd9d (diff) | |
parent | 756b13787801adaaf25bf11f9d0b114028fb8f76 (diff) |
Merge pull request #9665 from jtattermusch/cmake_csharp_extension
Use grpc_csharp_ext built by cmake
Diffstat (limited to 'tools/run_tests')
-rw-r--r-- | tools/run_tests/artifacts/artifact_targets.py | 16 | ||||
-rw-r--r-- | tools/run_tests/artifacts/build_artifact_csharp.bat | 10 | ||||
-rw-r--r-- | tools/run_tests/helper_scripts/pre_build_csharp.bat | 13 | ||||
-rwxr-xr-x | tools/run_tests/run_tests.py | 27 |
4 files changed, 35 insertions, 31 deletions
diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index 005d99790a..aba7b8a305 100644 --- a/tools/run_tests/artifacts/artifact_targets.py +++ b/tools/run_tests/artifacts/artifact_targets.py @@ -183,24 +183,14 @@ class CSharpExtArtifact: self.labels = ['artifact', 'csharp', platform, arch] def pre_build_jobspecs(self): - if self.platform == 'windows': - return [create_jobspec('prebuild_%s' % self.name, - ['tools\\run_tests\\helper_scripts\\pre_build_c.bat'], - shell=True, - flake_retries=5, - timeout_retries=2)] - else: - return [] + return [] def build_jobspec(self): if self.platform == 'windows': - msbuild_platform = 'Win32' if self.arch == 'x86' else self.arch + cmake_arch_option = 'Win32' if self.arch == 'x86' else self.arch return create_jobspec(self.name, ['tools\\run_tests\\artifacts\\build_artifact_csharp.bat', - 'vsprojects\\grpc_csharp_ext.sln', - '/p:Configuration=Release', - '/p:PlatformToolset=v120', - '/p:Platform=%s' % msbuild_platform], + cmake_arch_option], shell=True) else: environ = {'CONFIG': 'opt', diff --git a/tools/run_tests/artifacts/build_artifact_csharp.bat b/tools/run_tests/artifacts/build_artifact_csharp.bat index 24c8d485f9..f84ebc5a35 100644 --- a/tools/run_tests/artifacts/build_artifact_csharp.bat +++ b/tools/run_tests/artifacts/build_artifact_csharp.bat @@ -29,10 +29,16 @@ @rem Builds C# artifacts on Windows -@call vsprojects\build_vs2013.bat %* || goto :error +set ARCHITECTURE=%1 + +@call tools\run_tests\helper_scripts\pre_build_csharp.bat %ARCHITECTURE% || goto :error + +cd cmake\build\%ARCHITECTURE% +cmake --build . --target grpc_csharp_ext --config Release +cd ..\..\.. mkdir artifacts -copy /Y vsprojects\Release\grpc_csharp_ext.dll artifacts || copy /Y vsprojects\x64\Release\grpc_csharp_ext.dll artifacts || goto :error +copy /Y cmake\build\Win32\Release\grpc_csharp_ext.dll artifacts || copy /Y cmake\build\x64\Release\grpc_csharp_ext.dll artifacts || goto :error goto :EOF diff --git a/tools/run_tests/helper_scripts/pre_build_csharp.bat b/tools/run_tests/helper_scripts/pre_build_csharp.bat index 139955d4da..f37f63b584 100644 --- a/tools/run_tests/helper_scripts/pre_build_csharp.bat +++ b/tools/run_tests/helper_scripts/pre_build_csharp.bat @@ -31,9 +31,21 @@ setlocal +set ARCHITECTURE=%1 + @rem enter repo root cd /d %~dp0\..\..\.. +mkdir cmake +cd cmake +mkdir build +cd build +mkdir %ARCHITECTURE% +cd %ARCHITECTURE% +@rem TODO(jtattermusch): Stop hardcoding path to yasm once Jenkins workers can locate yasm correctly +cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=OFF -DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe" ../../.. || goto :error +cd ..\..\.. + @rem Location of nuget.exe set NUGET=C:\nuget\nuget.exe @@ -42,7 +54,6 @@ if exist %NUGET% ( @rem Restore Grpc packages by packages since Nuget client 3.4.4 doesnt support restore @rem by solution @rem Moving into each directory to let the restores work based on per-project packages.config files - %NUGET% restore vsprojects/grpc_csharp_ext.sln || goto :error cd src/csharp diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 75571aaadb..8b76193cbe 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -722,12 +722,10 @@ class CSharpLanguage(object): self.config = config self.args = args if self.platform == 'windows': - # Explicitly choosing between x86 and x64 arch doesn't work yet + _check_compiler(self.args.compiler, ['coreclr', 'default']) _check_arch(self.args.arch, ['default']) - # CoreCLR use 64bit runtime by default. - arch_option = 'x64' if self.args.compiler == 'coreclr' else self.args.arch - self._make_options = [_windows_toolset_option(self.args.compiler), - _windows_arch_option(arch_option)] + self._cmake_arch_option = 'x64' if self.args.compiler == 'coreclr' else 'Win32' + self._make_options = [] else: _check_compiler(self.args.compiler, ['default', 'coreclr']) if self.platform == 'linux' and self.args.compiler == 'coreclr': @@ -799,7 +797,7 @@ class CSharpLanguage(object): def pre_build_steps(self): if self.platform == 'windows': - return [['tools\\run_tests\\helper_scripts\\pre_build_csharp.bat']] + return [['tools\\run_tests\\helper_scripts\\pre_build_csharp.bat', self._cmake_arch_option]] else: return [['tools/run_tests/helper_scripts/pre_build_csharp.sh']] @@ -817,7 +815,7 @@ class CSharpLanguage(object): return [['tools/run_tests/helper_scripts/build_csharp_coreclr.sh']] else: if self.platform == 'windows': - return [[_windows_build_bat(self.args.compiler), + return [['vsprojects\\build_vs2015.bat', 'src/csharp/Grpc.sln', '/p:Configuration=%s' % _MSBUILD_CONFIG[self.config.build_config]]] else: @@ -830,7 +828,10 @@ class CSharpLanguage(object): return [['tools/run_tests/helper_scripts/post_tests_csharp.sh']] def makefile_name(self): - return 'Makefile' + if self.platform == 'windows': + return 'cmake/build/%s/Makefile' % self._cmake_arch_option + else: + return 'Makefile' def dockerfile_dir(self): return 'tools/dockerfile/test/csharp_%s_%s' % (self._docker_distro, @@ -1038,12 +1039,10 @@ def _check_arch_option(arch): def _windows_build_bat(compiler): """Returns name of build.bat for selected compiler.""" # For CoreCLR, fall back to the default compiler for C core - if compiler == 'default' or compiler == 'vs2013' or compiler == 'coreclr': + if compiler == 'default' or compiler == 'vs2013': return 'vsprojects\\build_vs2013.bat' elif compiler == 'vs2015': return 'vsprojects\\build_vs2015.bat' - elif compiler == 'vs2010': - return 'vsprojects\\build_vs2010.bat' else: print('Compiler %s not supported.' % compiler) sys.exit(1) @@ -1056,8 +1055,6 @@ def _windows_toolset_option(compiler): return '/p:PlatformToolset=v120' elif compiler == 'vs2015': return '/p:PlatformToolset=v140' - elif compiler == 'vs2010': - return '/p:PlatformToolset=v100' else: print('Compiler %s not supported.' % compiler) sys.exit(1) @@ -1147,7 +1144,7 @@ argp.add_argument('--compiler', choices=['default', 'gcc4.4', 'gcc4.6', 'gcc4.8', 'gcc4.9', 'gcc5.3', 'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', - 'vs2010', 'vs2013', 'vs2015', + 'vs2013', 'vs2015', 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', 'node0.12', 'node4', 'node5', 'node6', 'node7', 'electron1.3', @@ -1292,7 +1289,7 @@ def make_jobspec(cfg, targets, makefile='Makefile'): return [jobset.JobSpec(['cmake', '--build', '.', '--target', '%s' % target, '--config', _MSBUILD_CONFIG[cfg]], - cwd='cmake/build', + cwd=os.path.dirname(makefile), timeout_seconds=None) for target in targets] extra_args = [] # better do parallel compilation |