Skip to content

Commit e531211

Browse files
committed
Fixes some test failures when running against arm64:
- Increased the timeout duration because the raspberry pi that tests were run on is quite slow and sometimes doesn't make the timeout - Removed booleans from structures that are created via random bytes because Arm64 doesn't handle booleans the same way as x86, and bool(1) doesn't compare as equal to bool(2) like it does on x86 - Removed booleans from the network variable HashSet test because it created an infinite loop, because bool(1) and bool(2) DO apparently HASH to the same key on arm64, where they create different keys on x86. (This was never a valid test to begin with, because creating a hash set with 32 boolean key values is, strictly speaking, not possible, and only worked by accident on x86)
1 parent c1f9445 commit e531211

File tree

3 files changed

+34
-20
lines changed

3 files changed

+34
-20
lines changed

com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public abstract class NetcodeIntegrationTest
2424
/// Used to determine if a NetcodeIntegrationTest is currently running to
2525
/// determine how clients will load scenes
2626
/// </summary>
27-
protected const float k_DefaultTimeoutPeriod = 8.0f;
27+
protected const float k_DefaultTimeoutPeriod = 12.0f;
2828
protected const float k_TickFrequency = 1.0f / k_DefaultTickRate;
2929
internal static bool IsRunning { get; private set; }
3030
protected static TimeoutHelper s_GlobalTimeoutHelper = new TimeoutHelper(k_DefaultTimeoutPeriod);

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2805,7 +2805,7 @@ public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesA
28052805
public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_ValuesAreSerializedCorrectly(
28062806

28072807
[Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint),
2808-
typeof(long), typeof(ulong), typeof(bool), typeof(char), typeof(float), typeof(double),
2808+
typeof(long), typeof(ulong), typeof(char), typeof(float), typeof(double),
28092809
typeof(Vector2), typeof(Vector3), typeof(Vector2Int), typeof(Vector3Int), typeof(Vector4),
28102810
typeof(Quaternion), typeof(HashableNetworkVariableTestClass), typeof(FixedString32Bytes))]
28112811
Type testType)

com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTestsHelperTypes.cs

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,13 @@ internal struct HashableNetworkVariableTestStruct : INetworkSerializeByMemcpy, I
187187
public uint E;
188188
public long F;
189189
public ulong G;
190-
public bool H;
191-
public char I;
192-
public float J;
193-
public double K;
190+
public char H;
191+
public float I;
192+
public double J;
194193

195194
public bool Equals(HashableNetworkVariableTestStruct other)
196195
{
197-
return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F && G == other.G && H == other.H && I == other.I && J.Equals(other.J) && K.Equals(other.K);
196+
return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F && G == other.G && H == other.H && I.Equals(other.I) && J.Equals(other.J);
198197
}
199198

200199
public override bool Equals(object obj)
@@ -215,7 +214,6 @@ public override int GetHashCode()
215214
hashCode.Add(H);
216215
hashCode.Add(I);
217216
hashCode.Add(J);
218-
hashCode.Add(K);
219217
return hashCode.ToHashCode();
220218
}
221219
}
@@ -229,14 +227,18 @@ internal struct HashMapKeyStruct : INetworkSerializeByMemcpy, IEquatable<HashMap
229227
public uint E;
230228
public long F;
231229
public ulong G;
232-
public bool H;
233-
public char I;
234-
public float J;
235-
public double K;
230+
public char H;
231+
public float I;
232+
public double J;
236233

237234
public bool Equals(HashMapKeyStruct other)
238235
{
239-
return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F && G == other.G && H == other.H && I == other.I && J.Equals(other.J) && K.Equals(other.K);
236+
return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F && G == other.G && H == other.H && I.Equals(other.I) && J.Equals(other.J);
237+
}
238+
239+
public override string ToString()
240+
{
241+
return $"{{A: {A}, B: {B}, C:{C}, D:{D}, E:{E}, F:{F}, G:{G}, H:{H}, I:{I}, J:{J}}}";
240242
}
241243

242244
public override bool Equals(object obj)
@@ -257,7 +259,6 @@ public override int GetHashCode()
257259
hashCode.Add(H);
258260
hashCode.Add(I);
259261
hashCode.Add(J);
260-
hashCode.Add(K);
261262
return hashCode.ToHashCode();
262263
}
263264
}
@@ -271,14 +272,18 @@ internal struct HashMapValStruct : INetworkSerializeByMemcpy, IEquatable<HashMap
271272
public uint E;
272273
public long F;
273274
public ulong G;
274-
public bool H;
275-
public char I;
276-
public float J;
277-
public double K;
275+
public char H;
276+
public float I;
277+
public double J;
278278

279279
public bool Equals(HashMapValStruct other)
280280
{
281-
return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F && G == other.G && H == other.H && I == other.I && J.Equals(other.J) && K.Equals(other.K);
281+
return A == other.A && B == other.B && C == other.C && D == other.D && E == other.E && F == other.F && G == other.G && H == other.H && I.Equals(other.I) && J.Equals(other.J);
282+
}
283+
284+
public override string ToString()
285+
{
286+
return $"{{A: {A}, B: {B}, C:{C}, D:{D}, E:{E}, F:{F}, G:{G}, H:{H}, I:{I}, J:{J}}}";
282287
}
283288

284289
public override bool Equals(object obj)
@@ -299,7 +304,6 @@ public override int GetHashCode()
299304
hashCode.Add(H);
300305
hashCode.Add(I);
301306
hashCode.Add(J);
302-
hashCode.Add(K);
303307
return hashCode.ToHashCode();
304308
}
305309
}
@@ -381,6 +385,11 @@ public override bool Equals(object obj)
381385
return obj is HashMapKeyClass other && Equals(other);
382386
}
383387

388+
public override string ToString()
389+
{
390+
return Data.ToString();
391+
}
392+
384393
public override int GetHashCode()
385394
{
386395
return Data.GetHashCode();
@@ -401,6 +410,11 @@ public bool Equals(HashMapValClass other)
401410
return Data.Equals(other.Data);
402411
}
403412

413+
public override string ToString()
414+
{
415+
return Data.ToString();
416+
}
417+
404418
public override bool Equals(object obj)
405419
{
406420
return obj is HashMapValClass other && Equals(other);

0 commit comments

Comments
 (0)