From 0ad0e5d684b9e479798d4f3e59da354c39268a2a Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Fri, 9 Feb 2018 13:48:58 -0800 Subject: Fix fuzzer tests for Bazel --- test/core/util/fuzzer_corpus_test.cc | 7 +++++++ test/core/util/grpc_fuzzer.bzl | 1 + 2 files changed, 8 insertions(+) (limited to 'test/core/util') 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 #include +#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 ) -- cgit v1.2.3