@@ -12,7 +12,7 @@ public static async Task<int> Main(string[] args)
12
12
string configuration = "Release" ;
13
13
bool silent = false ;
14
14
bool skipBuild = false ;
15
- bool test = false ;
15
+ TestTargets testTargets = TestTargets . None ;
16
16
bool zip = RunningOnYamato ( ) ;
17
17
Task < NPath > ? zipTask = null ;
18
18
foreach ( string arg in args )
@@ -32,10 +32,21 @@ public static async Task<int> Main(string[] args)
32
32
else if ( arg . Equals ( "--test" ) )
33
33
{
34
34
skipBuild = true ; // Assume we've already built
35
- test = true ;
35
+ testTargets = TestTargets . All ;
36
+ }
37
+ else if ( arg . StartsWith ( "--test=" ) )
38
+ {
39
+ if ( ! TryParseTestTargets ( arg , out var testTarget ) )
40
+ return 1 ;
41
+ skipBuild = true ; // Assume we've already built
42
+ testTargets = Enum . Parse < TestTargets > ( testTarget , ignoreCase : true ) ;
36
43
}
37
44
}
38
45
46
+ // This gives a way to test and build in the same command
47
+ if ( args . Any ( a => a == "--build" ) )
48
+ skipBuild = false ;
49
+
39
50
if ( RunningOnYamato ( ) )
40
51
{
41
52
zipTask = SevenZip . DownloadAndUnzip7Zip ( ) ;
@@ -70,10 +81,14 @@ public static async Task<int> Main(string[] args)
70
81
SevenZip . Zip ( zipExe , artifacts , gConfig ) ;
71
82
}
72
83
73
- if ( test )
84
+ if ( testTargets != TestTargets . None )
74
85
{
75
- EmbeddingHost . Test ( gConfig ) ;
76
- CoreCLR . Test ( gConfig ) ;
86
+ if ( testTargets . HasFlag ( TestTargets . Embedding ) )
87
+ EmbeddingHost . Test ( gConfig ) ;
88
+
89
+ if ( testTargets . HasFlag ( TestTargets . CoreClr ) )
90
+ CoreCLR . Test ( gConfig ) ;
91
+
77
92
Console . WriteLine ( "******************************" ) ;
78
93
Console . WriteLine ( "Unity: Tested CoreCLR successfully" ) ;
79
94
Console . WriteLine ( "******************************" ) ;
@@ -110,6 +125,16 @@ static NPath ConsolidateArtifacts(GlobalConfig gConfig)
110
125
return destDir ;
111
126
}
112
127
128
+ static bool TryParseTestTargets ( string arg , out string value )
129
+ {
130
+ var values = Enum . GetValues ( typeof ( TestTargets ) ) ;
131
+ var valid = new List < string > ( ) ;
132
+ foreach ( var v in values )
133
+ valid . Add ( v . ToString ( ) . ToLower ( ) ) ;
134
+
135
+ return TryParseArgument ( valid . ToArray ( ) , arg , out value ) ;
136
+ }
137
+
113
138
static bool TryParseArgument ( string [ ] validArgs , string arg , out string value )
114
139
{
115
140
string [ ] args = arg . Split ( '=' ) ;
0 commit comments