summaryrefslogtreecommitdiffstats
path: root/tests/fuzztest/SConscript
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-09-20 14:12:19 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-09-20 14:29:39 +0300
commitb03be4fa4d863e6beb362cfef6d834d14c96b7e1 (patch)
tree31bdb84f1be4ce5104d4a67d3e5c321f12639b83 /tests/fuzztest/SConscript
parent6e72df4808aa138f1396ad098ce2d06a6feba882 (diff)
Add syntax specification to .proto files (issue #167)
Eliminates a warning on protoc 3.0.
Diffstat (limited to 'tests/fuzztest/SConscript')
-rw-r--r--tests/fuzztest/SConscript15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/fuzztest/SConscript b/tests/fuzztest/SConscript
index 35b697f9..973148c2 100644
--- a/tests/fuzztest/SConscript
+++ b/tests/fuzztest/SConscript
@@ -2,16 +2,19 @@
Import("env", "malloc_env")
+def set_pkgname(src, dst, pkgname):
+ data = open(str(src)).read()
+ placeholder = '// package name placeholder'
+ assert placeholder in data
+ data = data.replace(placeholder, 'package %s;' % pkgname)
+ open(str(dst), 'w').write(data)
+
# We want both pointer and static versions of the AllTypes message
# Prefix them with package name.
env.Command("alltypes_static.proto", "#alltypes/alltypes.proto",
- lambda target, source, env:
- open(str(target[0]), 'w').write("package alltypes_static;\n"
- + open(str(source[0])).read()))
+ lambda target, source, env: set_pkgname(source[0], target[0], 'alltypes_static'))
env.Command("alltypes_pointer.proto", "#alltypes/alltypes.proto",
- lambda target, source, env:
- open(str(target[0]), 'w').write("package alltypes_pointer;\n"
- + open(str(source[0])).read()))
+ lambda target, source, env: set_pkgname(source[0], target[0], 'alltypes_pointer'))
p1 = env.NanopbProto(["alltypes_pointer", "alltypes_pointer.options"])
p2 = env.NanopbProto(["alltypes_static", "alltypes_static.options"])