Skip to content

Commit 414fd51

Browse files
authored
Merge pull request #163 from paq/rm2022
Remove Unity 2022 from test lanes
2 parents 88626b6 + 6d72770 commit 414fd51

7 files changed

Lines changed: 138 additions & 130 deletions

File tree

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dotnet run --project tests/UnityTestRunner --configuration Release -- --treenode
1515
dotnet run --project tests/UnityTestRunner --configuration Release -- --treenode-filter "/*/Alchemy.UnityTestRunner/Unity*EditorCaptureTests/*"
1616
```
1717

18-
Unity versions are registered explicitly in `UnityTestRunner/UnityVersionTests.cs`. Each version has an EditMode test and a PlayMode test.
18+
The active test lanes are Unity 6000.0, 6000.3, 6000.5, and 6000.7, registered explicitly in `UnityTestRunner/UnityVersionTests.cs`. Each version has an EditMode test and a PlayMode test.
1919

2020
Unity Editor logs are stored under each version project's `Logs/UnityTestRunner/<run-id>` directory. Unity logs and NUnit reports are attached to their TUnit test, and warning-or-higher entries are written to stderr.
2121

tests/UnityTestRunner/UnityEditorLifecycle.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ internal async Task CloseRunningAsync(
1414
Action<string> writeProgress,
1515
CancellationToken cancellationToken)
1616
{
17-
var connectedEditor = project.MajorVersion >= 6000
18-
? await unityCli.FindConnectedEditorAsync(
19-
project,
20-
cancellationToken)
21-
: null;
17+
var connectedEditor = await unityCli.FindConnectedEditorAsync(
18+
project,
19+
cancellationToken);
2220
if (connectedEditor is not null)
2321
{
2422
writeProgress(

tests/UnityTestRunner/UnityTest.cs

Lines changed: 3 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -103,53 +103,29 @@ public static async Task RunAsync(
103103

104104
var reportPath = Path.Combine(context.LogDirectory, $"{mode}.xml");
105105
var editorLogPath = Path.Combine(context.LogDirectory, $"{mode}.log");
106-
var cliLogPath = project.MajorVersion >= 6000
107-
? string.Empty
108-
: Path.Combine(context.LogDirectory, $"{mode}.cli.log");
109106

110107
WriteProgress(project, $"{mode}: running...");
111108

112109
try
113110
{
114-
if (project.MajorVersion >= 6000)
115-
{
116-
await RunUnityProcessModeAsync(
117-
project,
118-
context,
119-
mode,
120-
reportPath,
121-
editorLogPath,
122-
cancellationToken);
123-
ValidateReport(project, mode, reportPath);
124-
return;
125-
}
126-
127-
var result = await RunUnityAsync(
111+
await RunUnityProcessModeAsync(
128112
project,
129-
context.EditorPath,
113+
context,
130114
mode,
131115
reportPath,
132116
editorLogPath,
133117
cancellationToken);
134118
ValidateReport(project, mode, reportPath);
135-
if (result.ExitCode != 0)
136-
{
137-
throw new UnityExecutionException(
138-
$"Unity {project.EditorVersion} {mode} exited with code " +
139-
$"{result.ExitCode} despite producing a passing report." +
140-
FormatProcessDiagnostic(result));
141-
}
142119
}
143120
finally
144121
{
145122
var artifacts = new[]
146123
{
147124
context.RefreshLogPath,
148125
editorLogPath,
149-
cliLogPath,
150126
reportPath,
151127
};
152-
WriteLogDiagnostics(project, [editorLogPath, cliLogPath]);
128+
WriteLogDiagnostics(project, [editorLogPath]);
153129
AttachArtifacts(artifacts);
154130
}
155131
}
@@ -289,47 +265,6 @@ private static void ValidateReport(
289265
}
290266
}
291267

292-
private static async Task<ProcessResult> RunUnityAsync(
293-
UnityProject project,
294-
string editorPath,
295-
TestMode mode,
296-
string reportPath,
297-
string editorLogPath,
298-
CancellationToken cancellationToken)
299-
{
300-
var fileName = UnityEditorLifecycle.GetEditorExecutable(editorPath);
301-
if (!File.Exists(fileName))
302-
{
303-
throw new UnityUnavailableException(
304-
$"The installed Unity editor executable does not exist: {fileName}");
305-
}
306-
307-
var arguments = BuildBatchModeArguments(
308-
project,
309-
mode,
310-
reportPath,
311-
editorLogPath);
312-
var workingDirectory = project.ProjectPath;
313-
314-
try
315-
{
316-
var result = await ProcessRunner.RunAsync(
317-
new ProcessSpec(
318-
fileName,
319-
arguments,
320-
workingDirectory,
321-
TerminateDescendantsOnExit: true),
322-
cancellationToken);
323-
return result;
324-
}
325-
catch (ProcessExecutionException exception)
326-
{
327-
throw new UnityExecutionException(
328-
$"Could not start Unity {project.EditorVersion} for {mode}.",
329-
exception);
330-
}
331-
}
332-
333268
private static IReadOnlyList<string> BuildLibraryWarmupArguments(
334269
UnityProject project,
335270
string logPath)
@@ -348,31 +283,6 @@ private static IReadOnlyList<string> BuildLibraryWarmupArguments(
348283
];
349284
}
350285

351-
private static IReadOnlyList<string> BuildBatchModeArguments(
352-
UnityProject project,
353-
TestMode mode,
354-
string reportPath,
355-
string logPath)
356-
{
357-
var command = mode == TestMode.EditMode
358-
? "Alchemy.Tests.TestCommands.RunAllEditModeTests"
359-
: "Alchemy.Tests.TestCommands.RunAllPlayModeTests";
360-
var arguments = CreateTestArguments(mode);
361-
arguments.AddRange(
362-
[
363-
"-projectPath",
364-
".",
365-
"-executeMethod",
366-
command,
367-
"-testResults",
368-
reportPath,
369-
"--auto-quit",
370-
"-logFile",
371-
logPath,
372-
]);
373-
return arguments;
374-
}
375-
376286
private static List<string> CreateTestArguments(TestMode mode)
377287
{
378288
var arguments = new List<string> { "-batchmode" };
@@ -420,16 +330,6 @@ private static string FormatSummary(NUnitRunSummary summary)
420330
$"{summary.Skipped} skipped";
421331
}
422332

423-
private static string FormatProcessDiagnostic(ProcessResult result)
424-
{
425-
var diagnostic = string.IsNullOrWhiteSpace(result.StandardError)
426-
? result.StandardOutput
427-
: result.StandardError;
428-
return string.IsNullOrWhiteSpace(diagnostic)
429-
? string.Empty
430-
: $"{Environment.NewLine}{diagnostic.Trim()}";
431-
}
432-
433333
private static void WriteProgress(UnityProject project, string message)
434334
{
435335
LiveOutput.WriteLine($"[{project.EditorVersion}] {message}");

tests/UnityTestRunner/UnityVersionTests.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@
22

33
namespace Alchemy.UnityTestRunner;
44

5-
public sealed class Unity2022_3UnitTests
6-
{
7-
private static readonly UnityProject Project =
8-
UnityProject.Locate("../versions/Unity2022.3");
9-
10-
[Before(HookType.Class)]
11-
public static Task Refresh(CancellationToken cancellationToken) =>
12-
UnityTest.RefreshAsync(Project, cancellationToken);
13-
14-
[Test]
15-
public Task EditMode(CancellationToken cancellationToken) =>
16-
UnityTest.RunAsync(Project, TestMode.EditMode, cancellationToken);
17-
18-
[Test]
19-
public Task PlayMode(CancellationToken cancellationToken) =>
20-
UnityTest.RunAsync(Project, TestMode.PlayMode, cancellationToken);
21-
}
22-
235
public sealed class Unity6000_0UnitTests
246
{
257
private static readonly UnityProject Project =

tests/versions/Unity6000.3/ProjectSettings/ProjectSettings.asset

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,99 @@ PlayerSettings:
298298
AndroidReportGooglePlayAppDependencies: 1
299299
androidSymbolsSizeThreshold: 800
300300
m_BuildTargetIcons: []
301-
m_BuildTargetPlatformIcons: []
301+
m_BuildTargetPlatformIcons:
302+
- m_BuildTarget: Android
303+
m_Icons:
304+
- m_Textures: []
305+
m_Width: 432
306+
m_Height: 432
307+
m_Kind: 2
308+
m_SubKind:
309+
- m_Textures: []
310+
m_Width: 324
311+
m_Height: 324
312+
m_Kind: 2
313+
m_SubKind:
314+
- m_Textures: []
315+
m_Width: 216
316+
m_Height: 216
317+
m_Kind: 2
318+
m_SubKind:
319+
- m_Textures: []
320+
m_Width: 162
321+
m_Height: 162
322+
m_Kind: 2
323+
m_SubKind:
324+
- m_Textures: []
325+
m_Width: 108
326+
m_Height: 108
327+
m_Kind: 2
328+
m_SubKind:
329+
- m_Textures: []
330+
m_Width: 81
331+
m_Height: 81
332+
m_Kind: 2
333+
m_SubKind:
334+
- m_Textures: []
335+
m_Width: 192
336+
m_Height: 192
337+
m_Kind: 1
338+
m_SubKind:
339+
- m_Textures: []
340+
m_Width: 144
341+
m_Height: 144
342+
m_Kind: 1
343+
m_SubKind:
344+
- m_Textures: []
345+
m_Width: 96
346+
m_Height: 96
347+
m_Kind: 1
348+
m_SubKind:
349+
- m_Textures: []
350+
m_Width: 72
351+
m_Height: 72
352+
m_Kind: 1
353+
m_SubKind:
354+
- m_Textures: []
355+
m_Width: 48
356+
m_Height: 48
357+
m_Kind: 1
358+
m_SubKind:
359+
- m_Textures: []
360+
m_Width: 36
361+
m_Height: 36
362+
m_Kind: 1
363+
m_SubKind:
364+
- m_Textures: []
365+
m_Width: 192
366+
m_Height: 192
367+
m_Kind: 0
368+
m_SubKind:
369+
- m_Textures: []
370+
m_Width: 144
371+
m_Height: 144
372+
m_Kind: 0
373+
m_SubKind:
374+
- m_Textures: []
375+
m_Width: 96
376+
m_Height: 96
377+
m_Kind: 0
378+
m_SubKind:
379+
- m_Textures: []
380+
m_Width: 72
381+
m_Height: 72
382+
m_Kind: 0
383+
m_SubKind:
384+
- m_Textures: []
385+
m_Width: 48
386+
m_Height: 48
387+
m_Kind: 0
388+
m_SubKind:
389+
- m_Textures: []
390+
m_Width: 36
391+
m_Height: 36
392+
m_Kind: 0
393+
m_SubKind:
302394
m_BuildTargetBatching: []
303395
m_BuildTargetShaderSettings: []
304396
m_BuildTargetGraphicsJobs: []

tests/versions/Unity6000.5/ProjectSettings/ProjectAuditorSettings.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ MonoBehaviour:
1919
- PlatformGroup:
2020
m_String: Unknown
2121
m_SerializedParams:
22-
- Key: StreamingAssetsFolderSizeLimit
23-
Value: 50
2422
- Key: SpriteAtlasEmptySpaceLimit
2523
Value: 50
24+
- Key: StreamingAssetsFolderSizeLimit
25+
Value: 50
2626
- Key: TextureStreamingMipmapsSizeLimit
2727
Value: 4000
2828
- Key: StreamingClipThresholdBytes
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &1
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 53
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 0}
13+
m_Name:
14+
m_EditorClassIdentifier: UnityEditor.ProjectAuditorModule:Unity.ProjectAuditor.Editor:ProjectAuditorSettings
15+
Rules:
16+
rules: []
17+
DiagnosticParams:
18+
paramsStack:
19+
- PlatformGroup:
20+
m_String: Unknown
21+
m_SerializedParams:
22+
- Key: StreamingAssetsFolderSizeLimit
23+
Value: 50
24+
- Key: StreamingClipThresholdBytes
25+
Value: 218294
26+
- Key: LongDecompressedClipThresholdBytes
27+
Value: 204800
28+
- Key: LongCompressedMobileClipThresholdBytes
29+
Value: 204800
30+
- Key: LoadInBackGroundClipSizeThresholdBytes
31+
Value: 204800
32+
- Key: TextureStreamingMipmapsSizeLimit
33+
Value: 4000
34+
- Key: SpriteAtlasEmptySpaceLimit
35+
Value: 50
36+
CurrentParamsIndex: 0

0 commit comments

Comments
 (0)