summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/Makefile.am1
-rw-r--r--test/dart/test_client/pubspec.yaml2
-rw-r--r--test/erl/src/thrift_test.app.src2
-rw-r--r--test/netstd/Client/Client.csproj8
-rw-r--r--test/netstd/Client/Performance/TestDataFactory.cs24
-rw-r--r--test/netstd/Client/TestClient.cs36
-rw-r--r--test/netstd/Server/Server.csproj8
-rw-r--r--test/netstd/Server/TestServer.cs153
8 files changed, 133 insertions, 101 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index b289e5308..2199f1e11 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -167,6 +167,7 @@ EXTRA_DIST = \
UnsafeTypes.thrift \
Service.thrift \
SpecificNameTest.thrift \
+ partial/thrift_test_schema.thrift \
known_failures_Linux.json \
test.py \
tests.json \
diff --git a/test/dart/test_client/pubspec.yaml b/test/dart/test_client/pubspec.yaml
index d5848b4c2..289816941 100644
--- a/test/dart/test_client/pubspec.yaml
+++ b/test/dart/test_client/pubspec.yaml
@@ -16,7 +16,7 @@
# under the License.
name: thrift_test_client
-version: 0.16.0
+version: 0.17.0
description: A client integration test for the Dart Thrift library
author: Apache Thrift Developers <dev@thrift.apache.org>
homepage: http://thrift.apache.org
diff --git a/test/erl/src/thrift_test.app.src b/test/erl/src/thrift_test.app.src
index 6faa1b5ab..60f7f1414 100644
--- a/test/erl/src/thrift_test.app.src
+++ b/test/erl/src/thrift_test.app.src
@@ -22,7 +22,7 @@
{description, "Thrift cross language test"},
% The version of the applicaton
- {vsn, "0.16.0"},
+ {vsn, "0.17.0"},
% All modules used by the application.
{modules, [
diff --git a/test/netstd/Client/Client.csproj b/test/netstd/Client/Client.csproj
index 859297f97..9d4ab48c9 100644
--- a/test/netstd/Client/Client.csproj
+++ b/test/netstd/Client/Client.csproj
@@ -24,7 +24,7 @@
<AssemblyName>Client</AssemblyName>
<PackageId>Client</PackageId>
<OutputType>Exe</OutputType>
- <Version>0.16.0.0</Version>
+ <Version>0.17.0.0</Version>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
@@ -49,8 +49,8 @@
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
</Exec>
- <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netstd:wcf,union,serial -r ./../../ThriftTest.thrift" />
- <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netstd:wcf,union,serial -r ./../../ThriftTest.thrift" />
- <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netstd:wcf,union,serial -r ./../../ThriftTest.thrift" />
+ <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
+ <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
+ <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
</Target>
</Project>
diff --git a/test/netstd/Client/Performance/TestDataFactory.cs b/test/netstd/Client/Performance/TestDataFactory.cs
index 833947c25..8dec3f303 100644
--- a/test/netstd/Client/Performance/TestDataFactory.cs
+++ b/test/netstd/Client/Performance/TestDataFactory.cs
@@ -40,9 +40,9 @@ namespace Client.Tests
};
}
- private static THashSet<Insanity> CreateSetField(int count)
+ private static HashSet<Insanity> CreateSetField(int count)
{
- var retval = new THashSet<Insanity>();
+ var retval = new HashSet<Insanity>();
for (var i = 0; i < count; ++i)
retval.Add(CreateInsanity(count));
return retval;
@@ -90,41 +90,41 @@ namespace Client.Tests
return retval;
}
- private static List<Dictionary<THashSet<int>, Dictionary<int, THashSet<List<Dictionary<Insanity, string>>>>>> CreateListField(int count)
+ private static List<Dictionary<HashSet<int>, Dictionary<int, HashSet<List<Dictionary<Insanity, string>>>>>> CreateListField(int count)
{
- var retval = new List<Dictionary<THashSet<int>, Dictionary<int, THashSet<List<Dictionary<Insanity, string>>>>>>();
+ var retval = new List<Dictionary<HashSet<int>, Dictionary<int, HashSet<List<Dictionary<Insanity, string>>>>>>();
for (var i = 0; i < count; ++i)
retval.Add(CreateListFieldData(count));
return retval;
}
- private static Dictionary<THashSet<int>, Dictionary<int, THashSet<List<Dictionary<Insanity, string>>>>> CreateListFieldData(int count)
+ private static Dictionary<HashSet<int>, Dictionary<int, HashSet<List<Dictionary<Insanity, string>>>>> CreateListFieldData(int count)
{
- var retval = new Dictionary<THashSet<int>, Dictionary<int, THashSet<List<Dictionary<Insanity, string>>>>>();
+ var retval = new Dictionary<HashSet<int>, Dictionary<int, HashSet<List<Dictionary<Insanity, string>>>>>();
for (var i = 0; i < count; ++i)
retval.Add( CreateIntHashSet(count), CreateListFieldDataDict(count));
return retval;
}
- private static THashSet<int> CreateIntHashSet(int count)
+ private static HashSet<int> CreateIntHashSet(int count)
{
- var retval = new THashSet<int>();
+ var retval = new HashSet<int>();
for (var i = 0; i < count; ++i)
retval.Add(i);
return retval;
}
- private static Dictionary<int, THashSet<List<Dictionary<Insanity, string>>>> CreateListFieldDataDict(int count)
+ private static Dictionary<int, HashSet<List<Dictionary<Insanity, string>>>> CreateListFieldDataDict(int count)
{
- var retval = new Dictionary<int, THashSet<List<Dictionary<Insanity, string>>>>();
+ var retval = new Dictionary<int, HashSet<List<Dictionary<Insanity, string>>>>();
for (var i = 0; i < count; ++i)
retval.Add(i, CreateListFieldDataDictValue(count));
return retval;
}
- private static THashSet<List<Dictionary<Insanity, string>>> CreateListFieldDataDictValue(int count)
+ private static HashSet<List<Dictionary<Insanity, string>>> CreateListFieldDataDictValue(int count)
{
- var retval = new THashSet<List<Dictionary<Insanity, string>>>();
+ var retval = new HashSet<List<Dictionary<Insanity, string>>>();
for (var i = 0; i < count; ++i)
retval.Add( CreateListFieldDataDictValueList(count));
return retval;
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index 0a7fa003b..29c0d2ef3 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -411,15 +411,28 @@ namespace ThriftTest
return ErrorUnknown;
}
- var tests = Enumerable.Range(0, param.numThreads).Select(_ => new ClientTest(param)).ToArray();
-
//issue tests on separate threads simultaneously
+ var nThreads = Math.Max(param.numThreads, 1);
+ Console.Write("Starting {0} test thread(s) ", nThreads);
+ var tasks = new Task[nThreads];
var start = DateTime.Now;
- var tasks = tests.Select(test => test.Execute()).ToArray();
+ var retcode = 0;
+ for (var i = 0; i < tasks.Length; ++i)
+ {
+ Console.Write('.');
+ tasks[i] = Task.Run(async () =>
+ {
+ var test = new ClientTest(param);
+ await test.Execute();
+ lock (tasks)
+ retcode |= test.ReturnCode;
+ });
+ }
+ Console.WriteLine(" OK");
Task.WaitAll(tasks);
Console.WriteLine("Total time: " + (DateTime.Now - start));
Console.WriteLine();
- return tests.Select(t => t.ReturnCode).Aggregate((r1, r2) => r1 | r2);
+ return retcode;
}
catch (Exception outerEx)
{
@@ -490,7 +503,7 @@ namespace ThriftTest
return retval;
}
- private static CancellationToken MakeTimeoutToken(int msec = 5000)
+ private static CancellationToken MakeTimeoutToken(int msec = 15_000)
{
var token = new CancellationTokenSource(msec);
return token.Token;
@@ -644,9 +657,14 @@ namespace ThriftTest
Struct_thing = o,
I32_thing = 5
};
- var i2 = await client.testNest(o2, MakeTimeoutToken());
+ Xtruct2 i2 = await client.testNest(o2, MakeTimeoutToken());
i = i2.Struct_thing;
- Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
+ Console.WriteLine(" = {" + i2.Byte_thing + ", {\""
+ + (i?.String_thing ?? "<null>") + "\", "
+ + (i?.Byte_thing ?? 0) + ", "
+ + (i?.I32_thing ?? 0) + ", "
+ + (i?.I64_thing ?? 0) + "}, "
+ + i2.I32_thing + "}");
var mapout = new Dictionary<int, int>();
for (var j = 0; j < 5; j++)
@@ -681,7 +699,7 @@ namespace ThriftTest
//set
// TODO: Validate received message
- var setout = new THashSet<int>();
+ var setout = new HashSet<int>();
for (var j = -2; j < 3; j++)
{
setout.Add(j);
@@ -937,7 +955,7 @@ namespace ThriftTest
}
catch (Xception2 ex)
{
- if (ex.ErrorCode != 2002 || ex.Struct_thing.String_thing != "This is an Xception2")
+ if (ex.ErrorCode != 2002 || ex.Struct_thing?.String_thing != "This is an Xception2")
{
Console.WriteLine("*** FAILED ***");
returnCode |= ErrorExceptions;
diff --git a/test/netstd/Server/Server.csproj b/test/netstd/Server/Server.csproj
index cda1dff9f..439e5c1e6 100644
--- a/test/netstd/Server/Server.csproj
+++ b/test/netstd/Server/Server.csproj
@@ -24,7 +24,7 @@
<AssemblyName>Server</AssemblyName>
<PackageId>Server</PackageId>
<OutputType>Exe</OutputType>
- <Version>0.16.0.0</Version>
+ <Version>0.17.0.0</Version>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
@@ -51,8 +51,8 @@
<Exec Condition="'$(OS)' == 'Windows_NT'" Command="where thrift" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="PathToThrift" />
</Exec>
- <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netstd:wcf,union,serial -r ./../../ThriftTest.thrift" />
- <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netstd:wcf,union,serial -r ./../../ThriftTest.thrift" />
- <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netstd:wcf,union,serial -r ./../../ThriftTest.thrift" />
+ <Exec Condition="Exists('$(PathToThrift)')" Command="&quot;$(PathToThrift)&quot; -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
+ <Exec Condition="Exists('thrift')" Command="thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
+ <Exec Condition="Exists('$(ProjectDir)/../../../compiler/cpp/thrift')" Command="$(ProjectDir)/../../../compiler/cpp/thrift -out $(ProjectDir) -gen netstd:wcf,union,serial,net6 -r ./../../ThriftTest.thrift" />
</Target>
</Project>
diff --git a/test/netstd/Server/TestServer.cs b/test/netstd/Server/TestServer.cs
index 515a299f8..86072b0a7 100644
--- a/test/netstd/Server/TestServer.cs
+++ b/test/netstd/Server/TestServer.cs
@@ -229,10 +229,10 @@ namespace ThriftTest
return Task.CompletedTask;
}
- public Task<string> testString(string thing, CancellationToken cancellationToken)
+ public Task<string> testString(string? thing, CancellationToken cancellationToken)
{
- logger.Invoke("testString({0})", thing);
- return Task.FromResult(thing);
+ logger.Invoke("testString({0})", thing ?? "<null>");
+ return Task.FromResult(thing ?? string.Empty);
}
public Task<bool> testBool(bool thing, CancellationToken cancellationToken)
@@ -265,117 +265,129 @@ namespace ThriftTest
return Task.FromResult(thing);
}
- public Task<byte[]> testBinary(byte[] thing, CancellationToken cancellationToken)
+ public Task<byte[]> testBinary(byte[]? thing, CancellationToken cancellationToken)
{
- logger.Invoke("testBinary({0} bytes)", thing.Length);
- return Task.FromResult(thing);
+ logger.Invoke("testBinary({0} bytes)", thing?.Length ?? 0);
+ return Task.FromResult(thing ?? Array.Empty<byte>());
}
- public Task<Xtruct> testStruct(Xtruct thing, CancellationToken cancellationToken)
+ public Task<Xtruct> testStruct(Xtruct? thing, CancellationToken cancellationToken)
{
- logger.Invoke("testStruct({{\"{0}\", {1}, {2}, {3}}})", thing.String_thing, thing.Byte_thing, thing.I32_thing, thing.I64_thing);
- return Task.FromResult(thing);
+ logger.Invoke("testStruct({{\"{0}\", {1}, {2}, {3}}})", thing?.String_thing ?? "<null>", thing?.Byte_thing ?? 0, thing?.I32_thing ?? 0, thing?.I64_thing ?? 0);
+ return Task.FromResult(thing ?? new Xtruct()); // null returns are not allowed in Thrift
}
- public Task<Xtruct2> testNest(Xtruct2 nest, CancellationToken cancellationToken)
+ public Task<Xtruct2> testNest(Xtruct2? nest, CancellationToken cancellationToken)
{
- var thing = nest.Struct_thing;
+ var thing = nest?.Struct_thing;
logger.Invoke("testNest({{{0}, {{\"{1}\", {2}, {3}, {4}, {5}}}}})",
- nest.Byte_thing,
- thing.String_thing,
- thing.Byte_thing,
- thing.I32_thing,
- thing.I64_thing,
- nest.I32_thing);
- return Task.FromResult(nest);
+ nest?.Byte_thing ?? 0,
+ thing?.String_thing ?? "<null>",
+ thing?.Byte_thing ?? 0,
+ thing?.I32_thing ?? 0,
+ thing?.I64_thing ?? 0,
+ nest?.I32_thing ?? 0);
+ return Task.FromResult(nest ?? new Xtruct2()); // null returns are not allowed in Thrift
}
- public Task<Dictionary<int, int>> testMap(Dictionary<int, int> thing, CancellationToken cancellationToken)
+ public Task<Dictionary<int, int>> testMap(Dictionary<int, int>? thing, CancellationToken cancellationToken)
{
sb.Clear();
sb.Append("testMap({{");
- var first = true;
- foreach (var key in thing.Keys)
+ if (thing != null)
{
- if (first)
- {
- first = false;
- }
- else
+ var first = true;
+ foreach (var key in thing.Keys)
{
- sb.Append(", ");
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ sb.Append(", ");
+ }
+ sb.AppendFormat("{0} => {1}", key, thing[key]);
}
- sb.AppendFormat("{0} => {1}", key, thing[key]);
}
sb.Append("}})");
logger.Invoke(sb.ToString());
- return Task.FromResult(thing);
+ return Task.FromResult(thing ?? new Dictionary<int, int>()); // null returns are not allowed in Thrift
}
- public Task<Dictionary<string, string>> testStringMap(Dictionary<string, string> thing, CancellationToken cancellationToken)
+ public Task<Dictionary<string, string>> testStringMap(Dictionary<string, string>? thing, CancellationToken cancellationToken)
{
sb.Clear();
sb.Append("testStringMap({{");
- var first = true;
- foreach (var key in thing.Keys)
+ if (thing != null)
{
- if (first)
- {
- first = false;
- }
- else
+ var first = true;
+ foreach (var key in thing.Keys)
{
- sb.Append(", ");
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ sb.Append(", ");
+ }
+ sb.AppendFormat("{0} => {1}", key, thing[key]);
}
- sb.AppendFormat("{0} => {1}", key, thing[key]);
}
sb.Append("}})");
logger.Invoke(sb.ToString());
- return Task.FromResult(thing);
+ return Task.FromResult(thing ?? new Dictionary<string, string>()); // null returns are not allowed in Thrift
}
- public Task<THashSet<int>> testSet(THashSet<int> thing, CancellationToken cancellationToken)
+ public Task<HashSet<int>> testSet(HashSet<int>? thing, CancellationToken cancellationToken)
{
sb.Clear();
sb.Append("testSet({{");
- var first = true;
- foreach (int elem in thing)
+ if (thing != null)
{
- if (first)
- {
- first = false;
- }
- else
+ var first = true;
+ foreach (int elem in thing)
{
- sb.Append(", ");
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ sb.Append(", ");
+ }
+ sb.AppendFormat("{0}", elem);
}
- sb.AppendFormat("{0}", elem);
}
sb.Append("}})");
logger.Invoke(sb.ToString());
- return Task.FromResult(thing);
+ return Task.FromResult(thing ?? new HashSet<int>()); // null returns are not allowed in Thrift
}
- public Task<List<int>> testList(List<int> thing, CancellationToken cancellationToken)
+ public Task<List<int>> testList(List<int>? thing, CancellationToken cancellationToken)
{
sb.Clear();
sb.Append("testList({{");
- var first = true;
- foreach (var elem in thing)
+ if (thing != null)
{
- if (first)
+ var first = true;
+ foreach (var elem in thing)
{
- first = false;
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ sb.Append(", ");
+ }
+ sb.AppendFormat("{0}", elem);
}
- else
- {
- sb.Append(", ");
- }
- sb.AppendFormat("{0}", elem);
}
sb.Append("}})");
logger.Invoke(sb.ToString());
- return Task.FromResult(thing);
+ return Task.FromResult(thing ?? new List<int>()); // null returns are not allowed in Thrift
}
public Task<Numberz> testEnum(Numberz thing, CancellationToken cancellationToken)
@@ -409,7 +421,7 @@ namespace ThriftTest
return Task.FromResult(mapmap);
}
- public Task<Dictionary<long, Dictionary<Numberz, Insanity>>> testInsanity(Insanity argument, CancellationToken cancellationToken)
+ public Task<Dictionary<long, Dictionary<Numberz, Insanity>>> testInsanity(Insanity? argument, CancellationToken cancellationToken)
{
logger.Invoke("testInsanity()");
@@ -428,8 +440,9 @@ namespace ThriftTest
var first_map = new Dictionary<Numberz, Insanity>();
var second_map = new Dictionary<Numberz, Insanity>(); ;
- first_map[Numberz.TWO] = argument;
- first_map[Numberz.THREE] = argument;
+ // null dict keys/values are not allowed in Thrift
+ first_map[Numberz.TWO] = argument ?? new Insanity();
+ first_map[Numberz.THREE] = argument ?? new Insanity();
second_map[Numberz.SIX] = new Insanity();
@@ -442,7 +455,7 @@ namespace ThriftTest
return Task.FromResult(insane);
}
- public Task<Xtruct> testMulti(sbyte arg0, int arg1, long arg2, Dictionary<short, string> arg3, Numberz arg4, long arg5,
+ public Task<Xtruct> testMulti(sbyte arg0, int arg1, long arg2, Dictionary<short, string>? arg3, Numberz arg4, long arg5,
CancellationToken cancellationToken)
{
logger.Invoke("testMulti()");
@@ -455,9 +468,9 @@ namespace ThriftTest
return Task.FromResult(hello);
}
- public Task testException(string arg, CancellationToken cancellationToken)
+ public Task testException(string? arg, CancellationToken cancellationToken)
{
- logger.Invoke("testException({0})", arg);
+ logger.Invoke("testException({0})", arg ?? "<null>");
if (arg == "Xception")
{
var x = new Xception
@@ -474,9 +487,9 @@ namespace ThriftTest
return Task.CompletedTask;
}
- public Task<Xtruct> testMultiException(string arg0, string arg1, CancellationToken cancellationToken)
+ public Task<Xtruct> testMultiException(string? arg0, string? arg1, CancellationToken cancellationToken)
{
- logger.Invoke("testMultiException({0}, {1})", arg0, arg1);
+ logger.Invoke("testMultiException({0}, {1})", arg0 ?? "<null>", arg1 ?? "<null>");
if (arg0 == "Xception")
{
var x = new Xception