aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/surface
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-12-07 16:02:05 -0800
committerGravatar yang-g <yangg@google.com>2015-12-07 16:02:05 -0800
commitf1183300ce40c957fc9010e8513c15a15d11afd4 (patch)
tree195c0edb3f31b58c2408833e494ce57cf283e738 /test/core/surface
parentfc4399411cfeb86bf6e29c2067cb8ddc352c3e25 (diff)
add test for global plugin
Diffstat (limited to 'test/core/surface')
-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;
}