@@ -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 } ") ;
0 commit comments