aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Kroll <[email protected]>2019-08-14 17:14:18 +0200
committerLoïc Hoguin <[email protected]>2023-05-15 12:11:57 +0200
commit4704d49d915b664d92e82a45d51a9641ba87f2d2 (patch)
tree844b5c5f0d2a1c935ebbe1004e370f01702f2de7 /test
parent5f862a58161282bcefc3bf125c8084ce313b13d2 (diff)
downloaderlang.mk-4704d49d915b664d92e82a45d51a9641ba87f2d2.tar.gz
erlang.mk-4704d49d915b664d92e82a45d51a9641ba87f2d2.tar.bz2
erlang.mk-4704d49d915b664d92e82a45d51a9641ba87f2d2.zip
Added test for protobuf files with imports
Diffstat (limited to 'test')
-rw-r--r--test/plugin_protobuffs.mk32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/plugin_protobuffs.mk b/test/plugin_protobuffs.mk
index 873875e..31198f5 100644
--- a/test/plugin_protobuffs.mk
+++ b/test/plugin_protobuffs.mk
@@ -40,6 +40,38 @@ protobuffs-compile: init
{ok, [empty_pb, simple_pb]} = application:get_key($(APP), modules), \
halt()"
+protobuffs-compile-imports: init
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add protobuffs to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "BUILD_DEPS = gpb\n"}' $(APP)/Makefile
+
+ $i "Download two proto files with an import"
+ $t mkdir $(APP)/src/proto/
+ $t curl -s -o $(APP)/src/proto/exports.proto $(PROTOBUFFS_URL)/proto/exports.proto
+ $t curl -s -o $(APP)/src/proto/imports.proto $(PROTOBUFFS_URL)/proto/imports.proto
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that an Erlang module was generated and compiled"
+ $t test -f $(APP)/src/exports_pb.erl
+ $t test -f $(APP)/src/imports_pb.erl
+ $t test -f $(APP)/include/exports_pb.hrl
+ $t test -f $(APP)/include/imports_pb.hrl
+ $t test -f $(APP)/ebin/exports_pb.beam
+ $t test -f $(APP)/ebin/imports_pb.beam
+
+ $i "Check that the generated modules are included in .app file"
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
+ ok = application:load($(APP)), \
+ {ok, [exports_pb, imports_pb]} = application:get_key($(APP), modules), \
+ halt()"
+
protobuffs-dont-compile: init
$i "Bootstrap a new OTP library named $(APP)"