aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar adelez <adelez@google.com>2018-02-12 23:41:35 -0800
committerGravatar GitHub <noreply@github.com>2018-02-12 23:41:35 -0800
commit8224c45866c6a2cfa29ede0c91a6ae9f40572658 (patch)
treec78559de9e9c5683f7d375ad3bf858c7b291db60
parent7b3b4e0025c7fdffdf1fd6032180a5d31d004cb9 (diff)
parent3e13d123b75a99b68f24834e0356160d25e585e7 (diff)
Merge pull request #14395 from adelez/foundry_integration
Fix fuzzer tests for Bazel
-rw-r--r--templates/tools/dockerfile/test/sanity/Dockerfile.template10
-rwxr-xr-xtest/core/bad_ssl/generate_tests.bzl7
-rw-r--r--test/core/util/fuzzer_corpus_test.cc7
-rw-r--r--test/core/util/grpc_fuzzer.bzl1
-rw-r--r--tools/dockerfile/test/bazel/Dockerfile10
-rw-r--r--tools/dockerfile/test/sanity/Dockerfile10
6 files changed, 27 insertions, 18 deletions
diff --git a/templates/tools/dockerfile/test/sanity/Dockerfile.template b/templates/tools/dockerfile/test/sanity/Dockerfile.template
index 7453e6c460..69bb7c4671 100644
--- a/templates/tools/dockerfile/test/sanity/Dockerfile.template
+++ b/templates/tools/dockerfile/test/sanity/Dockerfile.template
@@ -46,12 +46,12 @@
RUN apt-get -y update
RUN apt-get -y install bazel
- # Pin Bazel to 0.4.4
- # Installing Bazel via apt-get first is required before installing 0.4.4 to
+ # Pin Bazel to 0.9.0
+ # Installing Bazel via apt-get first is required before installing 0.9.0 to
# allow gRPC to build without errors. See https://github.com/grpc/grpc/issues/10553
- RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-linux-x86_64.sh
- RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh
- RUN ./bazel-0.4.4-installer-linux-x86_64.sh
+ RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-installer-linux-x86_64.sh
+ RUN chmod +x ./bazel-0.9.0-installer-linux-x86_64.sh
+ RUN ./bazel-0.9.0-installer-linux-x86_64.sh
<%include file="../../clang5.include"/>
<%include file="../../run_tests_addons.include"/>
diff --git a/test/core/bad_ssl/generate_tests.bzl b/test/core/bad_ssl/generate_tests.bzl
index 3cf7fd7b4e..22e7d3a692 100755
--- a/test/core/bad_ssl/generate_tests.bzl
+++ b/test/core/bad_ssl/generate_tests.bzl
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary")
def test_options():
return struct()
@@ -22,7 +23,7 @@ def test_options():
BAD_SSL_TESTS = ['cert', 'alpn']
def grpc_bad_ssl_tests():
- native.cc_library(
+ grpc_cc_library(
name = 'bad_ssl_test_server',
srcs = ['server_common.cc'],
hdrs = ['server_common.h'],
@@ -31,12 +32,12 @@ def grpc_bad_ssl_tests():
'//test/core/end2end:ssl_test_data']
)
for t in BAD_SSL_TESTS:
- native.cc_binary(
+ grpc_cc_binary(
name = 'bad_ssl_%s_server' % t,
srcs = ['servers/%s.cc' % t],
deps = [':bad_ssl_test_server'],
)
- native.cc_test(
+ grpc_cc_test(
name = 'bad_ssl_%s_test' % t,
srcs = ['bad_ssl_test.cc'],
data = [':bad_ssl_%s_server' % t,
diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc
index 7849321257..18bc0ad69e 100644
--- a/test/core/util/fuzzer_corpus_test.cc
+++ b/test/core/util/fuzzer_corpus_test.cc
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <sys/types.h>
+#include "src/core/lib/gpr/env.h"
#include "src/core/lib/iomgr/load_file.h"
#include "test/core/util/test_config.h"
@@ -68,6 +69,12 @@ class ExampleGenerator
if (examples_.empty()) {
if (!FLAGS_file.empty()) examples_.push_back(FLAGS_file);
if (!FLAGS_directory.empty()) {
+ char* test_srcdir = gpr_getenv("TEST_SRCDIR");
+ if (test_srcdir != nullptr) {
+ FLAGS_directory = test_srcdir +
+ std::string("/com_github_grpc_grpc/") +
+ FLAGS_directory;
+ }
DIR* dp;
struct dirent* ep;
dp = opendir(FLAGS_directory.c_str());
diff --git a/test/core/util/grpc_fuzzer.bzl b/test/core/util/grpc_fuzzer.bzl
index b8b270ecd0..cece023fc0 100644
--- a/test/core/util/grpc_fuzzer.bzl
+++ b/test/core/util/grpc_fuzzer.bzl
@@ -23,5 +23,6 @@ def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs):
external_deps = [
'gtest',
],
+ args = ["--directory=" + native.package_name() + "/" + corpus,],
**kwargs
)
diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile
index ba668eafc7..e5e81136cb 100644
--- a/tools/dockerfile/test/bazel/Dockerfile
+++ b/tools/dockerfile/test/bazel/Dockerfile
@@ -33,12 +33,12 @@ RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get -y update
RUN apt-get -y install bazel
-# Pin Bazel to 0.4.4
-# Installing Bazel via apt-get first is required before installing 0.4.4 to
+# Pin Bazel to 0.9.0
+# Installing Bazel via apt-get first is required before installing 0.9.0 to
# allow gRPC to build without errors. See https://github.com/grpc/grpc/issues/10553
-RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-linux-x86_64.sh
-RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh
-RUN ./bazel-0.4.4-installer-linux-x86_64.sh
+RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-installer-linux-x86_64.sh
+RUN chmod +x ./bazel-0.9.0-installer-linux-x86_64.sh
+RUN ./bazel-0.9.0-installer-linux-x86_64.sh
RUN mkdir -p /var/local/jenkins
diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile
index 7a8e1c09b1..f65adf589d 100644
--- a/tools/dockerfile/test/sanity/Dockerfile
+++ b/tools/dockerfile/test/sanity/Dockerfile
@@ -98,12 +98,12 @@ RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get -y update
RUN apt-get -y install bazel
-# Pin Bazel to 0.4.4
-# Installing Bazel via apt-get first is required before installing 0.4.4 to
+# Pin Bazel to 0.9.0
+# Installing Bazel via apt-get first is required before installing 0.9.0 to
# allow gRPC to build without errors. See https://github.com/grpc/grpc/issues/10553
-RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-linux-x86_64.sh
-RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh
-RUN ./bazel-0.4.4-installer-linux-x86_64.sh
+RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.9.0/bazel-0.9.0-installer-linux-x86_64.sh
+RUN chmod +x ./bazel-0.9.0-installer-linux-x86_64.sh
+RUN ./bazel-0.9.0-installer-linux-x86_64.sh
RUN apt-get update && apt-get -y install wget xz-utils
RUN wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz