Add MOGO_TEST
MultiPart: 1/2
Change-Id: I5e739d8664a64284ea8f7cde68043dac5cb3a3ef
diff --git a/mojo.mk b/mojo.mk
index 61c0a77..4078c7b 100644
--- a/mojo.mk
+++ b/mojo.mk
@@ -55,6 +55,16 @@
rm -f $(basename $2).h
endef
+# Runs Go tests with mojo libraries
+# $1 is input package pattern
+define MOGO_TEST
+ GOPATH="$(GOPATH)" \
+ CGO_CFLAGS="-I$(MOJO_DIR)/src $(CGO_CFLAGS)" \
+ CGO_CXXFLAGS="-I$(MOJO_DIR)/src $(CGO_CXXFLAGS)" \
+ CGO_LDFLAGS="-L$(dir $(MOJO_SHARED_LIB)) -lsystem_thunk $(CGO_LDFLAGS)" \
+ $(GOROOT)/bin/go test $1
+endef
+
# Generates go bindings from .mojom file.
# $1 is input filename.
# $2 is root directory containing mojom files.