aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Dan Born <dborn+github@google.com>2016-01-20 14:16:29 -0800
committerGravatar Dan Born <dborn+github@google.com>2016-01-20 14:16:29 -0800
commitbeeb4c2ad75533848ac0fca545a3b4785d8fce57 (patch)
treeeed3a91f80967ab90ae4cbc559503015bd3a0483 /test/core
parentb13a69da41ddad7880f409c53d1f55982ee79ac5 (diff)
parent4c3c397bbea2acf023950f7470fe36d2e7322cc0 (diff)
Merge branch 'master' into tcp_listener
Diffstat (limited to 'test/core')
-rwxr-xr-xtest/core/bad_client/gen_build_yaml.py13
-rwxr-xr-xtest/core/bad_ssl/gen_build_yaml.py11
-rw-r--r--test/core/end2end/end2end_nosec_tests.c2
-rw-r--r--test/core/end2end/end2end_tests.c2
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py36
-rw-r--r--test/core/fling/client.c9
-rw-r--r--test/core/iomgr/tcp_posix_test.c2
-rw-r--r--test/core/security/jwt_verifier_test.c2
-rw-r--r--test/core/support/avl_test.c19
-rw-r--r--test/core/support/cpu_test.c2
-rw-r--r--test/core/transport/chttp2/bin_encoder_test.c6
11 files changed, 59 insertions, 45 deletions
diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py
index a86a50065d..c538bffd71 100755
--- a/test/core/bad_client/gen_build_yaml.py
+++ b/test/core/bad_client/gen_build_yaml.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -35,15 +35,15 @@
import collections
import yaml
-TestOptions = collections.namedtuple('TestOptions', 'flaky')
-default_test_options = TestOptions(False)
+TestOptions = collections.namedtuple('TestOptions', 'flaky cpu_cost')
+default_test_options = TestOptions(False, 1.0)
# maps test names to options
BAD_CLIENT_TESTS = {
'badreq': default_test_options,
- 'connection_prefix': default_test_options,
- 'headers': default_test_options,
- 'initial_settings_frame': default_test_options,
+ 'connection_prefix': default_test_options._replace(cpu_cost=0.2),
+ 'headers': default_test_options._replace(cpu_cost=0.2),
+ 'initial_settings_frame': default_test_options._replace(cpu_cost=0.2),
'server_registered_method': default_test_options,
'simple_request': default_test_options,
'window_overflow': default_test_options,
@@ -75,6 +75,7 @@ def main():
'targets': [
{
'name': '%s_bad_client_test' % t,
+ 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost,
'build': 'test',
'language': 'c',
'secure': 'no',
diff --git a/test/core/bad_ssl/gen_build_yaml.py b/test/core/bad_ssl/gen_build_yaml.py
index 15189d8b79..cc097a8fdf 100755
--- a/test/core/bad_ssl/gen_build_yaml.py
+++ b/test/core/bad_ssl/gen_build_yaml.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -35,13 +35,13 @@
import collections
import yaml
-TestOptions = collections.namedtuple('TestOptions', 'flaky')
-default_test_options = TestOptions(False)
+TestOptions = collections.namedtuple('TestOptions', 'flaky cpu_cost')
+default_test_options = TestOptions(False, 1.0)
# maps test names to options
BAD_CLIENT_TESTS = {
- 'cert': default_test_options,
- 'alpn': default_test_options,
+ 'cert': default_test_options._replace(cpu_cost=0.1),
+ 'alpn': default_test_options._replace(cpu_cost=0.1),
}
def main():
@@ -84,6 +84,7 @@ def main():
for t in sorted(BAD_CLIENT_TESTS.keys())] + [
{
'name': 'bad_ssl_%s_test' % t,
+ 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost,
'build': 'test',
'language': 'c',
'src': ['test/core/bad_ssl/bad_ssl_test.c'],
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c
index d9df5fd7f0..9ff46d62e4 100644
--- a/test/core/end2end/end2end_nosec_tests.c
+++ b/test/core/end2end/end2end_nosec_tests.c
@@ -258,7 +258,7 @@ void grpc_end2end_tests(int argc, char **argv,
trailing_metadata(config);
continue;
}
- gpr_log(GPR_DEBUG, "not a test: '%%s'", argv[i]);
+ gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]);
abort();
}
}
diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c
index 7b1471eb89..397ff446a9 100644
--- a/test/core/end2end/end2end_tests.c
+++ b/test/core/end2end/end2end_tests.c
@@ -264,7 +264,7 @@ void grpc_end2end_tests(int argc, char **argv,
trailing_metadata(config);
continue;
}
- gpr_log(GPR_DEBUG, "not a test: '%%s'", argv[i]);
+ gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]);
abort();
}
}
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index 6a4038da73..f24dbe72cf 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -77,40 +77,42 @@ END2END_FIXTURES = {
}
TestOptions = collections.namedtuple(
- 'TestOptions', 'needs_fullstack needs_dns proxyable secure traceable')
-default_test_options = TestOptions(False, False, True, False, True)
+ 'TestOptions', 'needs_fullstack needs_dns proxyable secure traceable cpu_cost')
+default_test_options = TestOptions(False, False, True, False, True, 1.0)
connectivity_test_options = default_test_options._replace(needs_fullstack=True)
+LOWCPU = 0.1
+
# maps test names to options
END2END_TESTS = {
'bad_hostname': default_test_options,
'binary_metadata': default_test_options,
'call_creds': default_test_options._replace(secure=True),
- 'cancel_after_accept': default_test_options,
- 'cancel_after_client_done': default_test_options,
- 'cancel_after_invoke': default_test_options,
- 'cancel_before_invoke': default_test_options,
- 'cancel_in_a_vacuum': default_test_options,
- 'cancel_with_status': default_test_options,
- 'channel_connectivity': connectivity_test_options._replace(proxyable=False),
+ 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_after_invoke': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU),
+ 'channel_connectivity': connectivity_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
'channel_ping': connectivity_test_options._replace(proxyable=False),
- 'compressed_payload': default_test_options._replace(proxyable=False),
+ 'compressed_payload': default_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
'default_host': default_test_options._replace(needs_fullstack=True,
needs_dns=True),
'disappearing_server': connectivity_test_options,
'empty_batch': default_test_options,
- 'graceful_server_shutdown': default_test_options,
+ 'graceful_server_shutdown': default_test_options._replace(cpu_cost=LOWCPU),
'hpack_size': default_test_options._replace(proxyable=False,
traceable=False),
'high_initial_seqno': default_test_options,
'invoke_large_request': default_test_options,
'large_metadata': default_test_options,
'max_concurrent_streams': default_test_options._replace(proxyable=False),
- 'max_message_length': default_test_options,
+ 'max_message_length': default_test_options._replace(cpu_cost=LOWCPU),
'metadata': default_test_options,
'negative_deadline': default_test_options,
'no_op': default_test_options,
- 'payload': default_test_options,
+ 'payload': default_test_options._replace(cpu_cost=LOWCPU),
'ping_pong_streaming': default_test_options,
'registered_call': default_test_options,
'request_with_flags': default_test_options._replace(proxyable=False),
@@ -118,7 +120,7 @@ END2END_TESTS = {
'server_finishes_request': default_test_options,
'shutdown_finishes_calls': default_test_options,
'shutdown_finishes_tags': default_test_options,
- 'simple_delayed_request': connectivity_test_options,
+ 'simple_delayed_request': connectivity_test_options._replace(cpu_cost=LOWCPU),
'simple_request': default_test_options,
'trailing_metadata': default_test_options,
}
@@ -252,12 +254,13 @@ def main():
END2END_FIXTURES[f].platforms, 'mac')),
'flaky': False,
'language': 'c',
+ 'cpu_cost': END2END_TESTS[t].cpu_cost,
}
for f in sorted(END2END_FIXTURES.keys())
for t in sorted(END2END_TESTS.keys()) if compatible(f, t)
] + [
{
- 'name': '%s_test' % f,
+ 'name': '%s_nosec_test' % f,
'args': [t],
'exclude_configs': [],
'platforms': END2END_FIXTURES[f].platforms,
@@ -266,6 +269,7 @@ def main():
END2END_FIXTURES[f].platforms, 'mac')),
'flaky': False,
'language': 'c',
+ 'cpu_cost': END2END_TESTS[t].cpu_cost,
}
for f in sorted(END2END_FIXTURES.keys())
if not END2END_FIXTURES[f].secure
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 99b30d6c4a..95e2ea1f10 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -201,13 +201,16 @@ int main(int argc, char **argv) {
sc.init();
- for (i = 0; i < 1000; i++) {
+ gpr_timespec end_warmup = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3);
+ gpr_timespec end_profiling = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(30);
+
+ while (gpr_time_cmp(gpr_now(end_warmup.clock_type), end_warmup) < 0) {
sc.do_one_step();
}
gpr_log(GPR_INFO, "start profiling");
grpc_profiler_start("client.prof");
- for (i = 0; i < 100000; i++) {
+ while (gpr_time_cmp(gpr_now(end_profiling.clock_type), end_profiling) < 0) {
start = now();
sc.do_one_step();
stop = now();
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index b59ba1014b..e0136b3cd7 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 9f37e0374c..f396398cef 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.c
index 6530fe4269..d8d8b36806 100644
--- a/test/core/support/avl_test.c
+++ b/test/core/support/avl_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -3611,32 +3611,33 @@ static void test_badcase3(void) {
gpr_avl_unref(avl);
}
-static void test_stress(void) {
+static void test_stress(int amount_of_stress) {
int added[1024];
int i, j;
int deletions = 0;
gpr_avl avl;
- gpr_log(GPR_DEBUG, "test_stress");
+ unsigned seed = (unsigned)time(NULL);
+
+ gpr_log(GPR_DEBUG, "test_stress amount=%d seed=%u", amount_of_stress, seed);
srand((unsigned)time(NULL));
avl = gpr_avl_create(&int_int_vtable);
memset(added, 0, sizeof(added));
- for (i = 1; deletions < 1000; i++) {
+ for (i = 1; deletions < amount_of_stress; i++) {
int idx = rand() % (int)GPR_ARRAY_SIZE(added);
GPR_ASSERT(i);
if (rand() < RAND_MAX / 2) {
added[idx] = i;
- fprintf(stderr, "avl = gpr_avl_add(avl, box(%d), box(%d)); /* d=%d */\n",
- idx, i, deletions);
+ printf("avl = gpr_avl_add(avl, box(%d), box(%d)); /* d=%d */\n", idx, i,
+ deletions);
avl = gpr_avl_add(avl, box(idx), box(i));
} else {
deletions += (added[idx] != 0);
added[idx] = 0;
- fprintf(stderr, "avl = remove_int(avl, %d); /* d=%d */\n", idx,
- deletions);
+ printf("avl = remove_int(avl, %d); /* d=%d */\n", idx, deletions);
avl = remove_int(avl, idx);
}
for (j = 0; j < (int)GPR_ARRAY_SIZE(added); j++) {
@@ -3665,7 +3666,7 @@ int main(int argc, char *argv[]) {
test_badcase1();
test_badcase2();
test_badcase3();
- test_stress();
+ test_stress(10);
return 0;
}
diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.c
index a5c52442ad..da16f13fd8 100644
--- a/test/core/support/cpu_test.c
+++ b/test/core/support/cpu_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c
index 1ffd8ed3cb..d1838075be 100644
--- a/test/core/transport/chttp2/bin_encoder_test.c
+++ b/test/core/transport/chttp2/bin_encoder_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,10 @@
#include <string.h>
+/* This is here for grpc_is_binary_header
+ * TODO(murgatroid99): Remove this
+ */
+#include <grpc/grpc.h>
#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>