@@ -78,7 +78,7 @@ func TestHasGoBuild(t *testing.T) {
78
78
// we will presumably find out about it when those tests fail.)
79
79
switch runtime .GOOS {
80
80
case "ios" :
81
- if strings . HasSuffix ( b , "-corellium" ) {
81
+ if isCorelliumBuilder ( b ) {
82
82
// The corellium environment is self-hosting, so it should be able
83
83
// to build even though real "ios" devices can't exec.
84
84
} else {
@@ -89,7 +89,7 @@ func TestHasGoBuild(t *testing.T) {
89
89
return
90
90
}
91
91
case "android" :
92
- if strings . HasSuffix ( b , "-emu" ) && platform .MustLinkExternal (runtime .GOOS , runtime .GOARCH , false ) {
92
+ if isEmulatedBuilder ( b ) && platform .MustLinkExternal (runtime .GOOS , runtime .GOARCH , false ) {
93
93
// As of 2023-05-02, the test environment on the emulated builders is
94
94
// missing a C linker.
95
95
t .Logf ("HasGoBuild is false on %s" , b )
@@ -153,7 +153,7 @@ func TestMustHaveExec(t *testing.T) {
153
153
t .Errorf ("expected MustHaveExec to skip on %v" , runtime .GOOS )
154
154
}
155
155
case "ios" :
156
- if b := testenv .Builder (); strings . HasSuffix ( b , "-corellium" ) && ! hasExec {
156
+ if b := testenv .Builder (); isCorelliumBuilder ( b ) && ! hasExec {
157
157
// Most ios environments can't exec, but the corellium builder can.
158
158
t .Errorf ("expected MustHaveExec not to skip on %v" , b )
159
159
}
@@ -186,3 +186,23 @@ func TestCleanCmdEnvPWD(t *testing.T) {
186
186
}
187
187
t .Error ("PWD not set in cmd.Env" )
188
188
}
189
+
190
+ func isCorelliumBuilder (builderName string ) bool {
191
+ // Support both the old infra's builder names and the LUCI builder names.
192
+ // The former's names are ad-hoc so we could maintain this invariant on
193
+ // the builder side. The latter's names are structured, and "corellium" will
194
+ // appear as a "host" suffix after the GOOS and GOARCH, which always begin
195
+ // with an underscore.
196
+ return strings .HasSuffix (builderName , "-corellium" ) || strings .Contains (builderName , "_corellium" )
197
+ }
198
+
199
+ func isEmulatedBuilder (builderName string ) bool {
200
+ // Support both the old infra's builder names and the LUCI builder names.
201
+ // The former's names are ad-hoc so we could maintain this invariant on
202
+ // the builder side. The latter's names are structured, and the signifier
203
+ // of emulation "emu" will appear as a "host" suffix after the GOOS and
204
+ // GOARCH because it modifies the run environment in such a way that it
205
+ // the target GOOS and GOARCH may not match the host. This suffix always
206
+ // begins with an underscore.
207
+ return strings .HasSuffix (builderName , "-emu" ) || strings .Contains (builderName , "_emu" )
208
+ }
0 commit comments