Merge pull request #18467 from jtattermusch/csharp_tools_distribtest2

Test Grpc.Tools as part of C# distribtests
pull/18579/head
Jan Tattermusch 6 years ago committed by GitHub
commit c1001e7909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/csharp/Grpc.Tools/Common.cs
  2. 10
      test/distrib/csharp/DistribTest/DistribTest.csproj
  3. 5
      test/distrib/csharp/DistribTest/DistribTestDotNet.csproj
  4. 3
      test/distrib/csharp/DistribTest/Program.cs
  5. 1
      test/distrib/csharp/DistribTest/packages.config
  6. 29
      test/distrib/csharp/DistribTest/testcodegen.proto
  7. 2
      test/distrib/csharp/run_distrib_test.sh
  8. 1
      tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile

@ -60,7 +60,7 @@ namespace Grpc.Tools
: RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? OsKind.MacOsX
: OsKind.Unknown;
switch (RuntimeInformation.OSArchitecture)
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.X86: Cpu = CpuKind.X86; break;
case Architecture.X64: Cpu = CpuKind.X64; break;
@ -86,7 +86,7 @@ namespace Grpc.Tools
}
// Hope we are not building on ARM under Xamarin!
Cpu = Environment.Is64BitOperatingSystem ? CpuKind.X64 : CpuKind.X86;
Cpu = Environment.Is64BitProcess ? CpuKind.X64 : CpuKind.X86;
#endif
}
};

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -93,21 +94,30 @@
<Reference Include="Google.Apis.Auth.PlatformServices">
<HintPath>..\packages\Google.Apis.Auth.1.15.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.7.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.7.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="**\*.proto" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Grpc.Core.__GRPC_NUGET_VERSION__\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.__GRPC_NUGET_VERSION__\build\net45\Grpc.Core.targets')" />
<Import Project="..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Core.__GRPC_NUGET_VERSION__\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.__GRPC_NUGET_VERSION__\build\net45\Grpc.Core.targets'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.props'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.__GRPC_NUGET_VERSION__\build\Grpc.Tools.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -16,8 +16,13 @@
<PackageReference Include="Grpc" Version="__GRPC_NUGET_VERSION__" />
<PackageReference Include="Grpc.Auth" Version="__GRPC_NUGET_VERSION__" />
<PackageReference Include="Grpc.Tools" Version="__GRPC_NUGET_VERSION__" />
<PackageReference Include="Google.Protobuf" Version="3.7.0" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="**\*.proto" />
</ItemGroup>
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<!-- Workaround for https://github.com/dotnet/sdk/issues/335 -->
<FrameworkPathOverride Condition="Exists('/usr/lib/mono/4.5-api')">/usr/lib/mono/4.5-api</FrameworkPathOverride>

@ -25,6 +25,9 @@ namespace TestGrpcPackage
{
public static void Main(string[] args)
{
// test codegen works
var reply = new Testcodegen.HelloReply();
// This code doesn't do much but makes sure the native extension is loaded
// which is what we are testing here.
Channel c = new Channel("127.0.0.1:1000", ChannelCredentials.Insecure);

@ -8,6 +8,7 @@
<package id="Grpc.Core" version="__GRPC_NUGET_VERSION__" targetFramework="net45" />
<package id="Grpc.Core.Api" version="__GRPC_NUGET_VERSION__" targetFramework="net45" />
<package id="Grpc.Tools" version="__GRPC_NUGET_VERSION__" targetFramework="net45" />
<package id="Google.Protobuf" version="3.7.0" targetFramework="net45" />
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
</packages>

@ -0,0 +1,29 @@
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package testcodegen;
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}

@ -24,7 +24,7 @@ unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip
# Retry "nuget restore" to work around https://github.com/grpc/grpc/issues/16312
nuget restore || nuget restore || nuget restore
xbuild DistribTest.sln
msbuild DistribTest.sln
mono DistribTest/bin/Debug/DistribTest.exe

@ -18,6 +18,7 @@ RUN rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0
RUN curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo
RUN yum install -y mono-devel
RUN yum install -y msbuild
RUN yum install -y nuget

Loading…
Cancel
Save