From 85ca689f318c46f777217c30f5dc0e2c793929d5 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Tue, 16 Apr 2024 15:47:06 -0500 Subject: [PATCH 1/6] test Increasing timeout for 2 URPC tests that commonly timeout. --- .../Tests/Runtime/UniversalRpcTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs index 6be13427e0..7034fe9c6a 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs @@ -1285,6 +1285,7 @@ public enum AllocationType List } + [Timeout(360000)] [UnityTest] public IEnumerator TestSendingWithGroupOverride() { @@ -1378,6 +1379,7 @@ public enum AllocationType List } + [Timeout(360000)] [UnityTest] public IEnumerator TestSendingWithGroupNotOverride() { From 7f4312944f4a5be18bcc0f708640b04f2d0d6835 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Tue, 16 Apr 2024 15:48:31 -0500 Subject: [PATCH 2/6] style adding comments --- .../Tests/Runtime/UniversalRpcTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs index 7034fe9c6a..7f9b300c68 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs @@ -1285,6 +1285,7 @@ public enum AllocationType List } + // Extending timeout since the added yield return causes this test to commonly timeout [Timeout(360000)] [UnityTest] public IEnumerator TestSendingWithGroupOverride() @@ -1379,6 +1380,7 @@ public enum AllocationType List } + // Extending timeout since the added yield return causes this test to commonly timeout [Timeout(360000)] [UnityTest] public IEnumerator TestSendingWithGroupNotOverride() From 0958d04dd5d23af703ed1cb55093bfc1ec48c1c2 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Wed, 17 Apr 2024 12:00:13 -0500 Subject: [PATCH 3/6] update-temp Running tests on only 2022.3 --- .yamato/project.metafile | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.yamato/project.metafile b/.yamato/project.metafile index c0ec992fc0..f8d663b68e 100644 --- a/.yamato/project.metafile +++ b/.yamato/project.metafile @@ -1,5 +1,5 @@ -validation_editor: 2021.3 -mobile_validation_editor: 2021.3 +validation_editor: 2022.3 +mobile_validation_editor: 2022.3 # Platforms that will be tested. The first entry in this array will also # be used for validation @@ -42,10 +42,7 @@ projects: - name: com.unity.netcode.gameobjects path: com.unity.netcode.gameobjects test_editors: - - 2021.3 - - 2022.2 - - 2023.1 - - trunk + - 2022.3 - name: minimalproject path: minimalproject validate: false @@ -55,24 +52,21 @@ projects: - name: com.unity.netcode.gameobjects path: com.unity.netcode.gameobjects test_editors: - - 2021.3 + - 2022.3 - name: testproject-tools-integration path: testproject-tools-integration validate: false publish: false has_tests: true test_editors: - - 2021.3 - - 2022.2 - - trunk + - 2022.3 # Package dependencies dependencies: - name: com.unity.transport version: 2.0.0-pre.2 test_editors: - - 2022.2 - - trunk + - 2022.3 # Scripting backends used by Standalone Playmode Tests scripting_backends: From 160c91775881c827a555cb618953a047710669ae Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Wed, 17 Apr 2024 14:07:11 -0500 Subject: [PATCH 4/6] style and test Adjusting URPC tests. Fixing naming convention violation. --- .../Editor/NetworkManagerEditor.cs | 8 ++--- .../Tests/Runtime/UniversalRpcTests.cs | 33 +++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs index 1713ba226a..75c5765669 100644 --- a/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs +++ b/com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs @@ -222,7 +222,7 @@ private void DrawAllPropertyFields() private void DrawTransportField() { #if RELAY_INTEGRATION_AVAILABLE - var useRelay = EditorPrefs.GetBool(k_UseEasyRelayIntegrationKey, false); + var useRelay = EditorPrefs.GetBool(m_UseEasyRelayIntegrationKey, false); #else var useRelay = false; #endif @@ -257,7 +257,7 @@ private void DrawTransportField() } #if RELAY_INTEGRATION_AVAILABLE - private readonly string k_UseEasyRelayIntegrationKey = "NetworkManagerUI_UseRelay_" + Application.dataPath.GetHashCode(); + private readonly string m_UseEasyRelayIntegrationKey = "NetworkManagerUI_UseRelay_" + Application.dataPath.GetHashCode(); private string m_JoinCode = ""; private string m_StartConnectionError = null; private string m_Region = ""; @@ -272,7 +272,7 @@ private void ShowStartConnectionButtons() #if RELAY_INTEGRATION_AVAILABLE // use editor prefs to persist the setting when entering / leaving play mode / exiting Unity - var useRelay = EditorPrefs.GetBool(k_UseEasyRelayIntegrationKey, false); + var useRelay = EditorPrefs.GetBool(m_UseEasyRelayIntegrationKey, false); GUILayout.BeginHorizontal(); useRelay = GUILayout.Toggle(useRelay, "Try Relay in the Editor"); @@ -284,7 +284,7 @@ private void ShowStartConnectionButtons() } GUILayout.EndHorizontal(); - EditorPrefs.SetBool(k_UseEasyRelayIntegrationKey, useRelay); + EditorPrefs.SetBool(m_UseEasyRelayIntegrationKey, useRelay); if (useRelay && !Application.isPlaying && !CloudProjectSettings.projectBound) { EditorGUILayout.HelpBox("To use relay, you need to setup your project in the Project Settings in the Services section.", MessageType.Warning); diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs index 7f9b300c68..e157a3a212 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/UniversalRpcTests.cs @@ -1286,24 +1286,30 @@ public enum AllocationType } // Extending timeout since the added yield return causes this test to commonly timeout - [Timeout(360000)] + [Timeout(600000)] [UnityTest] public IEnumerator TestSendingWithGroupOverride() { + var waitFor = new WaitForFixedUpdate(); foreach (var defaultSendTo in Enum.GetValues(typeof(SendTo))) { + m_EnableVerboseDebug = true; + VerboseDebug($"Processing: {defaultSendTo}"); + m_EnableVerboseDebug = false; + foreach (var recipient in RecipientGroups) { for (ulong objectOwner = 0u; objectOwner <= 2u; ++objectOwner) { for (ulong sender = 0u; sender <= 2u; ++sender) { + yield return waitFor; foreach (var allocationType in Enum.GetValues(typeof(AllocationType))) { - if (++YieldCheck % YieldCycleCount == 0) - { - yield return null; - } + //if (++YieldCheck % YieldCycleCount == 0) + //{ + // yield return null; + //} OnInlineSetup(); var sendMethodName = $"DefaultTo{defaultSendTo}AllowOverrideRpc"; @@ -1381,24 +1387,31 @@ public enum AllocationType } // Extending timeout since the added yield return causes this test to commonly timeout - [Timeout(360000)] + [Timeout(600000)] [UnityTest] public IEnumerator TestSendingWithGroupNotOverride() { + var waitFor = new WaitForFixedUpdate(); foreach (var defaultSendTo in Enum.GetValues(typeof(SendTo))) { + m_EnableVerboseDebug = true; + VerboseDebug($"Processing: {defaultSendTo}"); + m_EnableVerboseDebug = false; foreach (var recipient in RecipientGroups) { for (ulong objectOwner = 0u; objectOwner <= 2u; ++objectOwner) { for (ulong sender = 0u; sender <= 2u; ++sender) { + yield return waitFor; + foreach (var allocationType in Enum.GetValues(typeof(AllocationType))) { - if (++YieldCheck % YieldCycleCount == 0) - { - yield return null; - } + //if (++YieldCheck % YieldCycleCount == 0) + //{ + // yield return waitFor; + //} + OnInlineSetup(); var sendMethodName = $"DefaultTo{defaultSendTo}AllowOverrideRpc"; From bd92a812eeb2db926620316fcdcb298cf028f32b Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Wed, 17 Apr 2024 17:13:23 -0500 Subject: [PATCH 5/6] test increase number of bytes to adjust under CorruptBytes pass. --- .../Editor/Messaging/MessageCorruptionTests.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs b/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs index 96544ac4a3..469a89930d 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs @@ -90,11 +90,16 @@ public unsafe void Send(ulong clientId, NetworkDelivery delivery, FastBufferWrit break; } case TypeOfCorruption.CorruptBytes: - batchData.Seek(batchData.Length - 2); - var currentByte = batchData.GetUnsafePtr()[0]; - batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0)); - MessageQueue.Add(batchData.ToArray()); - break; + { + batchData.Seek(batchData.Length - 4); + for (int i = 0;i < 4; i++) + { + var currentByte = batchData.GetUnsafePtr()[i]; + batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0)); + MessageQueue.Add(batchData.ToArray()); + } + break; + } case TypeOfCorruption.Truncated: batchData.Truncate(batchData.Length - 1); MessageQueue.Add(batchData.ToArray()); From 00bdc19233071e803e52355aee650be12bf7576d Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Wed, 17 Apr 2024 17:21:22 -0500 Subject: [PATCH 6/6] style missing white space --- .../Tests/Editor/Messaging/MessageCorruptionTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs b/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs index 469a89930d..b37454f233 100644 --- a/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Editor/Messaging/MessageCorruptionTests.cs @@ -92,7 +92,7 @@ public unsafe void Send(ulong clientId, NetworkDelivery delivery, FastBufferWrit case TypeOfCorruption.CorruptBytes: { batchData.Seek(batchData.Length - 4); - for (int i = 0;i < 4; i++) + for (int i = 0; i < 4; i++) { var currentByte = batchData.GetUnsafePtr()[i]; batchData.WriteByteSafe((byte)(currentByte == 0 ? 1 : 0));