diff options
Diffstat (limited to 'csharp/compatibility_tests')
7 files changed, 84 insertions, 68 deletions
diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs index c0a9ffd1..ff44895c 100644 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs @@ -403,7 +403,7 @@ namespace Google.Protobuf output.Flush();
ms.Position = 0;
- CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0);
+ CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0, false);
uint tag = input.ReadTag();
Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag));
diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs index 48bf6d60..01bd3218 100644 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs @@ -334,7 +334,7 @@ namespace Google.Protobuf }
// Now test Input stream:
{
- CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0);
+ CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false);
Assert.AreEqual(0, cin.Position);
// Field 1:
uint tag = cin.ReadTag();
diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj new file mode 100644 index 00000000..06d07b9f --- /dev/null +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -0,0 +1,30 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks> + <AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile> + <SignAssembly>true</SignAssembly> + <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> + <IsPackable>False</IsPackable> + </PropertyGroup> + + <ItemGroup> + <ProjectReference Include="..\Google.Protobuf\Google.Protobuf.csproj" /> + </ItemGroup> + + <ItemGroup> + <PackageReference Include="NUnit" Version="3.6.1" /> + <PackageReference Include="NUnitLite" Version="3.6.1" /> + </ItemGroup> + + <!-- + - Override target frameworks on non-Windows to just .NET Core + - Doing this conditionally in the initial PropertyGroup confuses + - Visual Studio. + --> + <PropertyGroup Condition="'$(OS)' != 'Windows_NT'"> + <TargetFrameworks>netcoreapp1.0</TargetFrameworks> + </PropertyGroup> + +</Project> diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj deleted file mode 100644 index a9a1cc04..00000000 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.xproj +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> - <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> - </PropertyGroup> - <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> - <PropertyGroup Label="Globals"> - <ProjectGuid>580eb013-d3c7-4578-b845-015f4a3b0591</ProjectGuid> - <RootNamespace>Google.Protobuf.Test</RootNamespace> - <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> - <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> - </PropertyGroup> - - <PropertyGroup> - <SchemaVersion>2.0</SchemaVersion> - </PropertyGroup> - <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> -</Project>
\ No newline at end of file diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs new file mode 100644 index 00000000..9078e59b --- /dev/null +++ b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs @@ -0,0 +1,47 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnitLite; +using System.Reflection; + +// Note: this file wasn't in the actual 3.0, but is required due to build +// system changes + +namespace Google.Protobuf.Test +{ + class Program + { + public static int Main(string[] args) + { + return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args); + } + } +}
\ No newline at end of file diff --git a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json b/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json deleted file mode 100644 index 87b732c9..00000000 --- a/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/project.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "buildOptions": { - "debugType": "portable", - "keyFile": "../../keys/Google.Protobuf.snk" - }, - - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "DEBUG", "TRACE" ] - } - }, - "Release": { - "buildOptions": { - "define": [ "RELEASE", "TRACE" ], - "optimize": true - } - } - }, - - "dependencies": { - "Google.Protobuf": { "target": "project" }, - "NUnit": "3.4.0", - "dotnet-test-nunit": "3.4.0-alpha-2", - }, - - "testRunner": "nunit", - - "frameworks": { - "netcoreapp1.0": { - "imports" : [ "dnxcore50", "netcoreapp1.0", "portable-net45+win8" ], - "buildOptions": { - "define": [ "PCL" ] - }, - "dependencies": { - "Microsoft.NETCore.App": { - "version": "1.0.0", - "type": "platform" - }, - "System.Console": "4.0.0" - } - } - } -}
\ No newline at end of file diff --git a/csharp/compatibility_tests/v3.0.0/test.sh b/csharp/compatibility_tests/v3.0.0/test.sh index bb04fc2c..54d28dfc 100755 --- a/csharp/compatibility_tests/v3.0.0/test.sh +++ b/csharp/compatibility_tests/v3.0.0/test.sh @@ -18,8 +18,11 @@ function run_test() { protos/src/google/protobuf/map_unittest_proto3.proto # Build and test. - dotnet build -c release src/Google.Protobuf src/Google.Protobuf.Test - dotnet test -c release -f netcoreapp1.0 src/Google.Protobuf.Test + dotnet restore src/Google.Protobuf/Google.Protobuf.csproj + dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj + dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet run -c Release -f netcoreapp1.0 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj } set -ex @@ -72,7 +75,6 @@ chmod +x old_protoc # Copy the new runtime and keys. cp ../../src/Google.Protobuf src/Google.Protobuf -r cp ../../keys . -r -dotnet restore # Test A.1: # proto set 1: use old version |