Skip to content

Commit

Permalink
Make tests work when 'protoc' command is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
alavrik committed Sep 14, 2018
1 parent 88e56ac commit 3120cf3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/misc1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RESULT = t
SOURCES = id_piqi.ml id_piqi_ext.ml example_piqi.ml example_piqi_ext.ml test.ml


PRE_TARGETS = id.proto.piqi example.proto.piqi id_piqi.ml id_piqi_ext.ml example_piqi.ml example_piqi_ext.ml
PRE_TARGETS = id_piqi.ml id_piqi_ext.ml example_piqi.ml example_piqi_ext.ml


export OCAMLPATH := ../..:$(OCAMLPATH)
Expand All @@ -21,20 +21,18 @@ all: native-code test #byte-code


test:
rm -f *.piqi
./$(RESULT)


%.proto.piqi: %.proto
%_piqi.ml: %.proto $(realpath $(PIQI)) $(PIQIC)
ifneq ($(shell which protoc), )
$(PIQI) of-proto $<


%_piqi.ml: %.proto.piqi
$(PIQIC) $(PIQIC_FLAGS) $<
endif
$(PIQIC) $(PIQIC_FLAGS) $<.piqi


clean::
rm -f *.tmp.ml *.piqi
rm -f *.tmp.ml


include $(OCAMLMAKEFILE)
12 changes: 12 additions & 0 deletions tests/misc1/example.proto.piqi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.protobuf-package "test"

.import [ .module id ]

.record [
.name example
.field [
.name id
.type id/Id
.code 1
]
]
10 changes: 10 additions & 0 deletions tests/misc1/id.proto.piqi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.protobuf-package "test"

.record [
.name Id
.field [
.name id
.type protobuf-int64
.code 1
]
]

0 comments on commit 3120cf3

Please sign in to comment.