Run lint actions in sbox
Run lint actions in sbox with RuleBuilder.SandboxInputs. This copies all input files into the sandbox, which prevents the lint tool from finding nearby source files that were not presented to it. Using SandboxInputs requires use of PathForInput or PathForOutput anywhere a path is used outside of the RuleBuilderCommand methods that take paths so that they can be translated to the paths that will be used in the sandbox. Bug: 181681346 Test: lint_test.go Test: m lint-check dist Test: m USE_RBE=true RBE_LINT=true lint-check dist Test: m USE_RBE=true RBE_LINT=true RBE_LINT_EXEC_STRATEGY=remote lint-check dist Change-Id: Iab4e09d961891ef182643583d4d456e413bc5e39
This commit is contained in:
@@ -25,12 +25,12 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"android/soong/genrule"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/cc"
|
||||
"android/soong/dexpreopt"
|
||||
"android/soong/genrule"
|
||||
"android/soong/python"
|
||||
)
|
||||
|
||||
@@ -1296,9 +1296,9 @@ func TestJavaLint(t *testing.T) {
|
||||
})
|
||||
|
||||
foo := ctx.ModuleForTests("foo", "android_common")
|
||||
rule := foo.Rule("lint")
|
||||
|
||||
if !strings.Contains(rule.RuleParams.Command, "--baseline lint-baseline.xml") {
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline lint-baseline.xml") {
|
||||
t.Error("did not pass --baseline flag")
|
||||
}
|
||||
}
|
||||
@@ -1318,9 +1318,9 @@ func TestJavaLintWithoutBaseline(t *testing.T) {
|
||||
`, map[string][]byte{})
|
||||
|
||||
foo := ctx.ModuleForTests("foo", "android_common")
|
||||
rule := foo.Rule("lint")
|
||||
|
||||
if strings.Contains(rule.RuleParams.Command, "--baseline") {
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
|
||||
if strings.Contains(*sboxProto.Commands[0].Command, "--baseline") {
|
||||
t.Error("passed --baseline flag for non existent file")
|
||||
}
|
||||
}
|
||||
@@ -1376,9 +1376,9 @@ func TestJavaLintUsesCorrectBpConfig(t *testing.T) {
|
||||
})
|
||||
|
||||
foo := ctx.ModuleForTests("foo", "android_common")
|
||||
rule := foo.Rule("lint")
|
||||
|
||||
if !strings.Contains(rule.RuleParams.Command, "--baseline mybaseline.xml") {
|
||||
sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto"))
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--baseline mybaseline.xml") {
|
||||
t.Error("did not use the correct file for baseline")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user