Add tests for request_type ParseResult functions.
Test: go test request_type_test
Test: bp2build generate & sync; mixed build libc
Change-Id: Id0b813e9de4d02d8625e42549999659ccb005c6d
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 31c31fb..2697007 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -67,7 +67,7 @@
// TODO(cparsons): Other cquery-related methods should be added here.
// Returns the results of GetOutputFiles and GetCcObjectFiles in a single query (in that order).
- GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool)
+ GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool, error)
// ** End cquery methods
@@ -132,9 +132,9 @@
return result, ok
}
-func (m MockBazelContext) GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool) {
+func (m MockBazelContext) GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool, error) {
result, ok := m.LabelToCcInfo[label]
- return result, ok
+ return result, ok, nil
}
func (m MockBazelContext) InvokeBazel() error {
@@ -163,21 +163,22 @@
return ret, ok
}
-func (bazelCtx *bazelContext) GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool) {
+func (bazelCtx *bazelContext) GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool, error) {
result, ok := bazelCtx.cquery(label, cquery.GetCcInfo, archType)
if !ok {
- return cquery.CcInfo{}, ok
+ return cquery.CcInfo{}, ok, nil
}
bazelOutput := strings.TrimSpace(result)
- return cquery.GetCcInfo.ParseResult(bazelOutput), ok
+ ret, err := cquery.GetCcInfo.ParseResult(bazelOutput)
+ return ret, ok, err
}
func (n noopBazelContext) GetOutputFiles(label string, archType ArchType) ([]string, bool) {
panic("unimplemented")
}
-func (n noopBazelContext) GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool) {
+func (n noopBazelContext) GetCcInfo(label string, archType ArchType) (cquery.CcInfo, bool, error) {
panic("unimplemented")
}