aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-30 08:34:37 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-30 08:34:37 -0700
commite50d7be28cda88364bd34dff5e3725a3541ffdb7 (patch)
tree673d55fe7c90eac8d1daed1b0548748162e565a7 /templates
parentf45496fdb040fed2aaeda087d0cdc8ba70b2ce07 (diff)
parente39707458df9c77a2a2570f9dbf3d18b01ca4d68 (diff)
Merge github.com:grpc/grpc into cleaner-posix2
Diffstat (limited to 'templates')
-rw-r--r--templates/BUILD.template32
-rw-r--r--templates/Makefile.template5
-rw-r--r--templates/tools/dockerfile/clang_update.include4
-rw-r--r--templates/tools/dockerfile/gcp_api_libraries.include4
-rw-r--r--templates/tools/dockerfile/grpc_interop_stress_cxx/Dockerfile.template40
-rw-r--r--templates/tools/dockerfile/test/fuzzer/Dockerfile.template43
-rw-r--r--templates/tools/fuzzer/runners.template44
-rw-r--r--templates/vsprojects/buildtests_c.sln.template2
-rw-r--r--templates/vsprojects/grpc.sln.template2
-rw-r--r--templates/vsprojects/vcxproj.template2
10 files changed, 167 insertions, 11 deletions
diff --git a/templates/BUILD.template b/templates/BUILD.template
index 54dc697125..23a656c360 100644
--- a/templates/BUILD.template
+++ b/templates/BUILD.template
@@ -49,7 +49,9 @@
]
if target_dict.get('build', None) == 'protoc':
deps.append("//external:protobuf_compiler")
- if target_dict['name'] == 'grpc++_unsecure' or target_dict['name'] == 'grpc++':
+ if (target_dict['name'] == 'grpc++_unsecure' or
+ target_dict['name'] == 'grpc++' or
+ target_dict['name'] == 'grpc++_codegen_lib'):
deps.append("//external:protobuf_clib")
elif target_dict['name'] == 'grpc':
deps.append("//external:zlib")
@@ -60,7 +62,7 @@
deps.append(':%s' % (d))
return deps
%>
-
+
% for lib in libs:
% if lib.build in ("all", "protoc"):
${cc_library(lib)}
@@ -80,13 +82,19 @@
% endfor
<%def name="cc_library(lib)">
+ <%
+ lib_hdrs = lib.get("headers", [])
+ hdrs = [h for h in lib_hdrs if not h.startswith('third_party/nanopb')]
+ srcs = [s for s in lib.src if not s.startswith('third_party/nanopb')]
+ uses_nanopb = len(lib_hdrs) != len(hdrs) or len(srcs) != len(lib.src)
+ %>
cc_library(
name = "${lib.name}",
srcs = [
- % for hdr in lib.get("headers", []):
+ % for hdr in hdrs:
"${hdr}",
% endfor
- % for src in lib.src:
+ % for src in srcs:
"${src}",
% endfor
],
@@ -103,6 +111,9 @@
% for dep in get_deps(lib):
"${dep}",
% endfor
+ % if uses_nanopb:
+ "//external:nanopb",
+ % endif
],
% if lib.name in ("grpc", "grpc_unsecure"):
copts = [
@@ -113,10 +124,16 @@
</%def>
<%def name="objc_library(lib)">
+ <%
+ lib_hdrs = lib.get("headers", [])
+ hdrs = [h for h in lib_hdrs if not h.startswith('third_party/nanopb')]
+ srcs = [s for s in lib.src if not s.startswith('third_party/nanopb')]
+ uses_nanopb = len(lib_hdrs) != len(hdrs) or len(srcs) != len(lib.src)
+ %>
objc_library(
name = "${lib.name}_objc",
srcs = [
- % for src in lib.src:
+ % for src in srcs:
"${src}",
% endfor
],
@@ -124,7 +141,7 @@
% for hdr in lib.get("public_headers", []):
"${hdr}",
% endfor
- % for hdr in lib.get("headers", []):
+ % for hdr in hdrs:
"${hdr}",
% endfor
],
@@ -139,6 +156,9 @@
% if lib.get('secure', False):
"//external:libssl_objc",
% endif
+ % if uses_nanopb:
+ "//external:nanopb",
+ % endif
],
% if lib.get("baselib", false):
sdk_dylibs = ["libz"],
diff --git a/templates/Makefile.template b/templates/Makefile.template
index c54c146620..57fc146131 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -1737,7 +1737,7 @@
$(LIBDIR)/$(CONFIG)/lib${dep}.a\
% endfor
- % if tgt.language == "c++" or tgt.boringssl:
+ % if tgt.language == "c++" or tgt.boringssl or tgt.build == 'fuzzer':
## C++ targets specificies.
% if tgt.build == 'protoc':
$(E) "[HOSTLD] Linking $@"
@@ -1791,6 +1791,9 @@
% elif tgt.language == 'c++' and tgt.build == 'benchmark':
$(GTEST_LIB)\
% endif
+ % if tgt.build == 'fuzzer':
+ -lFuzzer\
+ % endif
-o $(BINDIR)/$(CONFIG)/${tgt.name}
% if tgt.build == 'protoc' or tgt.language == 'c++':
diff --git a/templates/tools/dockerfile/clang_update.include b/templates/tools/dockerfile/clang_update.include
index 83ab3e0bbb..4f827c8dc2 100644
--- a/templates/tools/dockerfile/clang_update.include
+++ b/templates/tools/dockerfile/clang_update.include
@@ -1,5 +1,5 @@
#=================
-# Update clang to a version with improved tsan
+# Update clang to a version with improved tsan and fuzzing capabilities
RUN apt-get update && apt-get -y install python cmake && apt-get clean
@@ -29,4 +29,4 @@ RUN cd llvm-build && cmake ${'\\'}
-DCMAKE_INSTALL_PREFIX:STRING=/usr ${'\\'}
-DLLVM_TARGETS_TO_BUILD:STRING=X86 ${'\\'}
../llvm
-RUN make -C llvm-build && make -C llvm-build install && rm -rf llvm-build
+RUN make -C llvm-build -j 12 && make -C llvm-build install && rm -rf llvm-build
diff --git a/templates/tools/dockerfile/gcp_api_libraries.include b/templates/tools/dockerfile/gcp_api_libraries.include
new file mode 100644
index 0000000000..669b0f887c
--- /dev/null
+++ b/templates/tools/dockerfile/gcp_api_libraries.include
@@ -0,0 +1,4 @@
+# Google Cloud platform API libraries
+RUN apt-get update && apt-get install -y python-pip && apt-get clean
+RUN pip install --upgrade google-api-python-client
+
diff --git a/templates/tools/dockerfile/grpc_interop_stress_cxx/Dockerfile.template b/templates/tools/dockerfile/grpc_interop_stress_cxx/Dockerfile.template
new file mode 100644
index 0000000000..b1049d0d7f
--- /dev/null
+++ b/templates/tools/dockerfile/grpc_interop_stress_cxx/Dockerfile.template
@@ -0,0 +1,40 @@
+%YAML 1.2
+--- |
+ # Copyright 2015-2016, Google Inc.
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions are
+ # met:
+ #
+ # * Redistributions of source code must retain the above copyright
+ # notice, this list of conditions and the following disclaimer.
+ # * Redistributions in binary form must reproduce the above
+ # copyright notice, this list of conditions and the following disclaimer
+ # in the documentation and/or other materials provided with the
+ # distribution.
+ # * Neither the name of Google Inc. nor the names of its
+ # contributors may be used to endorse or promote products derived from
+ # this software without specific prior written permission.
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ FROM debian:jessie
+
+ <%include file="../apt_get_basic.include"/>
+ <%include file="../ccache_setup.include"/>
+ <%include file="../cxx_deps.include"/>
+ <%include file="../gcp_api_libraries.include"/>
+ <%include file="../clang_update.include"/>
+ # Define the default command.
+ CMD ["bash"]
diff --git a/templates/tools/dockerfile/test/fuzzer/Dockerfile.template b/templates/tools/dockerfile/test/fuzzer/Dockerfile.template
new file mode 100644
index 0000000000..479be0556a
--- /dev/null
+++ b/templates/tools/dockerfile/test/fuzzer/Dockerfile.template
@@ -0,0 +1,43 @@
+%YAML 1.2
+--- |
+ # Copyright 2015-2016, Google Inc.
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions are
+ # met:
+ #
+ # * Redistributions of source code must retain the above copyright
+ # notice, this list of conditions and the following disclaimer.
+ # * Redistributions in binary form must reproduce the above
+ # copyright notice, this list of conditions and the following disclaimer
+ # in the documentation and/or other materials provided with the
+ # distribution.
+ # * Neither the name of Google Inc. nor the names of its
+ # contributors may be used to endorse or promote products derived from
+ # this software without specific prior written permission.
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ FROM debian:jessie
+
+ <%include file="../../apt_get_basic.include"/>
+ <%include file="../../cxx_deps.include"/>
+ <%include file="../../clang_update.include"/>
+ <%include file="../../run_tests_addons.include"/>
+ RUN clang++ -c -g -O2 -std=c++11 llvm/lib/Fuzzer/*.cpp -IFuzzer
+ RUN ar ruv libFuzzer.a Fuzzer*.o
+ RUN mv libFuzzer.a /usr/lib
+ RUN rm -f Fuzzer*.o
+ # Define the default command.
+ CMD ["bash"]
diff --git a/templates/tools/fuzzer/runners.template b/templates/tools/fuzzer/runners.template
new file mode 100644
index 0000000000..aa81a6545d
--- /dev/null
+++ b/templates/tools/fuzzer/runners.template
@@ -0,0 +1,44 @@
+%YAML 1.2
+---
+foreach: targets
+cond: selected.build == 'fuzzer'
+output_name: ${selected.name}.sh
+template: |
+ #!/bin/bash
+ # Copyright 2016, Google Inc.
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions are
+ # met:
+ #
+ # * Redistributions of source code must retain the above copyright
+ # notice, this list of conditions and the following disclaimer.
+ # * Redistributions in binary form must reproduce the above
+ # copyright notice, this list of conditions and the following disclaimer
+ # in the documentation and/or other materials provided with the
+ # distribution.
+ # * Neither the name of Google Inc. nor the names of its
+ # contributors may be used to endorse or promote products derived from
+ # this software without specific prior written permission.
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #
+
+ flags="-max_total_time=3600 -jobs=3 -workers=3"
+ if [ "$config" == "asan-trace-cmp" ]
+ then
+ flags="-use_traces=1 $flags"
+ fi
+
+ bins/$config/${selected.name} $flags fuzzer_output ${' '.join(selected.corpus_dirs)}
diff --git a/templates/vsprojects/buildtests_c.sln.template b/templates/vsprojects/buildtests_c.sln.template
index a985fea64d..21312ab79a 100644
--- a/templates/vsprojects/buildtests_c.sln.template
+++ b/templates/vsprojects/buildtests_c.sln.template
@@ -2,6 +2,6 @@
--- |
<%namespace file="sln_defs.include" import="gen_solution"/>\
<%
- solution_projects = [p for p in vsprojects if p.build != 'protoc' and p.language == 'c' and not p.boringssl and not p.zlib]
+ solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'fuzzer'] and p.language == 'c' and not p.boringssl and not p.zlib]
%>\
${gen_solution(solution_projects, use_dlls='yes')}
diff --git a/templates/vsprojects/grpc.sln.template b/templates/vsprojects/grpc.sln.template
index dbbb2c2ad1..ded98383da 100644
--- a/templates/vsprojects/grpc.sln.template
+++ b/templates/vsprojects/grpc.sln.template
@@ -2,6 +2,6 @@
--- |
<%namespace file="sln_defs.include" import="gen_solution"/>\
<%
- solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++')]
+ solution_projects = [p for p in vsprojects if p.build not in ['protoc', 'test', 'fuzzer'] and p.language in ['c', 'c++'] and p.vs_proj_dir == '.' and not (p.build == 'private' and p.language == 'c++')]
%>\
${gen_solution(solution_projects, use_dlls='yes')}
diff --git a/templates/vsprojects/vcxproj.template b/templates/vsprojects/vcxproj.template
index ecf113b4a8..0bb208f443 100644
--- a/templates/vsprojects/vcxproj.template
+++ b/templates/vsprojects/vcxproj.template
@@ -2,12 +2,14 @@
---
foreach: vsprojects
output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj
+cond: selected.build not in ['fuzzer']
template: |
<%namespace file="vcxproj_defs.include" import="gen_project"/>\
${gen_project(selected.name, vsprojects)}
---
foreach: vsprojects
output_name: ${selected.vs_proj_dir}/${selected.name}/${selected.name}.vcxproj.filters
+cond: selected.build not in ['fuzzer']
template: |
<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\
${gen_filters(selected.name, vsprojects)}