Cleanup test, check fail fast or not

pull/8205/head
Craig Tiller 8 years ago
parent a0629e8c1e
commit 012372f044
  1. 36
      Makefile
  2. 11
      build.yaml
  3. 20
      test/core/end2end/connection_refused_test.c
  4. 16
      tools/run_tests/sources_and_headers.json
  5. 21
      tools/run_tests/tests.json
  6. 27
      vsprojects/buildtests_c.sln

@ -919,6 +919,7 @@ client_fuzzer: $(BINDIR)/$(CONFIG)/client_fuzzer
combiner_test: $(BINDIR)/$(CONFIG)/combiner_test combiner_test: $(BINDIR)/$(CONFIG)/combiner_test
compression_test: $(BINDIR)/$(CONFIG)/compression_test compression_test: $(BINDIR)/$(CONFIG)/compression_test
concurrent_connectivity_test: $(BINDIR)/$(CONFIG)/concurrent_connectivity_test concurrent_connectivity_test: $(BINDIR)/$(CONFIG)/concurrent_connectivity_test
connection_refused_test: $(BINDIR)/$(CONFIG)/connection_refused_test
dns_resolver_connectivity_test: $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test dns_resolver_connectivity_test: $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test
dns_resolver_test: $(BINDIR)/$(CONFIG)/dns_resolver_test dns_resolver_test: $(BINDIR)/$(CONFIG)/dns_resolver_test
dualstack_socket_test: $(BINDIR)/$(CONFIG)/dualstack_socket_test dualstack_socket_test: $(BINDIR)/$(CONFIG)/dualstack_socket_test
@ -1249,6 +1250,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/combiner_test \ $(BINDIR)/$(CONFIG)/combiner_test \
$(BINDIR)/$(CONFIG)/compression_test \ $(BINDIR)/$(CONFIG)/compression_test \
$(BINDIR)/$(CONFIG)/concurrent_connectivity_test \ $(BINDIR)/$(CONFIG)/concurrent_connectivity_test \
$(BINDIR)/$(CONFIG)/connection_refused_test \
$(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test \ $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test \
$(BINDIR)/$(CONFIG)/dns_resolver_test \ $(BINDIR)/$(CONFIG)/dns_resolver_test \
$(BINDIR)/$(CONFIG)/dualstack_socket_test \ $(BINDIR)/$(CONFIG)/dualstack_socket_test \
@ -1575,6 +1577,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/compression_test || ( echo test compression_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/compression_test || ( echo test compression_test failed ; exit 1 )
$(E) "[RUN] Testing concurrent_connectivity_test" $(E) "[RUN] Testing concurrent_connectivity_test"
$(Q) $(BINDIR)/$(CONFIG)/concurrent_connectivity_test || ( echo test concurrent_connectivity_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/concurrent_connectivity_test || ( echo test concurrent_connectivity_test failed ; exit 1 )
$(E) "[RUN] Testing connection_refused_test"
$(Q) $(BINDIR)/$(CONFIG)/connection_refused_test || ( echo test connection_refused_test failed ; exit 1 )
$(E) "[RUN] Testing dns_resolver_connectivity_test" $(E) "[RUN] Testing dns_resolver_connectivity_test"
$(Q) $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test || ( echo test dns_resolver_connectivity_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/dns_resolver_connectivity_test || ( echo test dns_resolver_connectivity_test failed ; exit 1 )
$(E) "[RUN] Testing dns_resolver_test" $(E) "[RUN] Testing dns_resolver_test"
@ -7547,6 +7551,38 @@ endif
endif endif
CONNECTION_REFUSED_TEST_SRC = \
test/core/end2end/connection_refused_test.c \
CONNECTION_REFUSED_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CONNECTION_REFUSED_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/connection_refused_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/connection_refused_test: $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(CONNECTION_REFUSED_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/connection_refused_test
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/connection_refused_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_connection_refused_test: $(CONNECTION_REFUSED_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(CONNECTION_REFUSED_TEST_OBJS:.o=.dep)
endif
endif
DNS_RESOLVER_CONNECTIVITY_TEST_SRC = \ DNS_RESOLVER_CONNECTIVITY_TEST_SRC = \
test/core/client_config/resolvers/dns_resolver_connectivity_test.c \ test/core/client_config/resolvers/dns_resolver_connectivity_test.c \

@ -1460,6 +1460,17 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: connection_refused_test
cpu_cost: 0.1
build: test
language: c
src:
- test/core/end2end/connection_refused_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: dns_resolver_connectivity_test - name: dns_resolver_connectivity_test
cpu_cost: 0.1 cpu_cost: 0.1
build: test build: test

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -42,7 +42,7 @@
static void *tag(intptr_t i) { return (void *)i; } static void *tag(intptr_t i) { return (void *)i; }
int main(int argc, char **argv) { static void run_test(bool fail_fast) {
grpc_channel *chan; grpc_channel *chan;
grpc_call *call; grpc_call *call;
gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2); gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2);
@ -55,7 +55,8 @@ int main(int argc, char **argv) {
char *details = NULL; char *details = NULL;
size_t details_capacity = 0; size_t details_capacity = 0;
grpc_test_init(argc, argv); gpr_log(GPR_INFO, "TEST: fail_fast=%d", fail_fast);
grpc_init(); grpc_init();
grpc_metadata_array_init(&trailing_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv);
@ -72,7 +73,7 @@ int main(int argc, char **argv) {
op = ops; op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA; op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0; op->data.send_initial_metadata.count = 0;
op->flags = 0; op->flags = fail_fast ? 0 : GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY;
op->reserved = NULL; op->reserved = NULL;
op++; op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@ -89,7 +90,11 @@ int main(int argc, char **argv) {
CQ_EXPECT_COMPLETION(cqv, tag(1), 1); CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
cq_verify(cqv); cq_verify(cqv);
GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); if (fail_fast) {
GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE);
} else {
GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
}
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);
while ( while (
@ -105,6 +110,11 @@ int main(int argc, char **argv) {
grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv);
grpc_shutdown(); grpc_shutdown();
}
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
run_test(true);
run_test(false);
return 0; return 0;
} }

@ -316,6 +316,22 @@
"third_party": false, "third_party": false,
"type": "target" "type": "target"
}, },
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"language": "c",
"name": "connection_refused_test",
"src": [
"test/core/end2end/connection_refused_test.c"
],
"third_party": false,
"type": "target"
},
{ {
"deps": [ "deps": [
"gpr", "gpr",

@ -379,6 +379,27 @@
"windows" "windows"
] ]
}, },
{
"args": [],
"ci_platforms": [
"linux",
"mac",
"posix",
"windows"
],
"cpu_cost": 0.1,
"exclude_configs": [],
"flaky": false,
"gtest": false,
"language": "c",
"name": "connection_refused_test",
"platforms": [
"linux",
"mac",
"posix",
"windows"
]
},
{ {
"args": [], "args": [],
"ci_platforms": [ "ci_platforms": [

@ -231,6 +231,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "connection_prefix_bad_clien
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "connection_refused_test", "vcxproj\test\connection_refused_test\connection_refused_test.vcxproj", "{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dns_resolver_connectivity_test", "vcxproj\test\dns_resolver_connectivity_test\dns_resolver_connectivity_test.vcxproj", "{F7B6FE68-E847-D7CA-4062-E737E542BCC3}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dns_resolver_connectivity_test", "vcxproj\test\dns_resolver_connectivity_test\dns_resolver_connectivity_test.vcxproj", "{F7B6FE68-E847-D7CA-4062-E737E542BCC3}"
ProjectSection(myProperties) = preProject ProjectSection(myProperties) = preProject
lib = "False" lib = "False"
@ -1855,6 +1866,22 @@ Global
{AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|Win32.Build.0 = Release|Win32 {AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|Win32.Build.0 = Release|Win32
{AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|x64.ActiveCfg = Release|x64 {AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|x64.ActiveCfg = Release|x64
{AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|x64.Build.0 = Release|x64 {AF9D0EB2-2A53-B815-3A63-E82C7F91DB29}.Release-DLL|x64.Build.0 = Release|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|Win32.ActiveCfg = Debug|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|x64.ActiveCfg = Debug|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|Win32.ActiveCfg = Release|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|x64.ActiveCfg = Release|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|Win32.Build.0 = Debug|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug|x64.Build.0 = Debug|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|Win32.Build.0 = Release|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release|x64.Build.0 = Release|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|Win32.Build.0 = Debug|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|x64.ActiveCfg = Debug|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Debug-DLL|x64.Build.0 = Debug|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|Win32.ActiveCfg = Release|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|Win32.Build.0 = Release|Win32
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|x64.ActiveCfg = Release|x64
{961DFABF-18F2-7D46-4D69-B82A5E9A78B2}.Release-DLL|x64.Build.0 = Release|x64
{F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Debug|Win32.ActiveCfg = Debug|Win32 {F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Debug|Win32.ActiveCfg = Debug|Win32
{F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Debug|x64.ActiveCfg = Debug|x64 {F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Debug|x64.ActiveCfg = Debug|x64
{F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Release|Win32.ActiveCfg = Release|Win32 {F7B6FE68-E847-D7CA-4062-E737E542BCC3}.Release|Win32.ActiveCfg = Release|Win32

Loading…
Cancel
Save