@@ -78,7 +78,7 @@ func TestHasGoBuild(t *testing.T) {
7878 // we will presumably find out about it when those tests fail.)
7979 switch runtime .GOOS {
8080 case "ios" :
81- if strings . HasSuffix ( b , "-corellium" ) {
81+ if isCorelliumBuilder ( b ) {
8282 // The corellium environment is self-hosting, so it should be able
8383 // to build even though real "ios" devices can't exec.
8484 } else {
@@ -89,7 +89,7 @@ func TestHasGoBuild(t *testing.T) {
8989 return
9090 }
9191 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 ) {
9393 // As of 2023-05-02, the test environment on the emulated builders is
9494 // missing a C linker.
9595 t .Logf ("HasGoBuild is false on %s" , b )
@@ -153,7 +153,7 @@ func TestMustHaveExec(t *testing.T) {
153153 t .Errorf ("expected MustHaveExec to skip on %v" , runtime .GOOS )
154154 }
155155 case "ios" :
156- if b := testenv .Builder (); strings . HasSuffix ( b , "-corellium" ) && ! hasExec {
156+ if b := testenv .Builder (); isCorelliumBuilder ( b ) && ! hasExec {
157157 // Most ios environments can't exec, but the corellium builder can.
158158 t .Errorf ("expected MustHaveExec not to skip on %v" , b )
159159 }
@@ -186,3 +186,23 @@ func TestCleanCmdEnvPWD(t *testing.T) {
186186 }
187187 t .Error ("PWD not set in cmd.Env" )
188188}
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