aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-12-08 07:54:12 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-12-08 07:54:12 -0800
commit8f3a2406f2f37aaeaa61438361b7d4594fe2e3ab (patch)
tree54ad22df99a5006af1fc9aa88dec97d0e5858d1b /test
parent6a18f0ce93bfc407a84b79e2769e14ac7aa24648 (diff)
parentb50ae4651bf1043a30e4db20cd4b4d3ca2cadfe4 (diff)
Merge pull request #4324 from yang-g/fixit_init_c
add test for global plugin
Diffstat (limited to 'test')
-rw-r--r--test/core/surface/init_test.c (renamed from test/core/surface/multi_init_test.c)15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/core/surface/multi_init_test.c b/test/core/surface/init_test.c
index 99b7a52ff9..c8791965bf 100644
--- a/test/core/surface/multi_init_test.c
+++ b/test/core/surface/init_test.c
@@ -32,8 +32,11 @@
*/
#include <grpc/grpc.h>
+#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
+static int g_flag;
+
static void test(int rounds) {
int i;
for (i = 0; i < rounds; i++) {
@@ -53,11 +56,23 @@ static void test_mixed() {
grpc_shutdown();
}
+static void plugin_init() { g_flag = 1; }
+static void plugin_destroy() { g_flag = 2; }
+
+static void test_plugin() {
+ grpc_register_plugin(plugin_init, plugin_destroy);
+ grpc_init();
+ GPR_ASSERT(g_flag == 1);
+ grpc_shutdown();
+ GPR_ASSERT(g_flag == 2);
+}
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test(1);
test(2);
test(3);
test_mixed();
+ test_plugin();
return 0;
}