null build upon repeated mixed build

no implicit deps on bazel-tools

Test: USE_BAZEL_ANALYSIS=1 ../bazel/ci/incremental_mixed_build.sh
Bug: b/216194240
Change-Id: Ibbd87c6a6cc2fddf21fba37a6bb4e72adc209576
This commit is contained in:
Usta Shrestha
2022-06-02 14:23:02 -04:00
parent dd3ea92609
commit ef92225a67
4 changed files with 125 additions and 24 deletions

View File

@@ -93,7 +93,7 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
"label": "two"
}]
}`,
"cd 'er' && rm -f one && touch foo",
"cd 'test/exec_root' && rm -f 'one' && touch foo",
}, {`
{
"artifacts": [{
@@ -124,17 +124,17 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
"label": "parent"
}]
}`,
`cd 'er' && rm -f parent/one && bogus command && sed -i'' -E 's@(^|\s|")bazel-out/@\1bo/@g' 'parent/one.d'`,
`cd 'test/exec_root' && rm -f 'parent/one' && bogus command && sed -i'' -E 's@(^|\s|")bazel-out/@\1test/bazel_out/@g' 'parent/one.d'`,
},
}
for _, testCase := range testCases {
for i, testCase := range testCases {
bazelContext, _ := testBazelContext(t, map[bazelCommand]string{
bazelCommand{command: "aquery", expression: "deps(@soong_injection//mixed_builds:buildroot)"}: testCase.input})
err := bazelContext.InvokeBazel(testConfig)
if err != nil {
t.Fatalf("Did not expect error invoking Bazel, but got %s", err)
t.Fatalf("testCase #%d: did not expect error invoking Bazel, but got %s", i+1, err)
}
got := bazelContext.BuildStatementsToRegister()
@@ -143,9 +143,9 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
}
cmd := RuleBuilderCommand{}
createCommand(&cmd, got[0], "er", "bo", PathContextForTesting(TestConfig("out", nil, "", nil)))
if actual := cmd.buf.String(); testCase.command != actual {
t.Errorf("expected: [%s], actual: [%s]", testCase.command, actual)
createCommand(&cmd, got[0], "test/exec_root", "test/bazel_out", PathContextForTesting(TestConfig("out", nil, "", nil)))
if actual, expected := cmd.buf.String(), testCase.command; expected != actual {
t.Errorf("expected: [%s], actual: [%s]", expected, actual)
}
}
}