From e5312113fd7fa49d1c1d16696cddc6006d24406b Mon Sep 17 00:00:00 2001 From: Kitty Draper Date: Fri, 22 Aug 2025 14:28:39 -0500 Subject: [PATCH] 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) --- .../Runtime/NetcodeIntegrationTest.cs | 2 +- .../NetworkVariable/NetworkVariableTests.cs | 2 +- .../NetworkVariableTestsHelperTypes.cs | 50 ++++++++++++------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs b/com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs index e6261ae88b..501f7ad848 100644 --- a/com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs +++ b/com.unity.netcode.gameobjects/TestHelpers/Runtime/NetcodeIntegrationTest.cs @@ -24,7 +24,7 @@ public abstract class NetcodeIntegrationTest /// Used to determine if a NetcodeIntegrationTest is currently running to /// determine how clients will load scenes /// - protected const float k_DefaultTimeoutPeriod = 8.0f; + protected const float k_DefaultTimeoutPeriod = 12.0f; protected const float k_TickFrequency = 1.0f / k_DefaultTickRate; internal static bool IsRunning { get; private set; } protected static TimeoutHelper s_GlobalTimeoutHelper = new TimeoutHelper(k_DefaultTimeoutPeriod); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs index 35718a474a..109d14deee 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTests.cs @@ -2805,7 +2805,7 @@ public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesA public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), - typeof(long), typeof(ulong), typeof(bool), typeof(char), typeof(float), typeof(double), + typeof(long), typeof(ulong), typeof(char), typeof(float), typeof(double), typeof(Vector2), typeof(Vector3), typeof(Vector2Int), typeof(Vector3Int), typeof(Vector4), typeof(Quaternion), typeof(HashableNetworkVariableTestClass), typeof(FixedString32Bytes))] Type testType) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTestsHelperTypes.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTestsHelperTypes.cs index f50811ba1f..ae98e5490c 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTestsHelperTypes.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariable/NetworkVariableTestsHelperTypes.cs @@ -187,14 +187,13 @@ internal struct HashableNetworkVariableTestStruct : INetworkSerializeByMemcpy, I public uint E; public long F; public ulong G; - public bool H; - public char I; - public float J; - public double K; + public char H; + public float I; + public double J; public bool Equals(HashableNetworkVariableTestStruct other) { - 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); + 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); } public override bool Equals(object obj) @@ -215,7 +214,6 @@ public override int GetHashCode() hashCode.Add(H); hashCode.Add(I); hashCode.Add(J); - hashCode.Add(K); return hashCode.ToHashCode(); } } @@ -229,14 +227,18 @@ internal struct HashMapKeyStruct : INetworkSerializeByMemcpy, IEquatable