Skip to content

Commit 6d4c48d

Browse files
authored
test: multiprocess test scene should give some feedback during runtime (#1770)
* For some visual feedback, include a text in the screen that shows some state and progress information * Reduce the number of text updates * don't update the display text if we are running performance tests * fix whitespace * SetActive false if IsPerformanceTest * Remove the IsPerformanceTest check from Update
1 parent aa72beb commit 6d4c48d

File tree

5 files changed

+238
-11
lines changed

5 files changed

+238
-11
lines changed

testproject/Assets/Scenes/MultiprocessTestScene.unity

Lines changed: 140 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44657838, g: 0.49641234, b: 0.57481676, a: 1}
4242
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &3
4444
LightmapSettings:
@@ -212,6 +212,7 @@ Transform:
212212
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
213213
m_LocalPosition: {x: 0, y: 3, z: 0}
214214
m_LocalScale: {x: 1, y: 1, z: 1}
215+
m_ConstrainProportionsScale: 0
215216
m_Children: []
216217
m_Father: {fileID: 0}
217218
m_RootOrder: 1
@@ -223,7 +224,7 @@ LightingSettings:
223224
m_PrefabInstance: {fileID: 0}
224225
m_PrefabAsset: {fileID: 0}
225226
m_Name:
226-
serializedVersion: 3
227+
serializedVersion: 4
227228
m_GIWorkflowMode: 1
228229
m_EnableBakedLightmaps: 1
229230
m_EnableRealtimeLightmaps: 0
@@ -236,7 +237,7 @@ LightingSettings:
236237
m_LightmapMaxSize: 1024
237238
m_BakeResolution: 40
238239
m_Padding: 2
239-
m_TextureCompression: 1
240+
m_LightmapCompression: 3
240241
m_AO: 0
241242
m_AOMaxDistance: 1
242243
m_CompAOExponent: 1
@@ -277,6 +278,7 @@ LightingSettings:
277278
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
278279
m_PVRFilteringAtrousPositionSigmaIndirect: 2
279280
m_PVRFilteringAtrousPositionSigmaAO: 1
281+
m_PVRTiledBaking: 0
280282
--- !u!1 &160940364
281283
GameObject:
282284
m_ObjectHideFlags: 0
@@ -369,10 +371,123 @@ Transform:
369371
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
370372
m_LocalPosition: {x: -10, y: -10, z: -10}
371373
m_LocalScale: {x: 1, y: 1, z: 1}
374+
m_ConstrainProportionsScale: 0
372375
m_Children: []
373376
m_Father: {fileID: 0}
374377
m_RootOrder: 5
375378
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
379+
--- !u!1 &430011403
380+
GameObject:
381+
m_ObjectHideFlags: 0
382+
m_CorrespondingSourceObject: {fileID: 0}
383+
m_PrefabInstance: {fileID: 0}
384+
m_PrefabAsset: {fileID: 0}
385+
serializedVersion: 6
386+
m_Component:
387+
- component: {fileID: 430011407}
388+
- component: {fileID: 430011406}
389+
- component: {fileID: 430011405}
390+
- component: {fileID: 430011404}
391+
m_Layer: 0
392+
m_Name: ThreeDText
393+
m_TagString: Untagged
394+
m_Icon: {fileID: 0}
395+
m_NavMeshLayer: 0
396+
m_StaticEditorFlags: 0
397+
m_IsActive: 1
398+
--- !u!114 &430011404
399+
MonoBehaviour:
400+
m_ObjectHideFlags: 0
401+
m_CorrespondingSourceObject: {fileID: 0}
402+
m_PrefabInstance: {fileID: 0}
403+
m_PrefabAsset: {fileID: 0}
404+
m_GameObject: {fileID: 430011403}
405+
m_Enabled: 1
406+
m_EditorHideFlags: 0
407+
m_Script: {fileID: 11500000, guid: 04cf3cc1396054b009a1ed283aa50021, type: 3}
408+
m_Name:
409+
m_EditorClassIdentifier:
410+
IsTestCoordinatorActiveAndEnabled: 0
411+
CommandLineArguments:
412+
--- !u!102 &430011405
413+
TextMesh:
414+
serializedVersion: 3
415+
m_ObjectHideFlags: 0
416+
m_CorrespondingSourceObject: {fileID: 0}
417+
m_PrefabInstance: {fileID: 0}
418+
m_PrefabAsset: {fileID: 0}
419+
m_GameObject: {fileID: 430011403}
420+
m_Text: Hello World
421+
m_OffsetZ: 0
422+
m_CharacterSize: 1
423+
m_LineSpacing: 1
424+
m_Anchor: 0
425+
m_Alignment: 0
426+
m_TabSize: 4
427+
m_FontSize: 0
428+
m_FontStyle: 0
429+
m_RichText: 1
430+
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
431+
m_Color:
432+
serializedVersion: 2
433+
rgba: 4294967295
434+
--- !u!23 &430011406
435+
MeshRenderer:
436+
m_ObjectHideFlags: 0
437+
m_CorrespondingSourceObject: {fileID: 0}
438+
m_PrefabInstance: {fileID: 0}
439+
m_PrefabAsset: {fileID: 0}
440+
m_GameObject: {fileID: 430011403}
441+
m_Enabled: 1
442+
m_CastShadows: 1
443+
m_ReceiveShadows: 1
444+
m_DynamicOccludee: 1
445+
m_StaticShadowCaster: 0
446+
m_MotionVectors: 1
447+
m_LightProbeUsage: 1
448+
m_ReflectionProbeUsage: 1
449+
m_RayTracingMode: 2
450+
m_RayTraceProcedural: 0
451+
m_RenderingLayerMask: 1
452+
m_RendererPriority: 0
453+
m_Materials:
454+
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
455+
m_StaticBatchInfo:
456+
firstSubMesh: 0
457+
subMeshCount: 0
458+
m_StaticBatchRoot: {fileID: 0}
459+
m_ProbeAnchor: {fileID: 0}
460+
m_LightProbeVolumeOverride: {fileID: 0}
461+
m_ScaleInLightmap: 1
462+
m_ReceiveGI: 1
463+
m_PreserveUVs: 0
464+
m_IgnoreNormalsForChartDetection: 0
465+
m_ImportantGI: 0
466+
m_StitchLightmapSeams: 1
467+
m_SelectedEditorRenderState: 3
468+
m_MinimumChartSize: 4
469+
m_AutoUVMaxDistance: 0.5
470+
m_AutoUVMaxAngle: 89
471+
m_LightmapParameters: {fileID: 0}
472+
m_SortingLayerID: 0
473+
m_SortingLayer: 0
474+
m_SortingOrder: 0
475+
m_AdditionalVertexStreams: {fileID: 0}
476+
--- !u!4 &430011407
477+
Transform:
478+
m_ObjectHideFlags: 0
479+
m_CorrespondingSourceObject: {fileID: 0}
480+
m_PrefabInstance: {fileID: 0}
481+
m_PrefabAsset: {fileID: 0}
482+
m_GameObject: {fileID: 430011403}
483+
m_LocalRotation: {x: 0.2164396, y: 0, z: 0, w: 0.97629607}
484+
m_LocalPosition: {x: -40, y: 0, z: 10}
485+
m_LocalScale: {x: 1, y: 1, z: 1}
486+
m_ConstrainProportionsScale: 0
487+
m_Children: []
488+
m_Father: {fileID: 0}
489+
m_RootOrder: 7
490+
m_LocalEulerAnglesHint: {x: 25, y: 0, z: 0}
376491
--- !u!1 &941021721
377492
GameObject:
378493
m_ObjectHideFlags: 0
@@ -452,6 +567,7 @@ Transform:
452567
m_LocalRotation: {x: 0.21736304, y: -0, z: -0, w: 0.97609085}
453568
m_LocalPosition: {x: 0, y: 9.15, z: -27.5}
454569
m_LocalScale: {x: 1, y: 1, z: 1}
570+
m_ConstrainProportionsScale: 0
455571
m_Children: []
456572
m_Father: {fileID: 0}
457573
m_RootOrder: 0
@@ -548,6 +664,7 @@ Transform:
548664
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
549665
m_LocalPosition: {x: 0, y: 0, z: 0}
550666
m_LocalScale: {x: 1, y: 1, z: 1}
667+
m_ConstrainProportionsScale: 0
551668
m_Children: []
552669
m_Father: {fileID: 0}
553670
m_RootOrder: 4
@@ -644,6 +761,7 @@ Transform:
644761
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
645762
m_LocalPosition: {x: 10, y: 10, z: 10}
646763
m_LocalScale: {x: 1, y: 1, z: 1}
764+
m_ConstrainProportionsScale: 0
647765
m_Children: []
648766
m_Father: {fileID: 0}
649767
m_RootOrder: 3
@@ -679,7 +797,6 @@ MonoBehaviour:
679797
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3}
680798
m_Name:
681799
m_EditorClassIdentifier:
682-
DontDestroy: 0
683800
RunInBackground: 1
684801
LogLevel: 1
685802
NetworkConfig:
@@ -719,6 +836,7 @@ Transform:
719836
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
720837
m_LocalPosition: {x: 0, y: 0, z: 0}
721838
m_LocalScale: {x: 1, y: 1, z: 1}
839+
m_ConstrainProportionsScale: 0
722840
m_Children:
723841
- {fileID: 1674777072}
724842
- {fileID: 2027640072}
@@ -795,6 +913,7 @@ Transform:
795913
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
796914
m_LocalPosition: {x: 10, y: 10, z: 10}
797915
m_LocalScale: {x: 1, y: 1, z: 1}
916+
m_ConstrainProportionsScale: 0
798917
m_Children: []
799918
m_Father: {fileID: 0}
800919
m_RootOrder: 6
@@ -838,6 +957,7 @@ Transform:
838957
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
839958
m_LocalPosition: {x: 0, y: 0, z: 0}
840959
m_LocalScale: {x: 1, y: 1, z: 1}
960+
m_ConstrainProportionsScale: 0
841961
m_Children: []
842962
m_Father: {fileID: 1211923376}
843963
m_RootOrder: 0
@@ -888,6 +1008,7 @@ Transform:
8881008
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
8891009
m_LocalPosition: {x: 0, y: 0, z: 0}
8901010
m_LocalScale: {x: 1, y: 1, z: 1}
1011+
m_ConstrainProportionsScale: 0
8911012
m_Children: []
8921013
m_Father: {fileID: 1211923376}
8931014
m_RootOrder: 1
@@ -905,9 +1026,18 @@ MonoBehaviour:
9051026
m_Name:
9061027
m_EditorClassIdentifier:
9071028
m_ProtocolType: 0
908-
m_MessageBufferSize: 6144
909-
m_ReciveQueueSize: 128
910-
m_SendQueueSize: 128
911-
m_SendQueueBatchSize: 4096
912-
m_ServerAddress: 127.0.0.1
913-
m_ServerPort: 7777
1029+
m_MaxPacketQueueSize: 128
1030+
m_MaxPayloadSize: 4096
1031+
m_MaxSendQueueSize: 98304
1032+
m_HeartbeatTimeoutMS: 500
1033+
m_ConnectTimeoutMS: 1000
1034+
m_MaxConnectAttempts: 60
1035+
m_DisconnectTimeoutMS: 30000
1036+
ConnectionData:
1037+
Address: 127.0.0.1
1038+
Port: 7777
1039+
ServerListenAddress:
1040+
DebugSimulator:
1041+
PacketDelayMS: 0
1042+
PacketJitterMS: 0
1043+
PacketDropRate: 0

testproject/Assets/Tests/Runtime/MultiprocessRuntime/BaseMultiprocessTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public abstract class BaseMultiprocessTests
2121
// TODO: Remove UTR check once we have Multiprocess tests fully working
2222
protected bool IgnoreMultiprocessTests => MultiprocessOrchestration.ShouldIgnoreUTRTests();
2323

24-
protected virtual bool IsPerformanceTest => true;
24+
protected virtual bool IsPerformanceTest => false;
2525

2626
/// <summary>
2727
/// Implement this to specify the amount of workers to spawn from your main test runner
@@ -39,6 +39,7 @@ public abstract class BaseMultiprocessTests
3939
public virtual void SetupTestSuite()
4040
{
4141
MultiprocessLogger.Log("Running SetupTestSuite - OneTimeSetup");
42+
MultiprocessOrchestration.IsPerformanceTest = IsPerformanceTest;
4243
if (IgnoreMultiprocessTests)
4344
{
4445
Assert.Ignore("Ignoring tests under UTR. For testing, include the \"-bypassIgnoreUTR\" command line parameter.");

testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/MultiprocessOrchestration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
public class MultiprocessOrchestration
1313
{
14+
public static bool IsPerformanceTest;
1415
public const string IsWorkerArg = "-isWorker";
1516
private static DirectoryInfo s_MultiprocessDirInfo;
1617
public static DirectoryInfo MultiprocessDirInfo
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
using UnityEngine;
2+
#if UNITY_UNET_PRESENT
3+
using Unity.Netcode.Transports.UNET;
4+
#endif
5+
6+
namespace Unity.Netcode.MultiprocessRuntimeTests
7+
{
8+
public class ThreeDText : MonoBehaviour
9+
{
10+
public bool IsTestCoordinatorActiveAndEnabled = false;
11+
public string CommandLineArguments = "";
12+
private long m_UpdateCounter;
13+
private bool m_HasFired;
14+
private string m_TransportString;
15+
16+
public void Awake()
17+
{
18+
if (MultiprocessOrchestration.IsPerformanceTest)
19+
{
20+
gameObject.SetActive(false);
21+
}
22+
}
23+
24+
// Start is called before the first frame update
25+
public void Start()
26+
{
27+
Debug.Log("ThreeDText - Start");
28+
m_HasFired = false;
29+
m_UpdateCounter = 0;
30+
m_TransportString = "null";
31+
var jsonTextFile = Resources.Load<TextAsset>("Text/multiprocess_tests");
32+
Debug.Log(jsonTextFile);
33+
34+
var t = GetComponent<TextMesh>();
35+
t.text = "On Start";
36+
CommandLineArguments = System.Environment.CommandLine;
37+
38+
string[] args = System.Environment.GetCommandLineArgs();
39+
foreach (var arg in args)
40+
{
41+
Debug.Log(arg);
42+
CommandLineArguments += " " + arg;
43+
}
44+
Debug.Log($"CommandLineArguments {CommandLineArguments}");
45+
}
46+
47+
// Update is called once per frame
48+
public void Update()
49+
{
50+
m_UpdateCounter++;
51+
var testCoordinator = TestCoordinator.Instance;
52+
if (testCoordinator == null)
53+
{
54+
return;
55+
}
56+
57+
var transport = NetworkManager.Singleton != null ? NetworkManager.Singleton.NetworkConfig.NetworkTransport : null;
58+
var transportString = "";
59+
if (transport == null)
60+
{
61+
transportString = "null";
62+
}
63+
else
64+
{
65+
transportString = transport.ToString();
66+
}
67+
68+
var t = GetComponent<TextMesh>();
69+
70+
if (IsTestCoordinatorActiveAndEnabled != testCoordinator.isActiveAndEnabled ||
71+
!m_HasFired ||
72+
!m_TransportString.Equals(transportString))
73+
{
74+
m_HasFired = true;
75+
m_TransportString = transportString;
76+
IsTestCoordinatorActiveAndEnabled = testCoordinator.isActiveAndEnabled;
77+
t.text = $"On Update -\ntestCoordinator.isActiveAndEnabled:{testCoordinator.isActiveAndEnabled}\n" +
78+
$"Transport: {transportString}\n" +
79+
$"{CommandLineArguments}\n" +
80+
$"{m_UpdateCounter}\n";
81+
}
82+
}
83+
}
84+
}

testproject/Assets/Tests/Runtime/MultiprocessRuntime/ThreeDText.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)