diff options
Diffstat (limited to 'cc/proto_test.go')
-rw-r--r-- | cc/proto_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cc/proto_test.go b/cc/proto_test.go index 6fee92410..4f0de7801 100644 --- a/cc/proto_test.go +++ b/cc/proto_test.go @@ -17,6 +17,8 @@ package cc import ( "strings" "testing" + + "android/soong/android" ) func TestProto(t *testing.T) { @@ -33,4 +35,37 @@ func TestProto(t *testing.T) { t.Errorf("expected '--cpp_out' in %q", cmd) } }) + + t.Run("plugin", func(t *testing.T) { + ctx := testCc(t, ` + cc_binary_host { + name: "protoc-gen-foobar", + stl: "none", + } + + cc_library_shared { + name: "libfoo", + srcs: ["a.proto"], + proto: { + plugin: "foobar", + }, + }`) + + buildOS := android.BuildOs.String() + + proto := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_core_shared").Output("proto/a.pb.cc") + foobar := ctx.ModuleForTests("protoc-gen-foobar", buildOS+"_x86_64") + + cmd := proto.RuleParams.Command + if w := "--foobar_out="; !strings.Contains(cmd, w) { + t.Errorf("expected %q in %q", w, cmd) + } + + foobarPath := foobar.Module().(android.HostToolProvider).HostToolPath().String() + + if w := "--plugin=protoc-gen-foobar=" + foobarPath; !strings.Contains(cmd, w) { + t.Errorf("expected %q in %q", w, cmd) + } + }) + } |