summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anas Sulaiman <mrahs@google.com> 2023-10-20 14:41:18 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-10-20 14:41:18 +0000
commitf76b3267d52aa90f99ba6b75d33a8231a1db9e58 (patch)
tree9a20f779ca5690537a3e5d2fa7295611582aecab
parentb60cd11bc7e4ebb55ddb8101e309052166da8011 (diff)
parent9c4936405ed2aba6b2ecdb78b168a8a478686b20 (diff)
Merge "support toggling compare mode for rbe actions" into main
-rw-r--r--java/droidstubs.go5
-rw-r--r--remoteexec/remoteexec.go11
2 files changed, 16 insertions, 0 deletions
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 8039d0515..a7e8eb659 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -19,6 +19,7 @@ import (
"path/filepath"
"regexp"
"sort"
+ "strconv"
"strings"
"github.com/google/blueprint/proptools"
@@ -497,6 +498,7 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
if metalavaUseRbe(ctx) {
rule.Remoteable(android.RemoteRuleSupports{RBE: true})
execStrategy := ctx.Config().GetenvWithDefault("RBE_METALAVA_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
+ compare, _ := strconv.ParseBool(ctx.Config().GetenvWithDefault("RBE_METALAVA_COMPARE", "false"))
labels := map[string]string{"type": "tool", "name": "metalava"}
// TODO: metalava pool rejects these jobs
pool := ctx.Config().GetenvWithDefault("RBE_METALAVA_POOL", "java16")
@@ -505,6 +507,9 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
ExecStrategy: execStrategy,
ToolchainInputs: []string{config.JavaCmd(ctx).String()},
Platform: map[string]string{remoteexec.PoolKey: pool},
+ Compare: compare,
+ NumLocalRuns: 1,
+ NumRemoteRuns: 1,
})
}
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index 9e7a0f1e3..150d62c04 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -15,6 +15,7 @@
package remoteexec
import (
+ "fmt"
"sort"
"strings"
)
@@ -84,6 +85,12 @@ type REParams struct {
// EnvironmentVariables is a list of environment variables whose values should be passed through
// to the remote execution.
EnvironmentVariables []string
+ // Boolean indicating whether to compare chosen exec strategy with local execution.
+ Compare bool
+ // Number of times the action should be rerun locally.
+ NumLocalRuns int
+ // Number of times the action should be rerun remotely.
+ NumRemoteRuns int
}
func init() {
@@ -135,6 +142,10 @@ func (r *REParams) wrapperArgs() string {
}
args += " --exec_strategy=" + strategy
+ if r.Compare && r.NumLocalRuns >= 0 && r.NumRemoteRuns >= 0 {
+ args += fmt.Sprintf(" --compare=true --num_local_reruns=%d --num_remote_reruns=%d", r.NumLocalRuns, r.NumRemoteRuns)
+ }
+
if len(r.Inputs) > 0 {
args += " --inputs=" + strings.Join(r.Inputs, ",")
}