Fix fuzzer tests for Bazel

pull/14395/head
Adele Zhou 7 years ago
parent 1d168541fd
commit 0ad0e5d684
  1. 7
      test/core/bad_ssl/generate_tests.bzl
  2. 7
      test/core/util/fuzzer_corpus_test.cc
  3. 1
      test/core/util/grpc_fuzzer.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,

@ -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());

@ -23,5 +23,6 @@ def grpc_fuzzer(name, corpus, srcs = [], deps = [], **kwargs):
external_deps = [
'gtest',
],
args = ["--directory=" + native.package_name() + "/" + corpus,],
**kwargs
)

Loading…
Cancel
Save